The client sends a “ping” every 25 seconds:
{"event":"ping"}
To initialize the websocket connection, you need to do a POST first to /v1/session as you’ve outlined above, then to auth the websocket connection you use:
wss://api.orbitbhyve.com/v1/events
{"event":"app_connection","orbit_session_token":"...thesecrettoken..."}
Turn everything off:
{"event":"change_mode","device_id":"...blahblahblah...","timestamp":"2019-02-24T14:03:06.803Z","mode":"manual","stations":[]}
Zone/Station 2 for 10 minutes
{“event”:“change_mode”,“device_id”:“5a8b5b084f0c9ba809f1b55b”,“timestamp”:“2019-02-24T14:04:06.803Z”,“mode”:“manual”,“stations”:[{“station”:2,“run_time”:10}]}
It’s pretty responsive, phone app updates real-time (since they’re using websocket connections). I think we can make this work…
The next question… MQTT gateway or integrate as a component? I feel like a docker container that uses MQTT would be a bit better to start with, easier to test and can work with other tools…