qba
(Jakub)
February 15, 2019, 10:59am
1
Hello,
I have template light and Modbus TCP service. All works fine but I have some issue. When I set light on value is changed immediatelly in modbus register but state of switch is not changed. This is changed in few seconds related to refresh data comming from sensor.
How can I force sensor to refresh data?
sensor:
platform: modbus
registers:
- name: light1
slave: 1
register: 1
light:
platform: template
lights:
theater_lights:
friendly_name: “dmx light”
level_template: “{{ states.sensor.light1.state|int }}”
value_template: “{{ states.sensor.light1.state|int > 0 }}”
turn_on:
service: modbus.write_register
data_template:
unit: 1
address: 1
value: 66
turn_off:
service: modbus.write_register
data_template:
unit: 1
address: 1
value: 0
set_level:
service: modbus.write_register
data_template:
unit: 1
address: 1
value: “{{ brightness }}”
tom_l
February 15, 2019, 11:03am
2
Please follow the instructions in the blue banner at the top of the page.
qba
(Jakub)
February 15, 2019, 11:04am
3
sensor:
platform: modbus
registers:
- name: light1
slave: 1
register: 1
light:
- platform: template
lights:
theater_lights:
friendly_name: "dmx light"
level_template: "{{ states.sensor.light1.state|int }}"
value_template: "{{ states.sensor.light1.state|int > 0 }}"
turn_on:
service: modbus.write_register
data_template:
unit: 1
address: 1
value: 66
turn_off:
service: modbus.write_register
data_template:
unit: 1
address: 1
value: 0
set_level:
service: modbus.write_register
data_template:
unit: 1
address: 1
value: "{{ brightness }}"
VDRainer
(🍻)
February 15, 2019, 11:13am
4
Not sure if this works, but give homeassistant.update_entity
a try.
tom_l
February 15, 2019, 11:18am
5
This indentation is incorrect:
light:
- platform: template
lights:
theater_lights:
friendly_name: "dmx light"
level_template: "{{ states.sensor.light1.state|int }}"
value_template: "{{ states.sensor.light1.state|int > 0 }}"
…
It should be:
light:
- platform: template
lights:
theater_lights:
friendly_name: "dmx light"
level_template: "{{ states.sensor.light1.state|int }}"
value_template: "{{ states.sensor.light1.state|int > 0 }}"
qba
(Jakub)
February 15, 2019, 11:56am
7
right!
formatting seems to be important for yaml