cryptk / haomnilogic-local

A Home Assistant integration for Hayward OmniLogic/OmniHub pool controllers using the local UDP api
Apache License 2.0
18 stars 4 forks source link

"Unable to locate a heater for sensor id: 20" (could be due to solar heating?) #60

Closed lurgh closed 1 year ago

lurgh commented 1 year ago

NB: this Omnilogic pool has a solar heater in addition to gas heater. Might be relevant to this issue?

This error flashes at the bottom of the screen as a failure on various operations like turning on a light, which reports that the operation failed although it does work (the light does turn on). I also see this same exception being the underlying cause of other errors in the log.

Example from the log:

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/omnilogic_local/sensor.py:213 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 1:39:07 PM (10 occurrences) Last logged: 2:26:11 PM

[140022850452944] Unable to locate a heater for sensor id: 20 [140022868589136] Unable to locate a heater for sensor id: 20

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 205, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1910, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1950, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 226, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 811, in entity_service_call future.result() # pop exception if have ^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1034, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 851, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 582, in async_handle_light_on_service await light.async_turn_on(**filter_turn_on_params(light, params)) File "/config/custom_components/omnilogic_local/light.py", line 151, in async_turn_on self.set_telemetry(updated_data) File "/config/custom_components/omnilogic_local/entity.py", line 90, in set_telemetry self.coordinator.async_set_updated_data(self.coordinator.data) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 401, in async_set_updated_data self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in async_update_listeners update_callback() File "/config/custom_components/omnilogic_local/entity.py", line 48, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 590, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 654, in _async_write_ha_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 596, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 469, in state value = self.native_value ^^^^^^^^^^^^^^^^^ File "/config/custom_components/omnilogic_local/sensor.py", line 204, in native_value temp = self.sensed_data.telemetry.temp ^^^^^^^^^^^^^^^^ File "/config/custom_components/omnilogic_local/sensor.py", line 153, in sensed_data return cast(T, self.coordinator.data[self.sensed_system_id]) ^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/omnilogic_local/sensor.py", line 213, in sensed_system_id raise OmniLogicError("Unable to locate a heater for sensor id: %s" % self.system_id) custom_components.omnilogic_local.errors.OmniLogicError: Unable to locate a heater for sensor id: 20

cryptk commented 1 year ago

Interesting... I have solar heat as well. Can you download the diagnostic data from the integration and attach it?

lurgh commented 1 year ago

Attaching. I also saw that the solar rooftop temp (SolarSensor) exists in the config (ID #20, the ID being complained about) but is not present in telemetry and reports Unavailable in the integration.

config_entry-omnilogic_local-b890d5d9a7b6ea9c7a9a4f1420be7eb5_1.json.txt

cryptk commented 1 year ago

@lurgh I have it mostly fixed locally for your pool, it was a problem related to having more than one heater. One question I have, it looks like you have two solar temperature sensors on your spa? I'm seeing the following snippet in your MSPConfig:

...
            <Sensor>
                <System-Id>17</System-Id>
                <Name>WaterSensor</Name>
                <Type>SENSOR_WATER_TEMP</Type>
                <Units>UNITS_FAHRENHEIT</Units>
                <Operation>
                    PEO_GET_VALUE
                    <Action>
                        <Action-Function>ACT_FNC_GET_WATER_TEMP</Action-Function>
                        <Action-Data1>18</Action-Data1>
                        <Action-Data2>2</Action-Data2>
                        <Action-Data3>0</Action-Data3>
                    </Action>
                </Operation>
            </Sensor>
            <Sensor>
                <System-Id>21</System-Id>
                <Name>SolarSensor</Name>
                <Type>SENSOR_SOLAR_TEMP</Type>
                <Units>UNITS_FAHRENHEIT</Units>
                <Operation>
                    PEO_GET_VALUE
                    <Action>
                        <Action-Function>ACT_FNC_GET_SOLAR_TEMP</Action-Function>
                        <Action-Data1>20</Action-Data1>
                        <Action-Data2>5</Action-Data2>
                        <Action-Data3>0</Action-Data3>
                    </Action>
                </Operation>
            </Sensor>
            <Sensor>
                <System-Id>38</System-Id>
                <Name>SolarSensor</Name>
                <Type>SENSOR_SOLAR_TEMP</Type>
                <Units>UNITS_FAHRENHEIT</Units>
                <Operation>
                    PEO_GET_VALUE
                    <Action>
                        <Action-Function>ACT_FNC_GET_SOLAR_TEMP</Action-Function>
                        <Action-Data1>20</Action-Data1>
                        <Action-Data2>5</Action-Data2>
                        <Action-Data3>0</Action-Data3>
                    </Action>
                </Operation>
            </Sensor>
...

I'm not sure how to support more than one solar temperature sensor per body of water as a solar heater can only be associated with a single solar temperature sensor in the Omni. In your case your solar heater has <Sensor-System-Id>38</Sensor-System-Id> so the sensor with System-Id 21 doesn't appear to be associated with anything?

cryptk commented 1 year ago

Here is what I'm going to do... I'll configure solar sensors that have a matching solar heater, and one time at startup, I'll log a warning about having a solar sensor with no associated solar heater.

cryptk commented 1 year ago

@lurgh try release 0.5.1

lurgh commented 1 year ago

Seems like a good plan. Meanwhile there is actually only one sensor so I will check the MSP configuration and see since the initial setup of the solar sensor was a problem and it wouldn’t surprise me if something was left behind from an early attempt of configuring that sensor.

On Jun 23, 2023, at 9:28 AM, cryptk @.***> wrote:

Here is what I'm going to do... I'll configure solar sensors that have a matching solar heater, and one time at startup, I'll log a warning about having a solar sensor with no associated solar heater.

— Reply to this email directly, view it on GitHub https://github.com/cryptk/haomnilogic-local/issues/60#issuecomment-1604519135, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKI22UMENFOS7OERFGP5EYDXMW723ANCNFSM6AAAAAAZQ3HK5U. You are receiving this because you were mentioned.

lurgh commented 1 year ago

confirmed 0.5.1 looks a lot better including showing the correct rooftop temperature. no more errors. thanks!

FWIW i don’t see a warning about the extra sensor. i will still chase that down in the MSP config when i can get out there.

On Jun 23, 2023, at 10:20 AM, cryptk @.***> wrote:

@lurgh https://github.com/lurgh try release 0.5.1

— Reply to this email directly, view it on GitHub https://github.com/cryptk/haomnilogic-local/issues/60#issuecomment-1604586489, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKI22UNTM46UFLGW7Z252VTXMXF7JANCNFSM6AAAAAAZQ3HK5U. You are receiving this because you were mentioned.

cryptk commented 1 year ago

The warning will be right at the beginning when it's creating all of the entities, you can see it in the output here saying "Unable to locate a solar heater for sensor id: 21" when I simulate your pool:

2023-06-23 12:48:49.646 DEBUG (MainThread) [custom_components.omnilogic_local.binary_sensor] Configuring binary sensor for service mode with ID: 0
2023-06-23 12:48:49.647 DEBUG (MainThread) [custom_components.omnilogic_local.binary_sensor] Configuring sensor for heater equipment with ID: 5, Name: Gas
2023-06-23 12:48:49.647 DEBUG (MainThread) [custom_components.omnilogic_local.binary_sensor] Configuring sensor for heater equipment with ID: 18, Name: Solar
2023-06-23 12:48:49.647 DEBUG (MainThread) [custom_components.omnilogic_local.binary_sensor] Configuring sensor for heater equipment with ID: 12, Name: Gas
2023-06-23 12:48:49.647 DEBUG (MainThread) [custom_components.omnilogic_local.binary_sensor] Configuring sensor for heater equipment with ID: 19, Name: Solar
2023-06-23 12:48:49.651 INFO (MainThread) [homeassistant.components.button] Setting up button.omnilogic_local
2023-06-23 12:48:49.652 DEBUG (MainThread) [custom_components.omnilogic_local.sensor] Configuring sensor for air temperature with ID: 16, Name: AirSensor
2023-06-23 12:48:49.652 DEBUG (MainThread) [custom_components.omnilogic_local.sensor] Configuring sensor for water temperature with ID: 6, Name: WaterSensor
2023-06-23 12:48:49.652 DEBUG (MainThread) [custom_components.omnilogic_local.sensor] Configuring sensor for water temperature with ID: 17, Name: WaterSensor
2023-06-23 12:48:49.653 WARNING (MainThread) [custom_components.omnilogic_local.sensor] Unable to locate a solar heater for sensor id: 21
2023-06-23 12:48:49.653 DEBUG (MainThread) [custom_components.omnilogic_local.sensor] Configuring sensor for filter energy with ID: 3, Name: Filter Pump
2023-06-23 12:48:49.653 DEBUG (MainThread) [custom_components.omnilogic_local.sensor] Configuring sensor for filter energy with ID: 10, Name: Filter Pump
2023-06-23 12:48:49.674 INFO (MainThread) [homeassistant.components.number] Setting up number.omnilogic_local
2023-06-23 12:48:49.675 DEBUG (MainThread) [custom_components.omnilogic_local.button] Configuring button for pump with ID: 3, Name: Filter Pump, Speed: low
2023-06-23 12:48:49.675 DEBUG (MainThread) [custom_components.omnilogic_local.button] Configuring button for pump with ID: 3, Name: Filter Pump, Speed: medium