megakid / ha_octopus_intelligent

Apache License 2.0
86 stars 10 forks source link

Sensors missing in HA 2023.11.3 with 1.6.2 #27

Open tomkiss opened 8 months ago

tomkiss commented 8 months ago

After upgrading to HA 2023.11.1 and installing the Intelligent Octopus integration through the dashboard, there appear to only be two sensors available, "Octopus Intelligent Next Offpeak Start" and "Octopus Intelligent Next Offpeak End".

image

Any ideas how to get back binary_sensor.octopus_intelligent_slot?

tomkiss commented 8 months ago

Checked the logs, and can see the following error:


Logger: homeassistant.components.binary_sensor
Source: helpers/entity_platform.py:359
Integration: Binary Sensor ([documentation](https://www.home-assistant.io/integrations/binary_sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+binary_sensor%22))
First occurred: 15:04:55 (1 occurrences)
Last logged: 15:04:55

Error while setting up octopus_intelligent platform for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/octopus_intelligent/binary_sensor.py", line 19, in async_setup_entry
    OctopusIntelligentSlot(
  File "/config/custom_components/octopus_intelligent/binary_sensor.py", line 59, in __init__
    self._timer = async_track_utc_time_change(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1687, in async_track_utc_time_change
    f"time change listener {hour}:{minute}:{second} {action}",
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1211, in __repr__
    return f"<entity {self.entity_id}={self._stringify_state(self.available)}>"
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 749, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 218, in state
    if (is_on := self.is_on) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/octopus_intelligent/binary_sensor.py", line 100, in is_on
    return self._is_on
           ^^^^^^^^^^^
AttributeError: 'OctopusIntelligentSlot' object has no attribute '_is_on'```
tomkiss commented 8 months ago

I can see others have had this problem in the summer, which was fixed for them in v1.6.2, so I'm not sure what I'm doing wrong here. Will keep poking...