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.89k stars 29.56k forks source link

Sensor entity in homekit bridge device is not tracking changes in the value #100331

Open duro opened 11 months ago

duro commented 11 months ago

The problem

I am using the HomeKit bridge integration in order to control my Mysa Thermostat device. When I load the device in sucessfully, it creates 5 entities. The main ones in question for this issues are the climate entity and a sensor entity which captures the current temperature. I have noticed that the sensor entity frequently stops updating. Sometimes after a restart it will start tracking again, but then after some time it just stops reporting new values. That said, the climate entity has it's own attribute called current_temperature which does appear to continue to update appropriately.

For example, right now the climate entity current_temperature attribute is reading 76, but the sensor for current temperature is stuck at 80, and has not updated in over 2 hours. The attribute for current _temperature in the climate entity has updated in the last 2 minutes.

What version of Home Assistant Core has the issue?

2023.9.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

HomeKit Bridge

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homekit/

Diagnostics information

HomeKit Bridge Diagnostics:

config_entry-homekit-3e0585aacebcfd2df641980fa2fd2874.json (1).txt

HomeKit Device (Mysa Thermostat) Diagnostics:

homekit_controller-61e9b74217146467a1595c5e8274accb-Mysa-59be2c-c9fa6c66277a13dd9bec2c5f8bf85c5b.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 11 months ago

Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration (homekit) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `homekit` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign homekit` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


homekit documentation homekit source (message by IssueLinks)

duro commented 11 months ago

This might also be more of a HomeKit Controller issue, so I am tagging @Jc2k as well.

Jc2k commented 11 months ago

Normally this is either the device itself being slow to update (a popular line of humidity sensors updates faster through their cloud then through homekit, go figure). Or it's a connectivity issue. We see that with some garage doors.

Both of these show up easily in debug logs. Have you got debug logs?

The attribute and the standalone temperature sensor and driven by updates to the same underlying characteristic. It's very weird that they would be different. But again, debug logs would be handy.

Are you looking at these in the the home assistant Ui? What makes you think this is a homekit bridge issue? If you haven't, can you look at these in the Ha Ui so we can untag the wrong integration and tag the right integration.

duro commented 11 months ago

I don't seem to be having any issues with actualyl finding and adding HomeKit devices, so it's likely not a Bridge issue, and more of a controller issue. Feel free to update the tags.

duro commented 11 months ago

I just enabled debug logging, so I will report back when I get some data from that.

duro commented 11 months ago

Here are some debug logs. Not seeing a whole lot in there that indicate an inability to connect to the device:

2023-09-15 10:30:42.007 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Starting HomeKit device update: 20:E3:92:78:70:A6
2023-09-15 10:30:42.007 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Called async_set_available_state with True for 20:E3:92:78:70:A6
2023-09-15 10:30:42.008 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.30.61: raw request: b'GET /characteristics?id=1.272,1.262,1.1027,1.259,1.261,1.1026,1.260 HTTP/1.1\r\nHost: 192.168.30.61\r\n\r\n'
2023-09-15 10:30:42.165 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.30.61: raw response: bytearray(b'{"characteristics":[{"aid":1,"iid":272,"value":39},{"aid":1,"iid":262,"value":23.5},{"aid":1,"iid":1027,"value":0},{"aid":1,"iid":259,"value":2},{"aid":1,"iid":261,"value":25.1},{"aid":1,"iid":1026,"value":0},{"aid":1,"iid":260,"value":0}]}')
2023-09-15 10:30:42.166 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Called async_set_available_state with True for 20:E3:92:78:70:A6
2023-09-15 10:30:42.169 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Finished HomeKit device update: 20:E3:92:78:70:A6
2023-09-15 10:31:42.008 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Starting HomeKit device update: 20:E3:92:78:70:A6
2023-09-15 10:31:42.008 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Called async_set_available_state with True for 20:E3:92:78:70:A6
2023-09-15 10:31:42.009 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.30.61: raw request: b'GET /characteristics?id=1.272,1.262,1.1027,1.259,1.261,1.1026,1.260 HTTP/1.1\r\nHost: 192.168.30.61\r\n\r\n'
2023-09-15 10:31:42.178 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.30.61: raw response: bytearray(b'{"characteristics":[{"aid":1,"iid":272,"value":39},{"aid":1,"iid":262,"value":23.5},{"aid":1,"iid":1027,"value":0},{"aid":1,"iid":259,"value":2},{"aid":1,"iid":261,"value":25.1},{"aid":1,"iid":1026,"value":0},{"aid":1,"iid":260,"value":0}]}')
2023-09-15 10:31:42.179 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Called async_set_available_state with True for 20:E3:92:78:70:A6
2023-09-15 10:31:42.181 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Finished HomeKit device update: 20:E3:92:78:70:A6
2023-09-15 10:31:50.288 DEBUG (MainThread) [aiohomekit.controller.abstract] callback ev:{(1, 261): {'value': 25.200006}}
2023-09-15 10:31:50.289 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Called async_set_available_state with True for 20:E3:92:78:70:A6
2023-09-15 10:32:15.937 DEBUG (MainThread) [homeassistant.components.homekit_controller.config_flow] Discovered device LEVDS-Switch-102D (D215S - 8C:CF:BE:CC:55:3D)
2023-09-15 10:32:42.008 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Starting HomeKit device update: 20:E3:92:78:70:A6
2023-09-15 10:32:42.009 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Called async_set_available_state with True for 20:E3:92:78:70:A6
2023-09-15 10:32:42.009 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.30.61: raw request: b'GET /characteristics?id=1.272,1.262,1.1027,1.259,1.261,1.1026,1.260 HTTP/1.1\r\nHost: 192.168.30.61\r\n\r\n'
2023-09-15 10:32:42.174 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.30.61: raw response: bytearray(b'{"characteristics":[{"aid":1,"iid":272,"value":39},{"aid":1,"iid":262,"value":23.5},{"aid":1,"iid":1027,"value":0},{"aid":1,"iid":259,"value":2},{"aid":1,"iid":261,"value":25.200006},{"aid":1,"iid":1026,"value":0},{"aid":1,"iid":260,"value":0}]}')
2023-09-15 10:32:42.175 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Called async_set_available_state with True for 20:E3:92:78:70:A6
2023-09-15 10:32:42.178 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Finished HomeKit device update: 20:E3:92:78:70:A6
2023-09-15 10:33:42.010 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Starting HomeKit device update: 20:E3:92:78:70:A6
2023-09-15 10:33:42.011 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Called async_set_available_state with True for 20:E3:92:78:70:A6
2023-09-15 10:33:42.011 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.30.61: raw request: b'GET /characteristics?id=1.272,1.262,1.1027,1.259,1.261,1.1026,1.260 HTTP/1.1\r\nHost: 192.168.30.61\r\n\r\n'
2023-09-15 10:33:42.098 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.30.61: raw response: bytearray(b'{"characteristics":[{"aid":1,"iid":272,"value":39},{"aid":1,"iid":262,"value":23.5},{"aid":1,"iid":1027,"value":0},{"aid":1,"iid":259,"value":2},{"aid":1,"iid":261,"value":25.200006},{"aid":1,"iid":1026,"value":0},{"aid":1,"iid":260,"value":0}]}')
2023-09-15 10:33:42.098 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Called async_set_available_state with True for 20:E3:92:78:70:A6
2023-09-15 10:33:42.101 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Finished HomeKit device update: 20:E3:92:78:70:A6

And here are some screenshots showing the current state of the two entities. As you can see the thermostat is updating fairly regularly, and the sensor hasn't updated in hours, while the values are fairly far apart.

Screen Shot 2023-09-15 at 10 31 35 AM Screen Shot 2023-09-15 at 10 33 11 AM

ping @Jc2k

Jc2k commented 11 months ago

You don't need to ping me on GitHub.

Can you show me a screenshot of the "device" page for this device.

duro commented 11 months ago

Screen Shot 2023-09-18 at 8 34 37 AM

There you go ^

Anachemia51 commented 11 months ago

I have the same problem as you, my sensor is not updating while the entity seems to have the right temperature.

acenuke commented 10 months ago

Exact same problem here. I just noticed it, but it was working fine in August (it's in my second home, so I don't check it as often)

Anachemia51 commented 9 months ago

Hey guys ! I did a few tests, and one of them was to disable any automation using the Mysa, and try to use it with the Mysa app. I realised that the problem does not come from HA or HomeKit. In my case, I don't have any problems when my unit is in "heat mode", only when I am in "cooling" or "automatic" modes. In those two modes, when I set the temperature to 21 degree (for example), the unit turns on in cooling mode, and once it reaches the desire temperature, it does not stop cooling . Have you checked if you have the same problem when using your unit through the Mysa app ? I contacted the compagny but for the moment they did not really help me.

chippings commented 8 months ago

@duro I believe you mean "HomeKit Device" aka homekit_controller and not HomeKit Bridge (which goes the other direction).

I also have seen this issue with three Mysa devices connected via the HomeKit Device integration. This comment is to add observations and draw some conclusions so others that understand the HomeKit code better might have a summary to go on. To restate the problem as I see it:

The clever secondary temperature sensors that @Jc2k added in #52194 stop updating at some point in time, while the same temperature and humidity values (attributes) in the climate entity continue to update correctly.

Here are my observations:

I hope this helps to point to the problem.

jacobrossi commented 8 months ago

Also experiencing this issue for a Mysa In-Floor Heater Thermostat. Both temp and humidity sensors do not update while the temp and humidity values of the climate entity are up to date. Reloading the HomeKit Device Integration entry for the thermostat fixes it (though we'll see if it stops updating again...).

issue-triage-workflows[bot] commented 5 months 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 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

chippings commented 5 months ago

This is still an issue for me.

The clever secondary temperature sensors that @Jc2k added in https://github.com/home-assistant/core/pull/52194 stop updating at some point in time, while the same temperature and humidity values (attributes) in the climate entity continue to update correctly.

I believe the issue is with the "secondary" sensors code.

Tomek985 commented 3 months ago

I just noticed same behavior with one (of four) ecobee thermostats connected via homekit integration.

Same exact problem statements as others mentioned. Climate entity does update temperature and humidity, but sensors don't

EDIT: As found elsewhere, this issue is rather common and containment is to restart HA. I did that and sensors are spitting right value now

jonpetersathan commented 1 month ago

Same issue here, but with Tado thermostats and homekit.

And I noticed something else that is strange: I blocked internet access from the Tado bridge in my firewall to keep everything local. If I disable the firewall rule (= enabling internet access), then the sensors seem to update again.

Restarting also helps for me, but only to update the sensors once.