J2ghz
December 30, 2021, 9:05pm
1
My RESTful binary sensor doesn’t show as on, even though the value is 1
.
I’ve tried many things, and finally I’ve added the same value as sensors to debug the issue.
Config:
rest:
- resource: <hidden>
scan_interval: 1
binary_sensor:
- value_template: "{{ value_json['meas']['O1']['HN'] }}"
device_class: "running"
name: "Boiler: Aktivace regulací přebytku"
- value_template: "{{ value_json['meas']['O1']['HE'] }}"
device_class: "running"
name: "Boiler: Aktivace časovačem"
sensor:
- value_template: "{{ value_json['meas']['O1']['HN'] }}"
name: "Boiler: Aktivace regulací přebytku s"
- value_template: "{{ value_json['meas']['O1']['HE'] }}"
name: "Boiler: Aktivace časovačem s"
But no luck, even developer tools still shows all binary sensors off, even though a sensor shows the value as 1
.
Docs at RESTful binary sensor - Home Assistant say:
The JSON messages can contain different values like 1
, "1"
, TRUE
, true
, on
, or open
.
I’m out of ideas.
tom_l
December 31, 2021, 2:51am
2
Ok so ignoring what the docs say for now, does this work?
rest:
- resource: <hidden>
scan_interval: 1
binary_sensor:
- value_template: "{{ value_json['meas']['O1']['HN'] == 1 }}"
device_class: "running"
name: "Boiler: Aktivace regulací přebytku"
- value_template: "{{ value_json['meas']['O1']['HE'] == 1 }}"
device_class: "running"
name: "Boiler: Aktivace časovačem"
The other thing to do is to slow the scan interval. You may be overloading your resource with requests. Try 10 seconds.
J2ghz
January 1, 2022, 12:12am
3
As you suggested, I tried it with == 1
and scan_interval: 10
:
Config
rest:
- resource: <hidden>
scan_interval: 10
sensor:
- value_template: "{{ value_json['meas']['O1']['HN'] }}"
name: "Boiler: Aktivace regulací přebytku sensor"
- value_template: "{{ value_json['meas']['O1']['HE'] }}"
name: "Boiler: Aktivace časovačem sensor"
- value_template: "{{ value_json['meas']['O1']['HN'] == 1 }}"
name: "Boiler: Aktivace regulací přebytku eq 1"
- value_template: "{{ value_json['meas']['O1']['HE'] == 1 }}"
name: "Boiler: Aktivace časovačem eq 1"
binary_sensor:
- value_template: "{{ value_json['meas']['O1']['HN'] == 1 }}"
device_class: "running"
name: "Boiler: Aktivace regulací přebytku"
- value_template: "{{ value_json['meas']['O1']['HE'] == 1 }}"
device_class: "running"
name: "Boiler: Aktivace časovačem"
The scan_interval
should be ok even at 1, since the Web UI included with the device hits the same endpoints once per second.
Trying the == 1
part doesn’t seem to work:
J2ghz
January 1, 2022, 12:13am
4
(I can’t post two images in one post as new user, so here’s a continuation:)
I tried to change it to == '1'
:
Config
rest:
- resource: <hidden>
scan_interval: 10
sensor:
- value_template: "{{ value_json['meas']['O1']['HN'] }}"
name: "Boiler: Aktivace regulací přebytku sensor"
- value_template: "{{ value_json['meas']['O1']['HE'] }}"
name: "Boiler: Aktivace časovačem sensor"
- value_template: "{{ value_json['meas']['O1']['HN'] == '1' }}"
name: "Boiler: Aktivace regulací přebytku eq 1"
- value_template: "{{ value_json['meas']['O1']['HE'] == '1' }}"
name: "Boiler: Aktivace časovačem eq 1"
binary_sensor:
- value_template: "{{ value_json['meas']['O1']['HN'] == '1' }}"
device_class: "running"
name: "Boiler: Aktivace regulací přebytku"
- value_template: "{{ value_json['meas']['O1']['HE'] == '1' }}"
device_class: "running"
name: "Boiler: Aktivace časovačem"
That seems to work for the sensor, but still not for the binary sensor:
tom_l
January 1, 2022, 12:50am
5
That’s pretty damming evidence for an issue with the restful binary_sensor. There were some changes made to the rest platform in v2021.12. I suggest you open a new issue here:
1 Like
J2ghz
March 4, 2022, 1:21pm
7
tom_l
March 4, 2022, 1:27pm
8
You let the issue go stale. You should have received a warning email about that. You get a week to reply in the issue to keep it open if it is still an issue for you.
You may have to open a new issue if no developer opens it again for you.
I don’t think Github sends out e-mails when a new tag is added.
Sometimes I am registering issues on Github in a “frontend” section.
After some period some issue becomes “stale” - and then I receive a letter “the issues is stale” which makes to to re-check the issue and prolong it by adding a comment - so the issue is not closed automatically.
But with my issues in a “core” section the situation is uncontrollable:
after some period I receive a letter “the issue is closed automatically” - and I am not warned that this is going to happen, not emails about “…
tom_l
March 4, 2022, 11:40pm
10
I receive these warnings:
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
J2ghz
March 7, 2022, 12:01am
11
I guess I haven’t received the email because I’m not the author of the issue? I’ll open a new one then.
tom_l
March 7, 2022, 12:12am
12
Everyone subscribed to the issue (including the author) should receive it.