[Release] HubDuino v1.1.9 - Hubitat to Arduino / ESP8266 / ESP32 / ThingShield Integration (ST_Anything)

The only difference in each microcontroller’s sketch, is the “SmartThings…” communications library. The SmartThingsESP01WiFi library hasn’t been updated in a very long time. I spent a lot of effort years ago trying to get it working reliably to no avail. Hopefully someone else will have more luck improving it one day. Until then, the ESP32 is a decent alternative if a WiFi microcontroller is desired.

1 Like

Sounds good! The bottom line goal was that I just needed more pins without wanting to add additional Wemos boards. I'll take a look at the ESP32 here. Thanks for taking a look at my issue here and a continued thank you for this incredible project!

1 Like

hi just saw this now.....thanks to someone else (Malcolm Dobson) he got this all working... I use this now to weight my water softener
I put the code here https://github.com/tjodork1960/HX711-scale

I graph it in hubigraph and I use webcore to tell me when it hits low threshold of 90

1 Like

I used HubDuino, an ESP8266, 2 relay boards, and an ultrasonic sensor to make my cat feeder "smart". Everything works as intended.

I am using the timed relay to give 5 portionsof food to the cat.

static st::S_TimedRelay sensor2(F("relaySwitch2"), PIN_TIMEDRELAY_2, LOW, false, 500, 3000, 5);

I want to pass a variable from Hubitat and use it in the above instance, so basically instead of setting a constant 5 cycles I would use a variable number_of_cycles that is set in Hubitat.

Is this possible? What would be the best way to achieve this?

You could try creating 5 versions of the timed relay device in the sketch, each with a unique numerical suffix on the name. Have them all control the same pin, but each pulses the output a unique number of times. This will then create 5 switch devices in Hubitat. Simply turn on the correct one based on your needs.

1 Like

Thanks a ton for the HX711 sketch! I will give that a shot.

+1 :point_up: I’ve done this myself on a timed relay device. It works well

1 Like

@tim.ocallag - are you and Malcom okay with me adding this additional support of the HX711 to the main ST_Anything GitHub repository? I took a quick glance and it appears you two did a very nice job of following the architecture. Thank you!

@tim.ocallag - Also, did you and Malcom really work on this back in January 2021 as the comments indicate? Or is that just a typo on the year? I'll change those comments to 2022 if desired before I add this code to my main repo.

The USB water sensor i made which has child water sensor
but it doesn't show up in lists for water alarm
image

how can i solve this?
Thanks

Please post a screenshot of the Child Water device from your hub. We'll need to see if it is using the correct child driver as well as whether or not it has populated it attribute(s).

Looks fine to me. Not sure why it wouldn't show up in an automation.

How about answering my questions about the HX711 code, above... :wink:

apologies...I missed the q, completely.
Yes,would be very happy to have it added to your stuff
Jan2021 sounds about right...Ive had this a long time
95% of the credit goes to Malcom.

If there is any interest I have a version of the shade controller for a DC motor... no problem if not interested : )

Thank you, it's done, works well.

1 Like

Is there code in Hubduino, that will not send an event to the hub if its same as last?
Example: my shade is open and in beSmart when it gets a new command (say close), i send the current state (open).... I do not see the open even in the event log. I could see that, that might be helpful to not send redundant info to the hub....is something blocking that ? If so, is that changeable?
It's kinda for a dumb reason, but using Hubigraph and showing the shade open and light coming in, the shade should be a square wave but it doesnt look like that...i think if i could get the event for current state prior to change my graph would look nicer... ridiculous yes... but when you work from home its easy to get sidetracked

The Hubitat Platform performs de-duplication of successive identical events. HubDuino Executor devices always send their status updates when commanded, and typically every 5 minutes even if they have not received a command. Interrupt Sensors always send on a change of state. Polling Sensors transmit every interval.

There is no deduplication done on the microcontroller in any of the devices that I have written the code for. I do believe the HX711 code does prevent sending duplicate events. :wink:

Hi @ogiewon , I've been having an issue for a while with my blinds, and haven't had a chance to climb up and tinker until now. I've got 3 blinds in a bay window. Each servo is connected to a NodeMCU 1.0 on pins D1, D2, and D5. Each child servo is in a Group Bulb Dimmer to control them on and off together.

A couple years ago when I first built this, it worked wonderfully. All 3 opened and closed as expected, immediately one after another. Something happened though, and now the problem is a huge latency. Sometimes up to 10-15 seconds. If I control via a Group Bulb Dimmer, it eventually gets all 3 of them, but it takes a while. Otherwise it has been working fine, so I haven't bothered fixing it.

So I took it down tonight and did the following:

Updated ESP8266 board manager to 2.7.4
Installed IDE 1.8.16
Updated SmartThingsESP8266WiFi.cpp and SmartThingsESP8266WiFi.h
Updated Parent driver and Child Servo driver

Then I uploaded the same sketch (ST_Anything_Servos_ESP8266WiFi), as I believe nothing needed to be changed there. I left Hubitat settings as-is, with the existing parent and child devices. Now I'm getting intermittent response from all 3 servos, still with huge delays, and sometimes it ignores one altogether.

Any ideas what the issue could be?

Not really, as I don’t use any servos personally. I do recall changing the ST_Anything Libraries code to allow for simultaneously changing multiple servos at the same time, instead of one at a time. I’d recommend updating all of the ST_Anything code from my GitHub repo, the rebuild your sketch and upload it to the ESP8266. Perhaps the newer code will help?

1 Like

That fixed it - I hadn't updated it all.

New issue though - the servos are constantly engaged, buzzing endlessly.

edit: I added "true, 1000" to the executor, which was in the original sketch - I don't recall what the arguments are for, but that stopped the buzzing.

Also, I uploaded it OTA for the first time. incredible! Now I don't have to contort myself to retrieve the board.

Thanks again for such a great thing.

1 Like

Here is the documentation from the top of EX_Servo.cpp

//******************************************************************************************
//  File: EX_Servo.h
//  Authors: Dan G Ogorchock
//
//  Summary:  EX_Servo is a class which implements the SmartThings/Hubitat "Switch Level" device capability.
//			  It inherits from the st::Executor class.
//
//			  Create an instance of this class in your sketch's global variable section
//			  For Example:  st::EX_Servo executor1(F("servo1"), PIN_SERVO, 90, true, 1000, 0, 180, 2000, 544, 2400);
//
//			  st::EX_Servo() constructor requires the following arguments
//				- String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
//				- byte pin_pwm - REQUIRED - the Arduino Pin to be used as a pwm output
//				- int startingAngle - OPTIONAL - the value desired for the initial angle of the servo motor (0 to 180, defaults to 90)
//              - bool detachAfterMove - OPTIONAL - determines if servo motor is powered down after move (defaults to false) 
//              - int servoDetachTime - OPTIONAL - determines how long after the servo is moved that the servo is powered down if detachAfterMove is true (defaults to 1000ms)
//				- int minLevelAngle - OPTIONAL - servo angle in degrees to map to level 0 (defaults to 0 degrees)
//				- int maxLevelAngle - OPTIONAL - servo angle in degrees to map to level 100 (defaults to 180 degrees)
//              - int servoRate - OPTIONAL - initial servo rate in ms/degree (defaults to 2000, used to ensure a gentle move during startup, afterwards comes from SmartThings/Hubitat with each move request)
//              - int minPulseWidth - OPTIONAL - minimum pulse width in milliseconds, defaults to 544 (see Arduino servo attach() function)
//              - int maxPulseWidth - OPTIONAL - maximum pulse width in milliseconds, defaults to 2400 (see Arduino servo attach() function)
//

The Detach After Move is what stops the buzzing.

1 Like