Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
how_to:lirc:integration_with_home_assistant [2019/03/30 17:09]
franzunix [Use the RESTful API of lirc_web]
how_to:lirc:integration_with_home_assistant [2019/03/30 20:05] (current)
Line 39: Line 39:
 If you wont to send an IR command directly from Home Assistant, that is useful when you are on a remote connection where the lirc_web interface is not accessible, you can use the built in [[https://​github.com/​alexbain/​lirc_web#​using-the-json-api|RESTful API of lirc_web]]. If you wont to send an IR command directly from Home Assistant, that is useful when you are on a remote connection where the lirc_web interface is not accessible, you can use the built in [[https://​github.com/​alexbain/​lirc_web#​using-the-json-api|RESTful API of lirc_web]].
  
 +To do this you have to configure the [[https://​www.home-assistant.io/​components/​rest_command/​|RESTful Command]] component of Home Assistant. For every remote key add an entry in the configuration.yaml (or in a different file with a split configuration) as in the example below:
 +<file yaml /​home/​homeassistant/​.homeassistant/​configuration.yaml>​
 +# Example configuration.yaml entry
 +rest_command:​
 +  lirc_web_YOUR_REMOTE_YOUR_KEY:​
 +    url: '​http://​localhost:​3000/​remotes/​YOUR_REMOTE/​YOUR_KEY'​
 +    method: POST
 +</​file>​
 +Substitute YOUR_REMOTE and YOUR_KEY according to your needs. To see the list of remote and buttons as configured in lirc_web, go to:
 +  * http://​d-diot.local:​3000/​remotes.json
    
 +Now you can create a momentary switch for the remote button with the [[https://​www.home-assistant.io/​components/​switch.template/​|template switch platform]], adding the lines under the oled switch to the switches.yaml file:
 +<file yaml /​home/​homeassistant/​.homeassistant/​switches.yaml> ​
 +# Template switches
 +- platform: template
 +  switches:
 +    oled:
 +      friendly_name:​ "​Status"​
 +      value_template:​ "{{ is_state('​binary_sensor.oled_status',​ '​on'​) }}"
 +      turn_on:
 +        service: shell_command.start_oled
 +        data:
 +          entity_id: binary_sensor.oled_status
 +      turn_off:
 +        service: shell_command.stop_oled
 +        data:
 +          entity_id: binary_sensor.oled_status
 +    lirc_web_YOUR_REMOTE_YOUR_KEY:​
 +      friendly_name:​ "Arrow up"
 +      value_template:​ "​false"​
 +      turn_on:
 +        service: rest_command.lirc_web_YOUR_REMOTE_YOUR_KEY
 +      turn_off:
 +        service: rest_command.lirc_web_YOUR_REMOTE_YOUR_KEY
 +</​file>​
 +Once the switch is created you can add them in the webui as an entity button card for example.
  • how_to/lirc/integration_with_home_assistant.1553965745.txt.gz
  • Last modified: 2019/03/30 17:09
  • by franzunix