Hello, I’m relative new to Home-Assistent. I created a complex Domoticz installation and configuration, but I am aware that Home assistant is more future proof.
Home assistant is running in a docker container. That is why it seems impossible, or very complex to activate a script on the host. I have a script on the host that plays a sound on a bluetooth speaker.
Is it possible to execute a script on the host from docker home-assistant, or is it possible to create a kind of Button, or entity to switch Domoticz with this url?
The fact that HA is running in a docker does not matter.
You just want a rest command: RESTful Command - Home Assistant
This can be called from a script or automation in HA or from a switch: RESTful Switch - Home Assistant
The possibilities are endless
Is it possible to trigger a bash script on the host then? Or do you mean I could switch Domoticz via http request?
And how would I do that?
I created a helper/Boolean switch. Is it possible to attach this http url?
What u posted is just a simple http call which can be called by either methods i posted.
Go read them as you do not need a helper.
The switch example: RESTful Switch - Home Assistant already creates a switch entity in HA you can just put on your dashboard.
Taking your http call for example:
switch:
- platform: rest
resource: http://192.168.188.115:8080/json.htm?type=command¶m=switchlight&idx=6&switchcmd=On
friendly_name: Play Sound on BT Speaker
name: play-sound-bt-speaker
The Friendly_name: line gives a configuration error.
If I add this rest in Configuration.yaml, an entity is creates with this name. But it triggers the url constantly.
So lots of sounds trough the speaker
How could I prevent that?
Thank you! I will try that later.
According to Domoticz docs, the url looks like: /json.htm?type=command¶m=switchlight&idx=8&switchcmd=<On|Off|Toggle|Stop
I will try that first.
No luck with the Rest and resource method nor with the Command-line switch. It is possible to switch Domoticz-switch, but it does not stop.
I thought it would be easier if I switch from docker to core. Then I could give homeassistant user permission to play this sound bash script.
But even that I did not find out how to create an entity in Hass that triggers this bash-script on the host.
Could someone help me with an example?
I tried command-line integration and services from dev. I’m puzzled.
Please some advise. It’s a hard way from another Home automation system.