I have a particle.io based Photon that I’ve used for months with openHab to control open/close and monitor the state of the door. Yesterday I decided to monitor the state of the door in HA by configuring a binary sensor:
binary_sensor:
platform: rest
resource: https://api.particle.io/v1/devices/[deviceID]/state?access_token=[token]
method: GET
name: 'Garage Door'
sensor_class: opening
value_template: '{{ value_json.result }}'
and it works, the UI shows an icon change whenever the garage door opens/closes.
The output of the GET looks like this:
{
"cmd": "VarReturn",
"name": "state",
"result": 1,
"coreInfo": {
"last_app": "",
"last_heard": "2016-08-23T23:38:19.644Z",
"connected": true,
"last_handshake_at": "2016-08-23T04:17:56.382Z",
"deviceID": "[deviceID]",
"product_id": 6
}
Problem: I found that the query happens frequently (every 30 seconds or so) and it seems to be triggering the door to open! When I revoke the access token or disable the sensor in HA the bad behavior stops after a while… it’s like a queue fills up with requests and keeps executing them until all requests are serviced. The activity only triggers an ‘open’ after being closed for 1 minute it opens again.
Any thoughts on this would be greatly appreciated. It might be solvable if I can control the REST polling interval for this particular binary sensor.