openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

[deCONZ] Smoke detectors receive "Gone"status #10247

Open darkogorgievski opened 3 years ago

darkogorgievski commented 3 years ago

Expected Behavior

Thing should be online since REST API returns recent "lastseen" change

Current Behavior

I have two Heiman Smoke detectors and they get status "gone" eventhough the REST API has update on the "lastseen" field. The same happens also to one of the 5 Xiaomi Honeywell smoke detectors I have. The result of the API call for the three detectors is (The moment of writing the bug report is 26/02/2021 21:00 CET):

9: {
"config": {
"battery": 100,
"on": true,
"pending": [],
"reachable": true
},
"ep": 1,
"etag": "xxxxxx",
"lastseen": "2021-02-26T19:23Z",
"manufacturername": "Heiman",
"modelid": "SmokeSensor-EM",
"name": "Smoke Sensor Hall Ground Floor",
"state": {
"fire": null,
"lastupdated": "none",
"lowbattery": null,
"tampered": null
},
"swversion": "1.1.1",
"type": "ZHAFire",
"uniqueid": "xxx"
}

22: {
"config": {
"battery": 100,
"on": true,
"pending": [],
"reachable": true
},
"ep": 1,
"etag": "xxxxx",
"lastseen": "2021-02-26T19:11Z",
"manufacturername": "Heiman",
"modelid": "SmokeSensor-EM",
"name": "Smoke Sensor Hall Up",
"state": {
"fire": null,
"lastupdated": "none",
"lowbattery": null,
"tampered": null
},
"swversion": "1.1.1",
"type": "ZHAFire",
"uniqueid": "xxxx"
},

12: {
"config": {
"battery": 100,
"on": true,
"pending": [],
"reachable": true,
"temperature": 2300
},
"ep": 1,
"etag": "xxxxx",
"lastseen": "2021-02-26T18:51Z",
"manufacturername": "LUMI",
"modelid": "lumi.sensor_smoke",
"name": "Smoke Sensor Bedroom",
"state": {
"fire": false,
"lastupdated": "2021-01-18T16:43:28.242",
"lowbattery": false,
"tampered": false
},
"swversion": "20161018",
"type": "ZHAFire",
"uniqueid": "xxxxx"
},

Screenshot of things: image

Also eventhough the items are defined in a textual item file, not all items are shown in the UI for the "Gone" sensors:

My item file configuration:


//Smoke detector Bedroom 
Switch                  SmokeDetectorFireDetectedBedroom  "Smoke detected"                      <fire>          (grpSmokeDetectorBedroom)                ["Smoke"]                  { channel="deconz:firesensor:conbeeII:chSmokeDetectorBedroom:fire"} 
Number                  SmokeDetectorBatteryBedroom       "Smoke Detector Battery"              <battery>       (grpSmokeDetectorBedroom)                                           { channel="deconz:firesensor:conbeeII:chSmokeDetectorBedroom:battery_level" }
Switch                  SmokeDetectorBatteryLowBedroom    "Smoke Detector Battery Low"          <lowbattery>    (grpSmokeDetectorBedroom)                                           { channel="deconz:firesensor:conbeeII:chSmokeDetectorBedroom:battery_low" }
Number:Temperature      SmokeDetectorTemperatureBedroom   "Smoke Detector Temperature [%.1f °C]" <temperature>  (grpSmokeDetectorBedroom)                                           { channel="deconz:firesensor:conbeeII:chSmokeDetectorBedroom:temperature"  }
Switch                  SmokeDetectorTamperBedroom        "Smoke Detector tamper"                               (grpSmokeDetectorBedroom)                                           { channel="deconz:firesensor:conbeeII:chSmokeDetectorBedroom:tampered"} 
DateTime                SmokeDetectorLastUpdateBedroom    "[%1$tH:%1$tM %1$td-%1$tm-%1$tY]"     <clock-on>      (grpSmokeDetectorBedroom)                                           { channel="deconz:firesensor:conbeeII:chSmokeDetectorBedroom:last_updated" }
DateTime                SmokeDetectorLastSeenBedroom      "[%1$tH:%1$tM %1$td-%1$tm-%1$tY]"     <clock-on>      (grpSmokeDetectorBedroom)                                           { channel="deconz:firesensor:conbeeII:chSmokeDetectorBedroom:last_seen" }
Switch                  itmSmokeDetectorBedroomHealth     "Smoke Detector Bedroom Health"       <status>        (grpSmokeDetectorBedroom, grpHealth)                                {expire="24h,command=OFF"}

//Smoke detector Hall Ground Floor 
Switch                  SmokeDetectorFireDetectedHallGF  "Smoke detected"                       <fire>          (grpSmokeDetectorHallGF)                ["Smoke"]                   { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallGF:fire"} 
Number                  SmokeDetectorBatteryHallGF       "Smoke Detector Battery"               <battery>       (grpSmokeDetectorHallGF)                                            { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallGF:battery_level" }
Switch                  SmokeDetectorBatteryLowHallGF    "Smoke Detector Battery Low"           <lowbattery>    (grpSmokeDetectorHallGF)                                            { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallGF:battery_low" }
Number:Temperature      SmokeDetectorTemperatureHallGF   "Smoke Detector Temperature [%.1f °C]" <temperature>   (grpSmokeDetectorHallGF)                                            { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallGF:temperature"  }
Switch                  SmokeDetectorTamperHallGF        "Smoke Detector tamper"                                (grpSmokeDetectorHallGF)                                            { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallGF:tampered"} 
DateTime                SmokeDetectorLastUpdateHallGF    "[%1$tH:%1$tM %1$td-%1$tm-%1$tY]"      <clock-on>      (grpSmokeDetectorHallGF)                                            { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallGF:last_updated" }
DateTime                SmokeDetectorLastSeenHallGF      "[%1$tH:%1$tM %1$td-%1$tm-%1$tY]"      <clock-on>      (grpSmokeDetectorHallGF)                                            { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallGF:last_seen" }
Switch                  itmSmokeDetectorHallGFHealth     "Smoke Detector Hall GF Health"        <status>        (grpSmokeDetectorHallGF, grpHealth)                                 {expire="24h,command=OFF"}

//Smoke detector Hall First floor 
Switch                  SmokeDetectorFireDetectedHallFF  "Smoke detected"                      <fire>           (grpSmokeDetectorHallFF)                ["Smoke"]                   { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallFF:fire"} 
Number                  SmokeDetectorBatteryHallFF       "Smoke Detector Battery"              <battery>        (grpSmokeDetectorHallFF)                                            { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallFF:battery_level" }
Switch                  SmokeDetectorBatteryLowHallFF    "Smoke Detector Battery Low"          <lowbattery>     (grpSmokeDetectorHallFF)                                            { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallFF:battery_low" }
Number:Temperature      SmokeDetectorTemperatureHallFF   "Smoke Detector Temperature [%.1f °C]" <temperature>   (grpSmokeDetectorHallFF)                                            { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallFF:temperature"  }
Switch                  SmokeDetectorTamperHallFF        "Smoke Detector tamper"                                (grpSmokeDetectorHallFF)                                            { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallFF:tampered"} 
DateTime                SmokeDetectorLastUpdateHallFF    "[%1$tH:%1$tM %1$td-%1$tm-%1$tY]"      <clock-on>      (grpSmokeDetectorHallFF)                                            { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallFF:last_updated" }
DateTime                SmokeDetectorLastSeenHallFF      "[%1$tH:%1$tM %1$td-%1$tm-%1$tY]"      <clock-on>      (grpSmokeDetectorHallFF)                                            { channel="deconz:firesensor:conbeeII:chSmokeDetectorHallFF:last_seen" }
Switch                  itmSmokeDetectorHallFFHealth     "Smoke Detector HallFF Health"         <status>        (grpSmokeDetectorHallFF, grpHealth)                                 {expire="24h,command=OFF"}

Screenshot of the channels in the gone things:

image

image

Possible Solution

Steps to Reproduce (for Bugs)

Context

I have some safety related rules upon smoke detection, like lights on and shutters open to enable safe escape, but some of my sensors are failing to connect

Your Environment

openHABian 3.0.1 Release = Raspbian GNU/Linux 10 (buster) Kernel = Linux 5.10.11-v7l+ Platform = Raspberry Pi 4 Model B Rev 1.4

J-N-K commented 3 years ago

The only way for a sensor to get to "GONE" is when a message with "reachable": false is received.

If you disable/enable the thing, does it come back online? You could try setting the binding to TRACE logging and see what messages for this sensor are received if you disable/enable.

darkogorgievski commented 3 years ago

Disabling and then enabling changed all 3 sensors to ONLINE. I changed the log to TRACE before that, but I don't know if I see something extra than in my normal log. Here is what i got:

2021-02-26 22:40:16.695 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorBedroom' changed from UNINITIALIZED (DISABLED) to INITIALIZING

2021-02-26 22:40:16.700 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorBedroom' changed from INITIALIZING to UNKNOWN

2021-02-26 22:40:16.702 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Sensor_CPUTemp' changed from 33.1 to 32.1

==> /var/log/openhab/openhab.log <==

2021-02-26 22:40:16.756 [INFO ] [org.openhab.core.model.script.FILE  ] - health:Smoke Detector Bedroom set healthy ON|Smoke Detector Bedroom is ONLINE

2021-02-26 22:40:16.768 [INFO ] [org.openhab.core.model.script.FILE  ] - health:Smoke Detector Bedroom set healthy ON|Smoke Detector Bedroom is ONLINE

==> /var/log/openhab/events.log <==

2021-02-26 22:40:16.796 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorBedroom' changed from UNKNOWN to ONLINE

2021-02-26 22:40:16.800 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'itmSmokeDetectorBedroomHealth' received command ON

2021-02-26 22:40:16.803 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SmokeDetectorLastSeenBedroom' changed from 2021-02-07T22:51:00.000+0100 to 2021-02-26T21:40:00.000+0000

2021-02-26 22:40:16.809 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'itmSmokeDetectorBedroomHealth' received command ON

2021-02-26 22:40:16.819 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'itmSmokeDetectorBedroomHealth' changed from OFF to ON

2021-02-26 22:40:35.628 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorHallFF' changed from OFFLINE (GONE): Not reachable to UNINITIALIZED

2021-02-26 22:40:35.650 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorHallFF' changed from UNINITIALIZED to UNINITIALIZED (DISABLED)

2021-02-26 22:40:37.102 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorHallFF' changed from UNINITIALIZED (DISABLED) to INITIALIZING

2021-02-26 22:40:37.117 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorHallFF' changed from INITIALIZING to UNKNOWN

2021-02-26 22:40:37.190 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SmokeDetectorLastSeenHallFF' changed from 2021-02-07T23:08:00.000+0100 to 2021-02-26T21:26:00.000+0000

2021-02-26 22:40:37.211 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorHallFF' changed from UNKNOWN to ONLINE
J-N-K commented 3 years ago

The interesting message is the last one before it goes to GONE.

darkogorgievski commented 3 years ago

OK, I will follow up and post it when it happens (it happened 2-3 times already). It might take several days

darkogorgievski commented 3 years ago

I didn't follow this thing properly, so I saw the sensors "GONE" and then I restarted the rPi. Here is the log:

2021-05-21 09:09:54.131 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorHallGF' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2021-05-21 09:09:54.133 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorHallGF' changed from INITIALIZING to UNKNOWN
2021-05-21 09:09:54.134 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorHallGF' changed from UNKNOWN to OFFLINE (GONE): Not reachable

Similar for the other 2 sensors that receive status gone The REST API returns this

9: {
"config": {
"battery": 100,
"enrolled": 0,
"on": true,
"pending": [],
"reachable": true
},
"ep": 1,
"etag": "6ae2457a69504e434978e204c13db485",
"lastseen": "2021-05-21T07:20Z",
"manufacturername": "Heiman",
"modelid": "SmokeSensor-EM",
"name": "Smoke Sensor Hall Ground Floor",
"state": {
"fire": null,
"lastupdated": "none",
"lowbattery": null,
"tampered": null
},
"swversion": "1.1.1",
"type": "ZHAFire",
"uniqueid": "00:0d:6f:00:14:cd:3a:74-01-0500"
},

If I disable and re-enable the sensor from the UI, it comes back to online

2021-05-21 09:50:53.828 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorHallGF' changed from OFFLINE (GONE): Not reachable to UNINITIALIZED

2021-05-21 09:50:53.844 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorHallGF' changed from UNINITIALIZED to UNINITIALIZED (DISABLED)

2021-05-21 09:50:57.573 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorHallGF' changed from UNINITIALIZED (DISABLED) to INITIALIZING

2021-05-21 09:50:57.582 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorHallGF' changed from INITIALIZING to UNKNOWN

2021-05-21 09:50:57.611 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'deconz:firesensor:conbeeII:chSmokeDetectorHallGF' changed from UNKNOWN to ONLINE
openhab-bot commented 2 years ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/deconz-binding-strange-behaviour/113979/3

jlaur commented 2 years ago

Unreachable should result in status OFFLINE, not GONE - according to documentation: https://www.openhab.org/docs/concepts/things.html#status-details

I don't know if this bug could indicate to the framework that it doesn't need to care about the thing anymore, in which case it would never come back online again? Alternatively we have two separate issues. I'm experiencing the same problem with a socket outlet I'm currently testing with a new deCONZ installation. The device will be marked as GONE after being disconnected from its power source, and when it becomes reachable again, this it not detected by the binding.

deCONZ

Thing: image

Overview: image

Philips Hue

Thing: image

Overview: image

J-N-K commented 2 years ago

The binding can only detect it's connected again when it either sends a state update (one that is reported via websocket) or if the state is actively requested (e.g. on initialization when you disable/enable the thing). The framework doesn't care about GONE.

lsiepel commented 8 months ago

This is an older issue, is there anything left to fix or document?

J-N-K commented 8 months ago

The problem is still the same: deconz does not report a change from reachable=false to reachable=true over the web socket. It only reports state changes (in case of the smoke detector fire/no fire). So the thing status will change only when the first state change happens.