Please correct me if I am wrong but this is making a call from Hubitat to a remote device/service. I need the reverse. I need my Hubitat device driver to receive an HTTP post from RoomMe.
I was looking at the Hubitat dev docs and was surprised to see websockets and associated events but not rest. A simple hubitat http event would do the trick.
I looked at Maker but all I found was statefull connections. Didnāt see a way to just listen for http posts. Maybe I missed it. I am surprised as what I am looking for is so simple makes me think Iāve missed it in my searches.
The traditional method for integrating a HTTP type of device like this is to write an OAuth2 Application. These apps expose an HTTP endpoint which can easily be used to integrate both LAN and CLOUD connections, and are secure.
If the device is LAN connected, there is another fairly simple option to have a Device Driver receive unsolicited HTTP posts which avoids the OAuth2 complexities.
It is strictly local with no oauth support (at this point with V1). The unsolicited posts device driver sounds perfect. Could you please point me to an example? Thanks for your help.
Very interesting. Please forgive me if I am wrong but from what you said ad looking at the code I surmised that Hubitat is listening on 39501 and routes http calls to a device with the ID of the http sender IP. When a match is found it calls the parse method on the device.
Is this correct? If so could I ask where you found this documented? Iāve searched poorly it seems.
Would be great if they added http as a first class citizen like the other protocols so a device driver could simply implement http_post(json) and go from there.
2 more examples of drivers with MAC addresses or IP:PORT in the device network ID so they can receive messages from LAN devices.
I believe I have helper methods in one of both of those take set the DNI as well from an IP/PORT combo in decimal (since it needs to be in caps hex I think).
I'm guessing you want to write an app that can receive http calls. Here's an example you can use. It may not work as I stripped out a lot of code but the key points is looking at the mappings section as that routes it to the handler. You also need to enable oauth when you add the app.
It should give a you a good idea as to how you can receive a call and action on it.
In the Live Logs, if there is not a corresponding device with a matching deviceNetworkId (DNI), Hubitat will log a message in the Live Logs. I don't think it includes the payload, though.
What are you using as your DNI? It needs to be HEX encoded. It does NOT need the sending port as a suffix, just the IP Address. Look in my Parent Driver and you'll see the code that sets the DNI based on the entered IP address of the sending device.
Here's the helper function to convert a string IP address to HEX
Thanks. I put a sniffer on it and determined RoomMe is not respecting the destination port setting and defaulting to 80 instead. I assume there is no way to get traffic on 80?
You'd have to create an OAuth2 enabled Hubitat App, instead of a driver. This would require the RoomMe folks to allow you to fully configure the URL that is being called, so you could include the OAuth2 key.
Turns out it was a bug in the RoomMe app and I got past that with their help so Iāve got a proof working. Now on to building out the real RoomMe support.