Hello,
I am using HA to control my home automation which is located on a second “machine”.
I am currently using shell_command to control entities on that machine.
I am on 0.97.2.
I have a problem with the light_template.
The code is below.
When I change the state of the light in HA, it sends always the status_quo of the sensor reading, but not the new values (ON, OFF, or brightness) set by the HA GUI.
I remember it worked before…I am not sure if the update to 0.97.2 (from 0.96.x) might be a reason. Could not find any reports so far.
I hope someone in the forum got an idea what I am doing wrong here.
Thanx in advance.
(I hope the quotes are working as I did it, as there is no preview…)
configuration.yaml
sensor:
- platform: command_line
name: Dimmer Wohnen Wand
command: /usr/bin/curl -X GET 'http://192.168.1.111:80/cgi-bin/hc.php?HC_DIM;LIGHT;RD;Wohnen_Wand'
value_template: '{{ value[94:-10] }}'
# SHELL COMMANDS
shell_command:
licht_wohnen_wand: /usr/bin/curl -X GET 'http://192.168.1.111:80/cgi-bin/hc.php?HC_DIM;LIGHT;WR;Wohnen_Wand;{{((state_attr("light.wohnen_wand_licht", "brightness")|int)/2.55)|round(0)}};3'
lights.yaml
- platform: template
lights:
wohnen_wand_licht:
friendly_name: "Wohnen Wand Licht"
#level_template: "{{(state_attr('light.wohnen_wand_licht', 'brightness')|int)}}"
#value_template: "{{ states('light.wohnen_wand_licht') }}"
level_template: "{{ '%2d' | format(states('sensor.dimmer_wohnen_wand') | int*2.55) }}"
# wandelt 0-100 in 0-255 um was von HA fuer korrekte Anzeige Lichtwerte benoetigt wird
value_template: >-
{% if states('sensor.dimmer_wohnen_wand') | int > 0 %}
on
{% else %}
off
{% endif %}
turn_on:
service: shell_command.licht_wohnen_wand
data:
entity_id: light.wohnen_wand_licht
brightness: "100"
#- service: shell_command.licht_wohnen_wand
turn_off:
service: shell_command.licht_wohnen_wand
data:
entity_id: light.wohnen_wand_licht
brightness: "0"
#- service: shell_command.licht_wohnen_wand
set_level:
service: shell_command.licht_wohnen_wand
data_template:
entity_id: light.wohnen_wand_licht
brightness: "{{ brightness }}"