Closed FredericNauleau closed 3 years ago
Found the bug:
in switch.py, you made a mistake between R and VO In VirtualOutSwitch class
class VirtualOutSwitch(IpxDevice, SwitchEntity):
"""Representation of a IPX Virtual Out."""
def __init__(self, ipx_device):
super().__init__(ipx_device)
self.control = VOutput(self.controller.ipx, self._id)
@property
def is_on(self) -> bool:
return self.coordinator.data[f"R{self._id}"] == 1
def turn_on(self, **kwargs):
self.control.on()
def turn_off(self, **kwargs):
self.control.off()
def toggle(self, **kwargs):
self.control.toggle()
should be:
class VirtualOutSwitch(IpxDevice, SwitchEntity):
"""Representation of a IPX Virtual Out."""
def __init__(self, ipx_device):
super().__init__(ipx_device)
self.control = VOutput(self.controller.ipx, self._id)
@property
def is_on(self) -> bool:
return self.coordinator.data[f"VO{self._id}"] == 1
def turn_on(self, **kwargs):
self.control.on()
def turn_off(self, **kwargs):
self.control.off()
def toggle(self, **kwargs):
self.control.toggle()
thank you, fix : https://github.com/Aohzan/ipx800/releases/tag/1.8.2
I have create a switch based on virtualout (id: 4).
The switch state is not updated in home assistant (always off). If I activate the switch in home assistant, the http request is done on IPX and the virtual out is set on IPX.
But the state come back to off in home assistant....
If I do a binary_sensor, the state is get form IPX to home assistant but I cannot toggle it in homeassistant (for sure it's a sensor).
I think there is a thing with Switch and Virtualout.