Http commands

Have a great idea for an upcoming release of NEMS? Post it here.
Post Reply
col
Junior Member
Posts: 24
Joined: Thu Dec 10, 2020 3:44 pm

Http commands

Post 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.
User avatar
Marshman
Member
Posts: 67
Joined: Fri Feb 02, 2018 5:33 pm
Location: New York, USA

Re: Http commands

Post by Marshman »

This sounds like NEMS Warning Light. https://docs.nemslinux.com/en/latest/ne ... ht=Warning
Best regards,

MarshMan  NY, USA
col
Junior Member
Posts: 24
Joined: Thu Dec 10, 2020 3:44 pm

Re: Http commands

Post by col »

Thanks for the link. I'll have an explore.
col
Junior Member
Posts: 24
Joined: Thu Dec 10, 2020 3:44 pm

Re: Http commands

Post 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?
col
Junior Member
Posts: 24
Joined: Thu Dec 10, 2020 3:44 pm

Re: Http commands

Post 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.
col
Junior Member
Posts: 24
Joined: Thu Dec 10, 2020 3:44 pm

Re: Http commands

Post 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 👍
col
Junior Member
Posts: 24
Joined: Thu Dec 10, 2020 3:44 pm

Re: Http commands

Post 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.
User avatar
Robbie Ferguson
Posting Freak
Posts: 835
Joined: Wed Mar 07, 2012 3:23 pm
Location: Ontario, Canada
Contact:

Re: Http commands

Post 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
Post Reply