Why do you have “water_volume_gal” instead of “cycle_volume_gal”? Is there more than one API or, is it written differently?
I am not that experienced in SmartApp writing but I do design some good looking DTH’s. Where are the url’s that you use to connect to the API server? That’s always baffled me about SmartApp writing.
BTW, I have a manual timer from webCoRE running right now (without your api, just saw it), and it’s not updating gallons on your dth. Hopefully that changes with the API.
I noticed some weird behavior in the MQTT as well, it will only start counting gallons once I press the center of the ring on the app to show gallons.
I notice you got the code from billchurch. I was using the same code.
What does this mean?
“topic: bhyve/device/5ee3b4ec4f0cde3efe8a33cf/refresh message:
Mon, Jun 15, 2020, 10:34:45 AM - RECEIVED parseMessage topic: ‘bhyve/device/5ee3b4ec4f0cde3efe8a33cf/refresh’ - message: ‘’
Mon, Jun 15, 2020, 10:34:45 AM - refresh
Mon, Jun 15, 2020, 10:34:45 AM - All 1 devices are reporting a ‘CLOSED’ state’
Mon, Jun 15, 2020, 10:34:45 AM - Sending PushOver ‘Mon, Jun 15, 2020, 10:34:45 AM - All 1 devices are reporting a ‘CLOSED’ state’’
Mon, Jun 15, 2020, 10:34:45 AM - All Devices -> POSTING Device Updates to SmartThings API
Mon, Jun 15, 2020, 10:34:45 AM - All Orbit Devices -> Executing Client.prototype.smartthings for event: UPDATEALLDEVICES
Mon, Jun 15, 2020, 10:34:45 AM - Orbit Error: TypeError: Cannot read property ‘1’ of null
Mon, Jun 15, 2020, 10:34:45 AM - Pushover encountered a severe error: Error: Request failed with status code 400
Mon, Jun 15, 2020, 10:34:45 AM - Error: Request failed with status code 400
at createError (/home/tony/bhyve/node_modules/axios/lib/core/createError.js:16:15)
at settle (/home/tony/bhyve/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/home/tony/bhyve/node_modules/axios/lib/adapters/http.js:236:11)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Mon, Jun 15, 2020, 10:34:45 AM - Orbit Error: Error: Request failed with status code 400”
Yes, Bill provided a nice code base for the raw bhyve mqtt websocket connection and he is credited in the program for it… I enhanced his base code significantly and added all the integration to my SmartThings Orbit bhyve Controller and Pushover Messaging for those who wanted that messaging service.
Interesting set of errors, I see that there is an error before the Pushover section:
Mon, Jun 15, 2020, 10:34:45 AM - Orbit Error: TypeError: Cannot read property ‘1’ of null
In the orbit.js, this line below should prevent any calls to the Pushover service if set to false in the .env. I thought it was a boolean but now see that it a STRING, so I have UPDATED the orbit.js file in the github node repo version 0.0.2 to correct that error with single quotes around ‘false’ as below!
if (process.env.PUSHOVER_MESSAGING==‘false’) {return}
I use the bhyve API json variable water_volume_gal to get the approximate usage rate when the watering device is active. This value is all over the board as the watering device cannot measure low flow rates. I’m not sure what is the difference between water_volume_gal and cycle_volume_gal
The bhyve URL’s are in the Orbit Bhyve SmartApp code. Best to start there.
Glad to hear using WebCore, great app. I’m not sure about what you are trying to do here, but if it works for you - Great!
Yep, something is causing the connection to the bhyve websocket server to unexpectedly abort at different timing intervals and I have PM2 restarting it. But this constant restarting is not what I desire in a stable proxy, so I am researching what to do to detect and handle since node.js aborts easily. If you have enhancements to this proxy server, feel free to send them my way for integration into the node.js code stream.
1.) On the json response when the water is running, I don’t even see water_volume_gal, it’s only cycle and I’m using the same MQTT agent, pretty much. Quite odd. They probably have the same value.
2.) I read that SmartApp code more than 5 times last night and didn’t see any evidence of a url.
3.) I have a notification based on your DTH, when gallons return to 0 it will stop ‘setting’ the cycle variable, add the cycle local variable to the sprinklergallons global variable and put it in a spreadsheet and give me a Tasker Notification of the cycle and total month to date.
I live in Phoenix, we take our watering seriously if we want to have a decent looking yard in the summer time.
Thanks for the way to disable pushover, it was not in the .env-sample file that is on git. Or, at least I didn’t see it.
Hopefully I can read over the code a little later this evening and see what I can help with.
We are in Ohio and rain happens sufficiently enough to keep gardens & grass green. There only a few days where sun is harsh and watering is required to prevent burn out. Water is plenty, but we still try to conserve with minimal watering run-times.
The documentation for the .env fields is in the github’s node readme in the node.js server section.
I am guessing that the Websocket has not been implemented into the SmartApp yet because the SmartThings log shows everything about what the Websocket is reporting, but doesn’t reflect that change.
I’m not sure what is happening to your install and bhyve devices, but my 5 Orbit Bhyve Hose devices are reporting each time they open/close (several times per day) and showing flow activity when active. I also have have the node proxy install active and it complements the SmartApp’s polling by sending realtime open/close events to ST before the next poll period…
So with or without the install of the node proxy, the ST Orbit bhyve Controller app should be polling the bhyve servers to get device status at whatever frequency you have chosen in the App.
It could be your devices are a different model than mine?
It could be you are using the Android version of ST, or on the new ST mobile client? I am only supporting ST iOS legacy client at this point as my home systems are humming along perfectly, and I am not ready to chance issues with the new ST mobile client.
Perhaps a complete fresh install from scratch, removing/deleting all devices, DTH’s and SmartApp and installing again. This is a pain, but is recommended by tech support and has worked 50% of the time., Go figure, ST mobile client’s can get in a foo-bar state.
My walkout device just fired off, here is what I get in the ST Classic iOS mobile:
like this:
Outdoor -> SKIPPING Event ‘flow_sensor_state_changed’
I added the case in the app.js code and it started to report to SmartThings.
If you don’t have the hose timer, then that would explain things like “water_volume_gal” and “cycle_volume_gal”… I just did a search and replace on these and it still didn’t fix the gallons used on the tile.
EDIT!! OR Because you have more than 1 zone, it does water_volume_gal
If you do have the same, then, Perhaps there might be version differences of the one published to git.
I have the Orbit bhyve hose timer/hub pair with SmartThings Classic on a Google Pixel 2XL.
No, here is my node proxy log for a quick manual on/off test. Note that gallons are not reported unless one taps the bhyve client circle guage like I did… This is a quirk of the oem bhyve client app…
I also added ‘flow_sensor_state_changed’ to my version of the app.js and Orbit bhyve Controller app case statements which will have the affect of causing the Orbit bhyve SmartApp to run a refresh and update the device DTH.
I do not get these ‘flow_sensor_state_changed’ events in my use so far, so make sure that these ‘flow_sensor_state_changed’ events on the node proxy don’t cause the Orbit bhyve Controller SmartApp to refresh faster than ST allows for Smartapps, or your instance will fail per ST’s stated app run frequency rate policy.
I have the 5 B-hyve Smart Hose Watering Timers and 2 WiFi hubs (Part Number 21004 , 21005). These can only have 1 zone defined in the bhyve oem client.
The iOS and Android ST mobile clients perform and display differently with some custom developed apps, as reported in several of my wide user base and other devlopers. This inconsistency has been a real pain to debug and ST IT engineers do not have an answer for many of the issues I have reported and sent screen shots and logs. To make matters worse, sometimes the Android users even state that they see differences between hardware and OS versions of their family phones, which adds another level of complexity.
Tue, Jun 16, 2020, 5:28:52 PM - Sending PushOver 'Tue, Jun 16, 2020, 5:28:52 PM - MQTT connected at mqtt://localhost:1883'
Tue, Jun 16, 2020, 5:28:52 PM - STOrbitBhyveController™ Webserver is listening on port: 3000
Tue, Jun 16, 2020, 5:28:52 PM - Pushover Message {"status":1,"request":"69ce4b67-7a69-4168-93b3-79c5676d8415"} sent successfully
Tue, Jun 16, 2020, 5:28:52 PM - Post Accepted Status: 200
Tue, Jun 16, 2020, 5:28:53 PM - All 5 devices are reporting a 'CLOSED' state'
Tue, Jun 16, 2020, 5:28:53 PM - Sending PushOver 'Tue, Jun 16, 2020, 5:28:53 PM - All 5 devices are reporting a 'CLOSED' state''
Tue, Jun 16, 2020, 5:28:53 PM - All Devices -> POSTING Device Updates to SmartThings API
Tue, Jun 16, 2020, 5:28:53 PM - All Orbit Devices -> Executing Client.prototype.smartthings for event: UPDATEALLDEVICES
Tue, Jun 16, 2020, 5:28:53 PM - Sending PushOver 'NODEjs Client.prototype.connectStream'
Tue, Jun 16, 2020, 5:28:54 PM - All Orbit Devices -> ST Post Accepted for UPDATEALLDEVICES
Tue, Jun 16, 2020, 5:28:54 PM - Pushover Message {"status":1,"request":"ce9f6c03-f1b7-48de-8309-6fe08df792c4"} sent successfully
Tue, Jun 16, 2020, 5:28:54 PM - Post Accepted Status: 200
Tue, Jun 16, 2020, 5:28:54 PM - Pushover Message {"status":1,"request":"726a41ba-2e99-4c33-b84f-71744f9d0363"} sent successfully
Tue, Jun 16, 2020, 5:28:54 PM - Post Accepted Status: 200
Tue, Jun 16, 2020, 5:29:34 PM - websocket.readyState = (1), sending keep alive ping #4Tue, Jun 16, 2020, 5:29:34 PM Front - Center -> message: {"event":"change_mode","mode":"manual","program":false,"stations":[{"station":1,"run_time":2}],"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","timestamp":"Tue, Jun 16, 2020, 5:29:27 PM"}
Tue, Jun 16, 2020, 5:29:34 PM Front - Center -> SENDING change_mode {"event":"change_mode","mode":"manual","program":null,"stations":[{"station":1,"run_time":2}],"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","timestamp":"2020-06-16T21:29:27.000Z"} to SmartThings
Tue, Jun 16, 2020, 5:29:34 PM - FRONT - CENTER -> Executing Client.prototype.smartthings for event: CHANGE_MODE
Tue, Jun 16, 2020, 5:29:34 PM Front - Center -> message: {"event":"watering_in_progress_notification","program":"manual","current_station":1,"run_time":1,"started_watering_station_at":"Tue, Jun 16, 2020, 5:29:26 PM","rain_sensor_hold":false,"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","timestamp":"Tue, Jun 16, 2020, 5:29:26 PM"}
Tue, Jun 16, 2020, 5:29:35 PM Front - Center -> SENDING watering_in_progress_notification {"event":"watering_in_progress_notification","program":"manual","current_station":1,"run_time":1,"started_watering_station_at":"2020-06-16T21:29:26.000Z","rain_sensor_hold":false,"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","timestamp":"2020-06-16T21:29:26.000Z"} to SmartThings
Tue, Jun 16, 2020, 5:29:35 PM - FRONT - CENTER -> Executing Client.prototype.smartthings for event: WATERING_IN_PROGRESS_NOTIFICATION
Tue, Jun 16, 2020, 5:29:35 PM - FRONT - CENTER -> ST Post Accepted for CHANGE_MODE
Tue, Jun 16, 2020, 5:29:35 PM - FRONT - CENTER -> ST Post Accepted for WATERING_IN_PROGRESS_NOTIFICATION
Tue, Jun 16, 2020, 5:29:44 PM - websocket.readyState = (1), sending keep alive ping #5Tue, Jun 16, 2020, 5:29:51 PM Front - Center -> message: {"flow_rate_gpm":0.38402,"cycle_run_time_sec":18,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","event":"flow_sensor_state_changed","cycle_volume_gal":0.527835,"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"timestamp":"Tue, Jun 16, 2020, 5:29:44 PM","gateway-topic":"devices-1"}
Tue, Jun 16, 2020, 5:29:53 PM Front - Center -> message: {"flow_rate_gpm":2.87321,"cycle_run_time_sec":19,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","event":"flow_sensor_state_changed","cycle_volume_gal":0.57125,"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"timestamp":"Tue, Jun 16, 2020, 5:29:45 PM","gateway-topic":"devices-1"}
Tue, Jun 16, 2020, 5:29:54 PM - websocket.readyState = (1), sending keep alive ping #6Tue, Jun 16, 2020, 5:29:54 PM Front - Center -> message: {"flow_rate_gpm":2.7422,"cycle_run_time_sec":21,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","event":"flow_sensor_state_changed","cycle_volume_gal":0.655795,"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"timestamp":"Tue, Jun 16, 2020, 5:29:47 PM","gateway-topic":"devices-1"}
Tue, Jun 16, 2020, 5:29:56 PM Front - Center -> message: {"flow_rate_gpm":2.7422,"cycle_run_time_sec":22,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","event":"flow_sensor_state_changed","cycle_volume_gal":0.696925,"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"timestamp":"Tue, Jun 16, 2020, 5:29:48 PM","gateway-topic":"devices-1"}
Tue, Jun 16, 2020, 5:29:57 PM Front - Center -> message: {"flow_rate_gpm":2.7422,"cycle_run_time_sec":24,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","event":"flow_sensor_state_changed","cycle_volume_gal":0.779185,"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"timestamp":"Tue, Jun 16, 2020, 5:29:50 PM","gateway-topic":"devices-1"}
Tue, Jun 16, 2020, 5:29:59 PM Front - Center -> message: {"flow_rate_gpm":2.7422,"cycle_run_time_sec":25,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","event":"flow_sensor_state_changed","cycle_volume_gal":0.820315,"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"timestamp":"Tue, Jun 16, 2020, 5:29:51 PM","gateway-topic":"devices-1"}
Tue, Jun 16, 2020, 5:30:00 PM Front - Center -> message: {"flow_rate_gpm":2.7422,"cycle_run_time_sec":27,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","event":"flow_sensor_state_changed","cycle_volume_gal":0.902575,"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"timestamp":"Tue, Jun 16, 2020, 5:29:53 PM","gateway-topic":"devices-1"}
Tue, Jun 16, 2020, 5:30:02 PM Front - Center -> message: {"flow_rate_gpm":2.7422,"cycle_run_time_sec":28,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","event":"flow_sensor_state_changed","cycle_volume_gal":0.943705,"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"timestamp":"Tue, Jun 16, 2020, 5:29:54 PM","gateway-topic":"devices-1"}
Tue, Jun 16, 2020, 5:30:03 PM Front - Center -> message: {"timestamp":"Tue, Jun 16, 2020, 5:29:56 PM","event":"watering_complete","stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"gateway-topic":"devices-1","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}
Tue, Jun 16, 2020, 5:30:03 PM Front - Center -> SENDING watering_complete {"timestamp":"2020-06-16T21:29:56.000Z","event":"watering_complete","stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"gateway-topic":"devices-1","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"} to SmartThings
Tue, Jun 16, 2020, 5:30:03 PM - FRONT - CENTER -> Executing Client.prototype.smartthings for event: WATERING_COMPLETE
Tue, Jun 16, 2020, 5:30:04 PM - FRONT - CENTER -> ST Post Accepted for WATERING_COMPLETE
Tue, Jun 16, 2020, 5:30:04 PM Front - Center -> message: {"timestamp":"Tue, Jun 16, 2020, 5:29:56 PM","event":"flow_sensor_state_changed","cycle_run_time_sec":0,"flow_rate_gpm":0.38402,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"gateway-topic":"devices-1","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}
Tue, Jun 16, 2020, 5:30:04 PM - websocket.readyState = (1), sending keep alive ping #7Tue, Jun 16, 2020, 5:30:04 PM Front - Center -> message: {"event":"change_mode","mode":"auto","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","timestamp":"Tue, Jun 16, 2020, 5:29:56 PM"}
Tue, Jun 16, 2020, 5:30:04 PM Front - Center -> SENDING change_mode {"mode":"auto","program":null,"stations":null,"timestamp":"2020-06-16T21:29:56.000Z","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","event":"change_mode"} to SmartThings
Tue, Jun 16, 2020, 5:30:04 PM - FRONT - CENTER -> Executing Client.prototype.smartthings for event: CHANGE_MODE
Tue, Jun 16, 2020, 5:30:04 PM Front - Center -> message: {"timestamp":"Tue, Jun 16, 2020, 5:29:56 PM","event":"device_idle","stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}
Tue, Jun 16, 2020, 5:30:04 PM Front - Center -> message: {"event":"rain_delay","delay":0,"device_id":"xxxxxxxxxxxxxxxxxxxxxxxx","timestamp":"Tue, Jun 16, 2020, 5:29:56 PM"}
Tue, Jun 16, 2020, 5:30:05 PM Front - Center -> message: {"timestamp":"Tue, Jun 16, 2020, 5:29:57 PM","event":"flow_sensor_state_changed","cycle_run_time_sec":0,"flow_rate_gpm":0.38402,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"gateway-topic":"devices-1","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}
Tue, Jun 16, 2020, 5:30:05 PM - FRONT - CENTER -> ST Post Accepted for CHANGE_MODE
Tue, Jun 16, 2020, 5:30:06 PM Front - Center -> message: {"timestamp":"Tue, Jun 16, 2020, 5:29:59 PM","event":"flow_sensor_state_changed","cycle_run_time_sec":0,"flow_rate_gpm":0.38402,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"gateway-topic":"devices-1","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}
Tue, Jun 16, 2020, 5:30:08 PM Front - Center -> message: {"timestamp":"Tue, Jun 16, 2020, 5:30:00 PM","event":"flow_sensor_state_changed","cycle_run_time_sec":0,"flow_rate_gpm":0.38402,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"gateway-topic":"devices-1","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}
Tue, Jun 16, 2020, 5:30:09 PM Front - Center -> message: {"timestamp":"Tue, Jun 16, 2020, 5:30:02 PM","event":"flow_sensor_state_changed","cycle_run_time_sec":0,"flow_rate_gpm":0.38402,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"gateway-topic":"devices-1","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}
Tue, Jun 16, 2020, 5:30:11 PM Front - Center -> message: {"timestamp":"Tue, Jun 16, 2020, 5:30:03 PM","event":"flow_sensor_state_changed","cycle_run_time_sec":0,"flow_rate_gpm":0.38402,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"gateway-topic":"devices-1","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}
Tue, Jun 16, 2020, 5:30:12 PM Front - Center -> message: {"timestamp":"Tue, Jun 16, 2020, 5:30:05 PM","event":"flow_sensor_state_changed","cycle_run_time_sec":0,"flow_rate_gpm":0.38402,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"gateway-topic":"devices-1","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}
Tue, Jun 16, 2020, 5:30:14 PM - websocket.readyState = (1), sending keep alive ping #8Tue, Jun 16, 2020, 5:30:14 PM Front - Center -> message: {"timestamp":"Tue, Jun 16, 2020, 5:30:06 PM","event":"flow_sensor_state_changed","cycle_run_time_sec":0,"flow_rate_gpm":0.38402,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"gateway-topic":"devices-1","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}
Tue, Jun 16, 2020, 5:30:15 PM Front - Center -> message: {"timestamp":"Tue, Jun 16, 2020, 5:30:08 PM","event":"flow_sensor_state_changed","cycle_run_time_sec":0,"flow_rate_gpm":0.38402,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"gateway-topic":"devices-1","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}
Tue, Jun 16, 2020, 5:30:17 PM Front - Center -> message: {"timestamp":"Tue, Jun 16, 2020, 5:30:09 PM","event":"flow_sensor_state_changed","cycle_run_time_sec":0,"flow_rate_gpm":0.38402,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"gateway-topic":"devices-1","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}
Tue, Jun 16, 2020, 5:30:18 PM Front - Center -> message: {"timestamp":"Tue, Jun 16, 2020, 5:30:11 PM","event":"flow_sensor_state_changed","cycle_run_time_sec":0,"flow_rate_gpm":0.38402,"stream-id":"xxxxxxxxxxxxxxxxxxxxxxxx","client-topics":["device-clients-2"],"gateway-topic":"devices-1","device_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}
Outdoor -> SENDING flow_sensor_state_changed {"flow_rate_gpm":2.2181599999999997,"cycle_run_time_sec":98,"cycle_volume_gal":2.92937,"timestamp":"2020-06-16T20:46:46.000Z","device_id":"xxxxxxxxx","event":"flow_sensor_state_changed"} to SmartThings
I will try my best to edit the smartapp and you can merge the changes, people installing this in the future can have different setups without having confusion over which Smartapp to use
Interesting, not sure why we are seeing different events using the same models! HeadBang!
OK, the area you want to change in the Orbit bhyve Controller SmartApp is below and add the new case statement with the :
case ‘watering_events’: case ‘flow_sensor_state_changed’:
case ‘program_changed’:
case ‘watering_in_progress_notification’:
case ‘watering_complete’:
runIn(5, “refresh”)
Add this new case statement to the app.js with the :
switch (event) {
case ‘program_changed’: case ‘flow_sensor_state_changed’:
case ‘watering_complete’:
case ‘watering_in_progress_notification’:
case ‘change_mode’:
case ‘low_battery’:
The Orbit byve Controller SmartApp should really be functioning as expected for sensing without the node proxy server, just not as fast at detecting the on/off watering events since API polling frequency is not real-time from the ST cloud server to bhyve API cloud server using http!
The node proxy server adds faster on/off watering event detection using an open websocket and also has the added benefit of allowing the Orbit bhyve Controller SmartApp to turn a watering device on/off…
The SmartApp will catch the “flow_sensor_state_changed” sent from the proxy node server and create a asynchronous ‘refresh’ event in 5 seconds. This causes the Orbit bhyve Controller SmartApp to connect to the bhyve http api server for ALL device state changes.
I’m not sure what will happen if you cause the Orbit bhyve SmartApp to refresh at a rate faster than say 2-3x per minute, since the http API server takes a few seconds to give the json response back for all the devices and then their is the added processing time for the SmartApp to process the json data for each watering device.
IMHO, I would try to program a throttle of the “flow_sensor_state_changed” events in the node proxy so that you can be assured that the SmartApp refresh event completes and there is some tine in between the next ‘refresh’ call so that you are not polling the bhyve API server with your device and they detect it and block it by device ID or account. If Orbit IT blocks this over polling by IP address, you risk black listing ST cloud which is brokering the http API ‘refresh’ call for all of us.
As much as many of us would love to have SmartThings be ‘real-time’, it is not built for fast updates of the devices, given the nature of their cloud hub implementation. If you want faster processing and device display, I would suggest using a Hubitat server which operates locally. I have several apps that I have migrated to Hubitat since this server can handle very fast events!
I’ve been working on porting your code to another platform (Hubitat) which, nicely has Websockets built in so I don’t need the Node.js stuff and can do everything natively and locally on the hub… Really great work on this, you saved me a lot of time from reverse engineering the Android app! And since Hubitat works with something very similar to ST DTH and SmartApps, porting it was only a few hours of work! Anyway, a couple of questions:
1.) def message = “Orbit device requested to manually OPEN but scheduled_auto_on = false, ignorning request” – what is the purpose of this limitation?
2.) With the node server you have, have you noticed frequent WebSocket disconnects? I’ve noticed that sometimes I get disconnected and then reconnecting doesn’t work when I retry every 30 seconds. I’m now doing a “staggered” retry where it will do retryCount*30s up to a max of 5 minutes.
Figured I’d ask in case you have any insight before I keep troubleshooting.
Glad to have you do this conversion, since someday I will port everything I have on SmartThings to HE. The ST platform strategic direction IMHO is getting var too complicated with their elimination of hosted server based SmartApps (groovy) and user defined DTH’s.
I believe that DTH logic check handles when a user has set the ‘Device Run Mode’ set to ‘Off’ in the OEM bhyve App. When I coded this years ago, I found that a bhyve hose device will not turn ON/OPEN until that ‘Device Run Mode’ setting is set to ‘Auto’ mode? I think I experienced this issue when I had some of my bhyve hose devices ‘Device Run Mode’ off, and could not figure out why the WebSocket command to OPEN was not turning the hose device open.
OMG, don’t get me started on the instability of the bhyve WebSocket proxy server… I have the proxy server being auto-restarted using PM2 since it randomly dies, hangs, goes silent, burps, etc with very little notice… Any of my other websocket proxies are rock solid, so I know it is Orbit bhyve servers. I think that the iOS byhve app handles this instability by only being connected for a brief period of time while the user looks at the device’s status and them closes down the app… The dropped connection could also be bhyve’s way of handling load balancing? Hope you can provide resilience in the HE’s websocket, otherwise, users will be disappointed.
I look forward to testing and who knows I might switch to your code stream on HE…
Well I guess a good news/bad news. I was kind of hoping you’d say “Nope, super stable!” because then it’d mean I was just doing stuff wrong. I’m getting there, here is what I did so far:
In the app_connection WebSocket method I added orbit_app_id: UUID.randomUUID().toString(), because the Android App seems to send this parameter (the Node.js app didn’t)
When I get disconnected, I also now recall the login endpoint. I figure it will help me handle a case where the token expires (does it???)
If I get disconnected I wait 30 seconds before reconnecting and keep retrying every 30 seconds. So far so good with that. What I really wanted to do was do 30s*#_of_retries but I’m struggling to get that working in HE (they need a websocket.isConnected() method but it doesn’t exist!)
If you’re interested in taking a look, GitHub - dcmeglio/hubitat-orbitbhyve: Provides integration with a Orbit™ Bhyve Timer and SmartThings You’ll notice like 80% of it is the same as your code. Porting ST drivers/apps is mostly straightforward other then there are “Hubitat ways of doing things” where sometimes I recode something that “works” to be a way that is better for HE… and then of course adding extra features like the WebSocket stuff.
I’ve been very happy with HE. Everything that broke in ST (like the Rheem EcoNet integraton that broke because they switched to MQTT which ST doesn’t support) I’ve been able to get working in HE. The biggest negative is now I’m maintaining a billion integrations so if you ever do hop over to HE, feel free to take this integration back over But yeah, as much as AWS is super cool, I really don’t want to manage my own cloud accounts to run stuff, and even worse, it then means everything I build is just for me because, no, I’m not training others on how to setup AWS accounts and such.