Skip to content

Commit

Permalink
time.py - not working
Browse files Browse the repository at this point in the history
attempts to write, but fails as not an integer
still not reading the stored time from the corresponding sensor
  • Loading branch information
wills106 authored Oct 29, 2023
1 parent 63fb108 commit ed5ca3f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions custom_components/solax_modbus/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,24 @@ def unique_id(self) -> Optional[str]:
return f"{self._platform_name}_{self._key}"

#@property
#def native_value(self) -> time | None:
# """Return the value reported by the time."""
# return time(self.entity_description).isoformat
#def native_value(self) -> float:
# _LOGGER.info(f"debug 1 {self._hub}")
# descr = self.entity_description
# _LOGGER.info(f"debug 2 {descr}")
# return descr

def set_value(self, value: time) -> None:
"""Change the time."""
#def set_value(self, value: time) -> None:
# """Change the time."""
# self._attr_native_value = time(hour=self._key,minute=self._key)
#setattr(self._option_dict, self.entity_description.key, value)
return self._attr_native_value
#value = self._attr_native_value
#_LOGGER.info(f"native value {value}")
#return value

async def async_select_option(self, value: time) -> None:
"""Change the select option."""
async def async_set_value(self, value: time) -> None:
"""Change the time."""
payload = get_payload(self._option_dict, value)
_LOGGER.info(f"writing {self._platform_name} select register {self._register} payload before writing {payload}")
if self._write_method == WRITE_MULTISINGLE_MODBUS:
_LOGGER.info(f"writing {self._platform_name} select register {self._register} value {payload}")
self._hub.write_registers_single(unit=self._modbus_addr, address=self._register, payload=payload)
Expand Down

0 comments on commit ed5ca3f

Please sign in to comment.