core icon indicating copy to clipboard operation
core copied to clipboard

Temperature entity of motion and contact sensors unavailable once value is lower than 1

Open bcutter opened this issue 3 years ago • 15 comments

The problem

Motion sensors (lumi.sensor_motion.aq2 / RTCGQ11LM) are of state unavailable once the temperature of the sensor is reported below 1 degrees. It comes back once the temperature rises.

While the temperature itself is available and shown e. g. in Phoscon, it is not in deCONZ. This is why I assume this is a deCONZ integration error. (otherwise I would have reported this at https://github.com/dresden-elektronik/deconz-rest-plugin/issues)

grafik

grafik

grafik

What version of Home Assistant Core has the issue?

core-2022.9.7

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

deCONZ

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

Two things happened during the last days:

  1. Temperatures went down (assumption: error has always been there)
  2. deCONZ has been updated to v2.19.3 (from v2.19.1) (assumption: error has been introduced with v2.19.3)
  • Probably related to https://github.com/dresden-elektronik/deconz-rest-plugin/issues/6203 (don't think so, just wanted to name one of the last changes affecting specifically those devices)

bcutter avatar Dec 11 '22 21:12 bcutter

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

Code owner commands

Code owners of deconz can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign deconz Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


deconz documentation deconz source (message by IssueLinks)

home-assistant[bot] avatar Dec 11 '22 21:12 home-assistant[bot]

Can you first upgrade to the latest home assistant and if that doesn't help, enable debug logging per the instructions in the integration documentation

Kane610 avatar Dec 12 '22 08:12 Kane610

Can you first upgrade to the latest home assistant and if that doesn't help, enable debug logging per the instructions in the integration documentation

I can, but it will take some time, probably in two weeks. Is there any known change in the newer HA versions related to this?

bcutter avatar Dec 12 '22 09:12 bcutter

Can you first upgrade to the latest home assistant and if that doesn't help, enable debug logging per the instructions in the integration documentation

I can, but it will take some time, probably in two weeks. Is there any known change in the newer HA versions related to this?

There are changes to sensor implementation but they should really be unnoticed. But it's expected to report issues on what version is currently offered. You're the only one reporting such an issue right now so it's probably not the integration. But the logs can help with that.

Kane610 avatar Dec 12 '22 11:12 Kane610

Excactly same behavior for contact sensors too (interestingly it is not unavailable but unknown when/once below 1 °):

grafik

MCCGQ11LM (lumi.sensor_magnet.aq2)

Renamed issue accordingly.

bcutter avatar Dec 17 '22 21:12 bcutter

I wrote up a test to validate it working with negative temperatures, which it does. Without logs I can't proceed here.

async def test_negative_temperature_values(hass, aioclient_mock):
    """Test sensor with negative temperature."""
    data = {
        "sensors": {
            "1": {
                "config": {
                    "battery": None,
                    "offset": 0,
                    "on": True,
                    "reachable": True,
                },
                "ep": 1,
                "etag": "1220e5d026493b6e86207993703a8a71",
                "manufacturername": "LUMI",
                "modelid": "lumi.weather",
                "name": "Mi temperature 1",
                "state": {
                    "lastupdated": "2019-05-05T14:39:00",
                    "temperature": -2182,
                },
                "swversion": "20161129",
                "type": "ZHATemperature",
                "uniqueid": "00:15:8d:00:02:45:dc:53-01-0402",
            }
        }
    }
    with patch.dict(DECONZ_WEB_REQUEST, data):
        await setup_deconz_integration(hass, aioclient_mock)

    assert hass.states.get("sensor.mi_temperature_1").state == "-21.8"

Kane610 avatar Dec 31 '22 09:12 Kane610

Currently I don't see this, as temperatures are high for quite some time.

When they go down again in the next weeks: what kind of logs exactly are needed?

bcutter avatar Dec 31 '22 11:12 bcutter

Debug logging for the deconz integration, instructions are in the integration documentation.

Kane610 avatar Dec 31 '22 12:12 Kane610

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.

Temperatures still not low enough to see this behavior again and provide logs.

bcutter avatar Jan 14 '23 13:01 bcutter

"Finally" it got cold enough to see this issue again. Will provide logs asap.

image

image

bcutter avatar Jan 19 '23 23:01 bcutter

Yesterday I saw this plenty of times as temperatures went down and up:

22.01 07:52 unavailable ❌ 22.01 08:43 available again ✔ 22.01 09:38 unavailable ❌ 22.01 10:32 available again ✔ 22.01 20:31 unavailable ❌ 22.01 21:24 available again ✔

Interestingly, the graph falsified my theory it is because of a temperature limitation ("value lower than 1"):

grafik

For now I decided to simply ignore the state of this entity. While I think the issue is clearly based on temperature, I'm still wondering why the state in deCONZ/Phoscon is just fine but HA integration renders unavailable.

Questions regarding debugging:

  1. As https://www.home-assistant.io/integrations/deconz#debugging-integration needs a restart of HA which I want to avoid currently, is using the UI for debugging also an option? Taking bout this one: grafik

  2. As I used that for only 5 seconds and got a LOG file of 33 MByte, taking into account I don't know when the issue happens and I therefore would need to keep debug mode enabled constantly until it happens again, I fear producing a MASSIVELY HUGE log file - which on the other hand one needs to parse. Is this really the most efficient way to go?

bcutter avatar Jan 22 '23 23:01 bcutter

There is a service to set debug logging I think, haven't used it myself

Kane610 avatar Jan 23 '23 07:01 Kane610

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.

Debug logging is working - but extremely exhaustive and as this issue occurs only every few days or even weeks (and the debug log for deCONZ just explodes after few hours), it's just impossible to catch logs on a real-world environment. Putting the sensors manually at a cold environment maybe would help to provoke the issue.

bcutter avatar Feb 06 '23 10:02 bcutter

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.

Due to lack of flexibility in terms of debug logging as described above, logs can't be expected to be provided for this issue as of now.

bcutter avatar Feb 20 '23 12:02 bcutter

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.

Ok. We can give it a try next winter

Kane610 avatar Mar 18 '23 07:03 Kane610

Only if HA provides a service to start and stop debug logging (for single targets/integrations). Next to this there seems to be nothing which could get this going:

https://community.home-assistant.io/t/add-services-to-start-stop-debug-logging-of-integrations/527021

bcutter avatar Mar 18 '23 10:03 bcutter

Oops. Just wanted to reply that there is a service to change debug logging for an integration without reloading.

Kane610 avatar Mar 22 '23 17:03 Kane610

Oops. Just wanted to reply that there is a service to change debug logging for an integration without reloading.

Which one? Where's more information on that service?

bcutter avatar Mar 22 '23 17:03 bcutter

Oops. Just wanted to reply that there is a service to change debug logging for an integration without reloading.

Which one? Where's more information on that service?

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

Kane610 avatar Mar 22 '23 18:03 Kane610

Perfect. That will solve the log leak for at least one important other issue I'm taking care of - and maybe even this one here in the next winter time.

➡ https://www.home-assistant.io/integrations/logger/#service-set_level

bcutter avatar Mar 22 '23 19:03 bcutter