12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- light:
- - platform: rflink
- devices:
- newkaku_013242b6_2:
- name: Piano-lamp
- type: switchable
- newkaku_013242b5_2:
- name: Piano-lamp REPEATER
- type: switchable
- sensor:
- - platform: sql
- db_url: mysql://hassio:hassiopassword@192.168.1.110/RemoteRxLog
- queries:
- - name: Piano-lamp repeater status
- query: "SELECT IF(onOff>0,'on','off') AS status FROM RemoteRxLog.nexaLog where rxTx='R' and remote_id = '20071094' and button='2' order by ts desc LIMIT 1;"
- column: 'status'
- input_boolean:
- piano_light_wanted_state:
- name: Piano-lamp, wanted state
- initial: off
- icon: mdi:lightbulb
- automation:
- - alias: Piano-lamp control automation
- trigger:
- platform: template
- value_template: >
- {% if state_attr('sensor.piano_lamp_repeater_status', 'status') == states('input_boolean.piano_light_wanted_state') %}
- false
- {% else %}
- true
- {% endif %}
- action:
- - service: >
- {% if states('input_boolean.piano_light_wanted_state') == "on" %}
- light.turn_on
- {% else %}
- light.turn_off
- {% endif %}
- entity_id: light.piano_lamp_repeater
- timer:
- piano_lamp_control_timer:
- duration: '00:00:30'
|