Skip to content

Commit

Permalink
Update switch.py
Browse files Browse the repository at this point in the history
  • Loading branch information
WillCodeForCats committed Feb 6, 2025
1 parent 06932af commit f66ff05
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions custom_components/solaredge_modbus_multi/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,15 @@ async def async_turn_on(self, **kwargs: Any) -> None:
set_bits = set_bits | (1 << 10)

_LOGGER.debug(f"set {self.unique_id} bits {set_bits:016b}")
payload = ModbusClientMixin.convert_to_registers(
set_bits, data_type=ModbusClientMixin.DATATYPE.UINT16, word_order="little"

await self._platform.write_registers(
address=57344,
payload=ModbusClientMixin.convert_to_registers(
set_bits,
data_type=ModbusClientMixin.DATATYPE.UINT16,
word_order="little",
),
)
await self._platform.write_registers(address=57344, payload=payload)
await self.async_update()

async def async_turn_off(self, **kwargs: Any) -> None:
Expand Down

0 comments on commit f66ff05

Please sign in to comment.