Commit ff642ab7 authored by Yoann Sallaz Damaz's avatar Yoann Sallaz Damaz
Browse files

add different state to actuator multi wago

parent 859f3cf7
Pipeline #52772 failed with stages
......@@ -12,11 +12,11 @@ class Actuator_multiwago(Actuator):
(bool): True if IN. False if OUT, None if no check possible.
"""
if self.key_in:
return self.controller_state.get(self.key_in)
return self.controller_state.get(self.key_in) == 1
if self.key_out:
return not self.controller_state.get(self.key_out)
return self.controller_state.get(self.key_out) == 0
if self.key_cmd:
return self.controller.get(self.key_cmd)
return self.controller.get(self.key_cmd) == 1
def _is_out(self):
""" Check if the actuator is in position OUT
......@@ -24,8 +24,28 @@ class Actuator_multiwago(Actuator):
(bool): True if OUT. False if IN, None if no check possible.
"""
if self.key_out:
return self.controller_state.get(self.key_out)
return self.controller_state.get(self.key_out) == 1
if self.key_in:
return not self.controller_state.get(self.key_in)
return self.controller_state.get(self.key_in) == 0
if self.key_cmd:
return not self.controller.get(self.key_cmd)
\ No newline at end of file
return self.controller.get(self.key_cmd) == 0
def is_open(self):
return self._is_out()
def is_close(self):
return self._is_in()
def on(self):
self.set_in()
def off(self):
self.set_out()
def __repr__(self):
if self.state == "IN":
return "IN/ON/CLOSE"
elif self.state == "OUT":
return "OUT/OFF/OPEN"
else:
return self.state
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment