Page 1 of 1

Http commands

Posted: Sat Dec 12, 2020 9:01 am
by col
Would it be possible to have a user definable http request field so that when a host goes down or comes back a up a http request can be made to other services. For example I use a Vera Zwave platform which hosts various services and can be triggered by a http request.

So if my AC goes down I could use a http request to open a window. Or if a particular device goes down it could be used to switch lights on or trigger an audible siren.

Many thanks for your consideration.

Re: Http commands

Posted: Sat Dec 12, 2020 9:28 am
by Marshman
This sounds like NEMS Warning Light. https://docs.nemslinux.com/en/latest/ne ... ht=Warning

Re: Http commands

Posted: Sat Dec 12, 2020 10:14 am
by col
Thanks for the link. I'll have an explore.

Re: Http commands

Posted: Sat Dec 12, 2020 10:20 am
by col
I can't see on that link how I would get NEMS to post an http request on a host going down or comming back up. Perhaps I have read it wrong but warning light seems to control GPIO?

Re: Http commands

Posted: Sat Dec 12, 2020 11:58 am
by col
Here what a typical http command looks like for Vera Zwave

http://Vera IP Address:Port/data_request?id=lu_action&output_format=json&DeviceNum=0&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0

But there are many variations depending on which device your controlling or if it's a physical or virtual switch etc. I'm sure that doesn't matter as the http request should be user definable to take account the specific scenario.

Re: Http commands

Posted: Sun Dec 13, 2020 10:50 am
by col
Here's a page that discusses the http commands for Vera Zwave

https://www.smarthome.com.au/smarthome- ... -commands/

Many thanks again Robbie 👍

Re: Http commands

Posted: Sun Dec 13, 2020 1:05 pm
by col
It was suggested that check_http could work. I have looked a this and it doesn't give the option to create the URL myself and to assign a URL to a Down or Up event, so unless I'm mistaken it would be a customer new feature.

Re: Http commands

Posted: Mon Dec 14, 2020 5:00 pm
by Robbie Ferguson
Sounds like this could be a job for the NEMS API. Do you know how to code stuff?

Are the triggers host-specific? I.E., is it "If host 1 goes down, do this. If host 2 goes down, do that." Or is it more "If anything is down, do this"?

If it's anything, Marshman is right that Warning Light might be the best (easiest) way. I'd just write a daemon to poll port 9595 for the pin state and trigger whatever event you want. Check out NEMS GPIO Extender and the GPIO Extender Receiver. You don't actually need a receiver; but you could use the extender daemon to activate your custom code on your smart home device by polling it and acting accordingly.

Either way, if you'd like a hand, this looks to me like it would require a good amount of custom programming, so the option from me is 1) make sure you are setup as a Patron (to support the project) and 2) it would be best to send me a test device, or setup with me a way to access your device(s) for development testing.

This is all perfectly doable.

PS - If you're a coder, I'm happy to just point you in the right direction.

Let us know :)

Robbie // The Bald Nerd