trying a cl sensor to circumvent json/rest errors in the logs and system I’ve set it up like below, but to won’t get a state…
what do i need to change to make it a working sensor, please have a look?
- platform: command_line
name: Driveway reachable cl
command: curl X GET http://ip/api/key/lights/12/
value_template: '{{value_json.state.reachable}}'
nevermind, got a value after a reboot…
somehow this sensor won’t customize as i want it to:
sensor.driveway_reachable:
templates:
rgb_color: "if (state === 'True') return [192, 39, 30]; else return [54, 95, 140];"
icon: "if (state === 'True') return 'mdi:lightbulb-on';
else return 'mdi:lightbulb-on-outline';"
_stateDisplay: if (state === 'True') return 'On'; else return 'Off';
doesnt work as expected, should i format it on another way?
it doesnt take the True (which it is) and returns the False setting.
while:
{{states.sensor.driveway_reachable.state}} gives True, and
{% if is_state('sensor.driveway_reachable', 'True') %} On
{% else %}
Off
{% endif %}
renders On fine.