Hi all, what do I need to setup in Home Assistant so I can send an http command to turn on/off a switch or light?
I’m running both Control4 and Home assistant and I need to control devices in HA from Control4. Control4 Support for HTTP GET and HTTP Post.
Thank you for your reply, will this allow me to send a simple HTTP line? Most of the solutions I found requires curl.
curl
is a just a command line tool that lets you construct a request and send it. You can use whatever you want as long as it allows for adding the authorization token as shown. To control HA, the REST API requires a token.
You can also create a webhook trigger and POST to it without authorization: Automation Trigger - Home Assistant. Then you can do whatever you want in the automation, and even base it on JSON payload that you pass in (or not).
Thank you all for your help, I managed to do it via Webhook.
I created an automation for every action:
alias: Webhook OFF
description: ''
trigger:
- platform: webhook
webhook_id: basement_entrance_off
condition: []
action:
- service: switch.turn_off
target:
entity_id: switch.zswitchbasementent_left
mode: single
From Control4 I issue an HTTP Post with:
http://homeassistant:8123/api/webhook/basement_entrance_off