I am still getting periodic issues with supervisor removing and then failing to add back in the BT dongle. The only solution is to physically remove and reinsert. Otherwise, the integration works impeccably.
I do need to monitor this and see when it has failed - most of the heating decisions in the house are made on the basis of these sensors.
I first created a binary sensor using this template.
{{ states.sensor
| selectattr('attributes.unit_of_measurement', '==', '°C')
| selectattr('attributes.sensor type', '==', 'LYWSDCGQ')
| selectattr('attributes.last median of', '<', 5)
| list | count > 0}}
This worked for a while but I hit an incident where the BLE sensors were not being updated so this template still showed a value for last_median_of
.
I have now created a Node-Red check for either one of the BLE sensors not being updated or the numbers of readings dropping below 5.
[{"id":"715fca80.becbc4","type":"ha-get-entities","z":"8ec6d5b3.077b58","server":"9bb65ffe.1998d","name":"","rules":[{"property":"attributes.sensor type","logic":"is","value":"LYWSDCGQ","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"data","output_results_count":1,"x":370,"y":480,"wires":[["61e3beda.49f06"]]},{"id":"61e3beda.49f06","type":"function","z":"8ec6d5b3.077b58","name":"Check for stale","func":"msg.payload = msg.data.filter(function(data){\n return (data.attributes.device_class == \"temperature\") && ((data.attributes.last_median_of < 5) || (Date.parse(data.last_updated) + 300000) < Date.now());\n}).length > 0;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":588,"y":480,"wires":[["63d3fe43.e747e"]]},{"id":"9bb65ffe.1998d","type":"server","name":"HassIO","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
The function code is quite elegant;
msg.payload = msg.data.filter(function(data){
return (data.attributes.device_class == "temperature") && ((data.attributes.last_median_of < 5) || (Date.parse(data.last_updated) + 300000) < Date.now());
}).length > 0;
I then send a message to telegram to say there is a problem.
HTH someone else