home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70.13k stars 29.18k forks source link

homematic component servicemessages count wrong #12599

Closed nicx closed 6 years ago

nicx commented 6 years ago

Sometimes the "Sensor" for CCU servicemessages are not reflecting the CCU variable state correctly, see attached screenshots. HA says 1 message, the CCU variable is 0. In addition I recognice that the sensor most of the time shows doubled values, for example the CCU has 3 servicemessages, the homematic component in HA shows 6. I am using the HA version 0.63.2

Is this a bug?

bildschirmfoto 2018-02-22 um 11 43 27 bildschirmfoto 2018-02-22 um 11 46 00
m0wlheld commented 6 years ago

Sometimes the "Sensor" for CCU servicemessages are not reflecting the CCU variable state correctly, see attached screenshots.

Can you show us the sensor configuration? I have Homematic configured using Homegear and some time in the past I saw this sensor, but now it's gone.

nicx commented 6 years ago

@m0wlheld this is not configured as a standalone sensor, its an attribute of the Home Assisstant Homematic component integration.

m0wlheld commented 6 years ago

Sorry to bother you again, but what is the entity_id of that sensor? As I said: I had it in the past but cannot find it with recent HA versions (0.63 and above).

nicx commented 6 years ago

In my case the entity_id is "homematic.ccu2" as seen in the attached screenshot. As you can see the problem still exists with my current HA version 0.64.3, because the attribute of the entitiy shows "3" messages, my CCU shows "1".

bildschirmfoto 2018-03-05 um 10 34 00 bildschirmfoto 2018-03-05 um 10 36 11
m0wlheld commented 6 years ago

Thanks. I have no homematic.XXX sensor in my entity list, maybe because I use Homegear, not an Homematic appliance like CCU2. Not subject to this issue.

nicx commented 6 years ago

any news to this problem? @danielperna84 perhaps you could have a look? ;)

danielperna84 commented 6 years ago

@m0wlheld To get the CCU entity you have to add a host-block to your configuration. Something like this:

homematic:
  interfaces:
    rf:
      host: 127.0.0.1
  hosts:
    homegear:
      host: 127.0.0.1

Looking at this though there might be a problem in the code. It's not possible to customize the port, which might be necessary in some cases. It's always using 2001. But besides that you should get an entity where the state is the sum of service messages, and the variables should be accessible via the attributes of the entity.

@nicx I have just tested it again. I detached a door-sensor, which causes a sabotage-servicemessage. This did show up instantly on the CCU, and on HA it took a couple minutes (the messages are polled every 5 minutes). I also detached a second one to see how it behaves with multiple messages. In every case the correct number of messages was displayed.

Does the value change back to the correct value if you restart HA? Additionally you could manually execute the following in a Python3 shell to do what HA is doing to get the number of service messages:

from xmlrpc.client import ServerProxy
p = ServerProxy("http://192.168.1.123:2001")
len(p.getServiceMessages)

Of course replace the IP in the example with the IP of your CCU.

nicx commented 6 years ago

@danielperna84 after a restart of AH it shows the correct value.

In the meantime I switched from my CCU2 to Homegear. With this everything is working as expected ;) One question: Is it possible not only to count the service messages but to get the message text itself?

danielperna84 commented 6 years ago

Is it possible not only to count the service messages but to get the message text itself?

In general this would be possible. Back then we created the implementation we couldn't find a proper way to implement this though. We can't create entities for each message, and the attributes of the hub-entity are already used for the variables (which are much more useful than the content of the service messages). So if you have a suggestion how they could be implemented we are open for that. Persistent notifications could perhaps be a solution. But some service messages automatically disappear, so this would need to be taken care of and programmatically remove such persistent notifications. Another thing: the messages we get are cryptic. I don't have a real example right now, but a device with sabotage detection when the case is opened would have a message something like FOO_SABOTAGE_ERR and the device ID. It gives you a hint at what the error means, but it's not as nice as the full description you get from the CCU.

nicx commented 6 years ago

ok, thanks for clarification! great work btw ;)

balloobbot commented 6 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

balloobbot commented 6 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍