HA Control of myServer

More
7 months 4 weeks ago #4640 by bowlingbeeg
Replied by bowlingbeeg on topic HA Control of myServer
You should be able to put something like this into your configuration.yaml(make sure to restart HA after you put this in so it's available to select in the gui)
Code:
shell_command:   smart_remote: curl http://192.168.20.70/api/docommand?command={{ command }}

Then you could create a script that takes an input field(the command you want to run) and calls the shell_command.smart_remote action.  In the script you'll have to edit the action in yaml to pass the field to the shell_command.  Picture below of the script.



After that you should be able to call the script and enter the command you want in the field.  That shouldn't require anymore yaml.

Please Log in to join the conversation.

More
7 months 4 weeks ago - 7 months 4 weeks ago #4641 by bitzerjd
Replied by bitzerjd on topic HA Control of myServer
I didn't have the "Curl" in front of the http...... That's why HA didn't see it.

Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

One step forward...one back

shell_command:
  chairlampon: curl http://192.168.2.89/api/docommand?command=SetVariable|chairlamp~on
  chairlampoff: curl http://192.168.2.89/api/docommand?command=SetVariable|chairlamp~off

I can call the chairlampon/off... but I get this in the HA log...I think the issue is with the | command, HA doesn't know how to process it properly.  Looking in the docs it will also not know about ~.
Code:
2025-12-07 16:17:42.935 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `http://192.168.2.89/api/docommand?command=SetVariable|chairlamp~off`, return code: 127
Code:
Any ideas?
 
Last edit: 7 months 4 weeks ago by bitzerjd.

Please Log in to join the conversation.

More
7 months 4 weeks ago #4642 by aa6vh
Replied by aa6vh on topic HA Control of myServer
bowlingbeeg, Your solution is almost identical to mine (by setting your request parameters into variables then making the HTTP request), except using CURL instead of a RESTFUL request. I am not all that familiar with HA, so I was wondering which is the better way to make HTTP requests in Home Assistant, and why?

Please Log in to join the conversation.

More
7 months 4 weeks ago #4644 by David Li
Replied by David Li on topic HA Control of myServer
Not following this thread real close...are you all using the HAGateway driver for HomeAssistant integration?
If not, why?

Please Log in to join the conversation.

More
7 months 4 weeks ago #4645 by bitzerjd
Replied by bitzerjd on topic HA Control of myServer
Absolutely using the HAGateway (love it!).... what I need is the same functionality in the opposite direction (expose myServer elements in HA).

Please Log in to join the conversation.

More
7 months 4 weeks ago #4647 by aa6vh
Replied by aa6vh on topic HA Control of myServer
David,

I have not used the HADriver on Allonis yet because I still have not developed HA enough yet to need remote control of HA. But that will come.

I am however a big fan of using HTTP Get requests (or Put when needed) to communicate between different devices. I have a lot of devices (Allonis, Homeseer, Home Assistant, the Android Tasker program, just for example). By using an HTTP Get request to remote communicate with a device, it is easy to copy that logic to a different device and easily get it working as well. That is why the first thing I did with my new HA system was figure out how to perform a dynamic HTTP Get request.

With the help from this forum, I was able to get Allonis to receive HTTP Get commands and do what is specified (using the API DoCommand). Since Allonis controls the volume of my TV, I use Allonis to control the TV Mute. But I wanted to mute the TV by commanding Alexa, or automatically mute when on the Phone. I do this by the sole use of HTTP Get requests to Allonis. That mute command can be sent from Homeseer, or Tasker, (or even HA when I decide to make it work). I also wanted to control the lights in the TV room using Allonis, but not for the entire house. Allonis will send the appropriate HTTP Get requests to Homeseer to effect those lights.

Now if I can just figure out if there is a better way to send HTTP Get requests from HA. My research using AI and reading the HA support forums indicated that using the RESTFULL method was the way to do it (and it works). But now I am wondering if this CURL method is the better way (or not).

Please Log in to join the conversation.

Time to create page: 0.267 seconds