jheling / freeathome

Free@Home component for Home Assistant
103 stars 37 forks source link

Library generates non-unique IDs, blocks integration in Home Assistant #166

Closed guerda closed 8 months ago

guerda commented 9 months ago

Since I updated the free at home firmware to version 3.2.2. I cannot control devices anymore and the communication fails with an error in home Assistant.

Here is one example for an error in the log

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/freeathome/fah/pfreeathome.py:338
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 1. Oktober 2023 um 19:27:33 (20 occurrences)
Last logged: 20:02:31

[3492225192] <iq id="cd1da8bf293b4083a839a64c0c18b79e" type="set" to="mrha@busch-jaeger.de/rpc" from="878590a0-206e-4977-8089-464b6b1d9b02@busch-jaeger.de/79203aa2"><query xmlns="jabber:iq:rpc"><methodCall><methodName>RemoteInterface.setDatapoint</methodName><params><param><value><string>FFFF48000001/ch0000/odp0000</string></value></param><param><value><string>1</string></value></param></params></methodCall></query></iq>
[3492225192] <iq id="760d5a87ba204564b88f2e983b6241a7" type="set" to="mrha@busch-jaeger.de/rpc" from="878590a0-206e-4977-8089-464b6b1d9b02@busch-jaeger.de/79203aa2"><query xmlns="jabber:iq:rpc"><methodCall><methodName>RemoteInterface.setDatapoint</methodName><params><param><value><string>FFFF48000001/ch0000/odp0000</string></value></param><param><value><string>1</string></value></param></params></methodCall></query></iq>
[3492225192] <iq id="3764e4b30b4d49db9e036776ce2c5be9" type="set" to="mrha@busch-jaeger.de/rpc" from="878590a0-206e-4977-8089-464b6b1d9b02@busch-jaeger.de/79203aa2"><query xmlns="jabber:iq:rpc"><methodCall><methodName>RemoteInterface.setDatapoint</methodName><params><param><value><string>FFFF48000001/ch0000/odp0000</string></value></param><param><value><string>1</string></value></param></params></methodCall></query></iq>
[3492225192] <iq id="013dd26716ef4362abc1831d1b657c8a" type="set" to="mrha@busch-jaeger.de/rpc" from="878590a0-206e-4977-8089-464b6b1d9b02@busch-jaeger.de/79203aa2"><query xmlns="jabber:iq:rpc"><methodCall><methodName>RemoteInterface.setDatapoint</methodName><params><param><value><string>ABB2907A2D51/ch0011/idp0000</string></value></param><param><value><string>0</string></value></param></params></methodCall></query></iq>
[3492225192] <iq id="da47cc6e59484f8f8952c2173edcc416" type="set" to="mrha@busch-jaeger.de/rpc" from="878590a0-206e-4977-8089-464b6b1d9b02@busch-jaeger.de/a6fbcb75"><query xmlns="jabber:iq:rpc"><methodCall><methodName>RemoteInterface.setDatapoint</methodName><params><param><value><string>ABB700D277DE/ch0003/idp0000</string></value></param><param><value><string>1</string></value></param></params></methodCall></query></iq>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 227, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1969, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2006, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call
    response_data = await _handle_entity_call(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 591, in async_handle_light_off_service
    await light.async_turn_off(**filter_turn_off_params(light, params))
  File "/config/custom_components/freeathome/light.py", line 102, in async_turn_off
    await self.light_device.turn_off()
  File "/config/custom_components/freeathome/fah/devices/fah_light.py", line 57, in turn_off
    await self.client.set_datapoint(self.serialnumber, self.channel_id, self._datapoints[PID_SWITCH_ON_OFF], '0')
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 338, in set_datapoint
    await self.send_rpc_iq('RemoteInterface.setDatapoint',
slixmpp.exceptions.IqTimeout: <iq id="7a1e12b83d4744f8b2142d0f7e3d1cd9" type="set" to="mrha@busch-jaeger.de/rpc" from="878590a0-206e-4977-8089-464b6b1d9b02@busch-jaeger.de/a6fbcb75"><query xmlns="jabber:iq:rpc"><methodCall><methodName>RemoteInterface.setDatapoint</methodName><params><param><value><string>ABB2557A2D51/ch000C/idp0000</string></value></param><param><value><string>0</string></value></param></params></methodCall></query></iq>
guerda commented 9 months ago

It seems to be a different reason. As soon as I reload the addon, some messages appear in the logs.

It seems that the newest home Assistant version is not allowing those IDs anymore

Logger: homeassistant.components.binary_sensor
Source: helpers/entity_platform.py:610
Integration: Binärsensor (documentation, issues)
First occurred: 30. September 2023 um 14:25:28 (300 occurrences)
Last logged: 21:02:35

Platform freeathome does not generate unique IDs. ID ABB700D18BBF/ch0003 already exists - ignoring binary_sensor.licht_xxxx1
Platform freeathome does not generate unique IDs. ID ABB700D27923/ch0003 already exists - ignoring binary_sensor.licht_xxxx2
Platform freeathome does not generate unique IDs. ID ABB700D27939/ch0000 already exists - ignoring binary_sensor.licht_xxxx3
Platform freeathome does not generate unique IDs. ID ABB700D39087/ch0000 already exists - ignoring binary_sensor.licht_xxxx4
Platform freeathome does not generate unique IDs. ID ABB700D3908B/ch0000 already exists - ignoring binary_sensor.licht_xxxx5
m4rsi commented 8 months ago

I am on homeassistant 2023.9.3 and SysAP 3.2.2 with no issues. So this should have something to do with version 2023.10. I do not dare to upgrade yet.

guerda commented 8 months ago

It's safe to upgrade fah as long as you have the newest addon installed.

I forgot to upgrade the addon via HACS. Since I installed the newest upgrade, I have no problem anymore

m4rsi commented 8 months ago

@guerda I have not installed HACS. So you think I am safe to upgrade homeassistant to 2023.10 ?

guerda commented 8 months ago

If you have a manual installation of the addon, I recommend updating it too. It should be safe to upgrade the addon (manual or via HACS) and also update HA.