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

ST_Anything, by default, updates the status of all devices every 5 minutes, whether things have changed or not. So, even infrequently used contact sensors should get updated every 5 minutes. Perhaps we can just remove the custom “lastUpdated” attribute altogether?


That's what I did. Commented out that attribute, added the "wasUpdated" one.

I checked this morning, and the Last Activity is being updated with the ST_Anything periodic updates with no events being generated, as expected. Perfect in my opinion.

EDIT: For bonus points I guess we could always set a timed task 3 hours out as a deadman/watchdog and set wasUpdated to FALSE if there are no updates.

Understood. My suggestion is to simply not add the "wasUpdated" either. You can just check the "Last Activity" of the child device, as ST_Anything still attempts to update all child devices every 5 minutes, whether anything has changed or not. I think the "wasUpdated" may be superfluous.

I removed "lastUpdated" altogether from all of my Child Device drivers last night as a test, and sure enough each child device's Last Activity is staying up to date as expected.

Ah! Yeah, that makes even more sense. I obviously didn't think of that last night. lol

If you look at the Parent Device's settings, you can select a "Presence Timeout" value (defaults to 900 seconds.) If the Parent Device does not receive an update from the Arduino device within that timeout, the Parent's Presence Attribute will change to 'not present'. This is meant as a means for you to know that there is an issue with the Arduino device. You can simply use the Notifications App or Rule Machine to take action as appropriate. This was a recent addition to the Parent, just in case you're running old HubDuino drivers.

Glad you mention that... I did see that, and was wondering what I would use that for. It was on my to-do sticky note to look at... Now I know. :+1:

So yes, I think just removing lastUpdated attribute and lastUpdated event code altogether from the child drivers is the way to go on HE. Just did that on my hub, too.

1 Like

@ogiewon I saw on Adafruit that the MAX31855 is an upgrade from the MAX6675. Do you know if a MAX6675 would be compatible with the libraries for the MAX31855 thermocouple adapter that you currently have? If not, what would I need to do to use a MAX6675? Thanks for any help.

I don’t know for sure. I have never actually owned or used a MAX31855. Looking at Adafruit’s GitHub Repository, there appear to be two separate libraries, one for the MAX31855 and another for the MAX6675.

If you want to try to get the MAX6675 working, I’d recommend you replace the MAX31855 library calls in the ST_Anything PS_AdafruitThermocouple Device class, with the corresponding MAX6675 calls.

Thank you! I gave it a try and although I get readings they are incorrect. I have never had a programming class but I have learned enough over the years to be able to figure out most things and make changes for what I need. I am still learning (always) but I was looking through the library files and what you suggest is about what I was thinking to do.

I have a MAX31855 also and it works great but I wanted to try the MAX6675 as I was able to get a thermocouple and the adapter board for $7 total. The MAX31855 is about $15 alone without the thermocouple.

1 Like

For the record, my wife blames you for this @ogiewon. I guess for showing me how easy it is to bring sensors until hubitat with an Arduino or esp8266 in this case... Lol.

Capacitance low-level alarm on my pool bleach injection tank. took a little bit more work because I had to put it in a waterproof job box so I could mount it outside.

So clockwise from bottom left - 12V power supply, ESP8266, 5V relay+opto-isolator (mainly for voltage level conversion - the isolation IC doesn't do much since power is all fed from the same place), interface module for capacitance level.

I could have used resistors instead of the relay for voltage conversion, but I like relays. :wink: And I had a few lying around anyway.


Very nice!

Completely minor/trivial typo in your code - "wilol":
Sending REFRESH command to Arduino, which wilol create any missing child devices.

Which module? :wink:

HubDuino Parent Ethernet line 274.

Fixed! Thank you.

1 Like

Hello again all -

A while back I used an ESP8266 with HubDuino to cobble together a Garage Door Opener control (timed relay to simulate a button push to the head unit and a wired contact to judge if/when the door is open or closed).

I used @ogiewon's example sketch and everything works great within the Hubitat ecosystem. The Parent Driver created a single Child which is of type: "doorControl."

I also exposed the child device to Alexa through the built-in Amazon Echo Skill. Alexa had no problems finding the device and correctly displays the door's state (open/closed) using it. However, what I can't do with this device is open or close the door. The details for the device in the Alexa app show that it has been recognized as a contact sensor, but not a button, switch, or relay. It seems Alexa should know how to deal with multi-functional devices, since it gracefully deals with things like door locks.

For the time being I have created a virtual switch in Hubitat that is set to automatically return to the "off" position 1s after being turned on. I exposed that virtual switch to Alexa instead of the doorControl child and have a rule in Hubitat to run the custom action "push()" on the child whenever the virtual switch is turned on by Alexa. This works, but it a little hackey/hokey, causing me to say something like, "Alexa, turn Garage Door Opener ON, please." Instead of the more natural, "Alexa, (Open/Close) Garage Door, please."

Has anyone else approached the same problem in a different way, or have a more thoughtful solution to suggest? Overall, this is a nitpick, it just feels like there might be a better way that I'm not thinking of...

Two quick questions -

  1. When using an esp8266, does the library configure/allow OTA updates, or do I need to add that in myself? EDIT: The release notes say yes, so I assume so. I couldn't get it to work initially, so I may need to investigate further.

  2. does the code do anything to handle loss of wifi / wifi reconnection? I ask because I updated the firmware on my wifi ap yesterday, and the esp8266 never reconnected (waited about 30 minutes). I had to eventually power cycle it to get it reconnected.

ESP8266 OTA updates are enabled by default, assuming you have Python 2.7 installed on your PC that is running the Arduino IDE.

The base WiFi logic is all handled underneath my code. This includes the automatic reconnect logic. I reboot my WiFi access points and have never had an issue with the ST_Anything boards automagically reconnecting.

I did have an issue caused by my Hubitat hub locking up. Afterwards, the STA boards had to be rebooted. I did add a possible fix for that issue, however my HE hub hasn’t locked for a very long time, so it hasn’t been fully tested.

Thanks Dan.

For the OTA it may indeed be a python problem. I just rebuilt the PC the other week, and might not have installed it. I will double check / tinker some more.

For the reconnect, I'll just leave it alone and see if it happens again.

Thanks for the response! I've been very much enjoying using your package!

1 Like

You can easily create an Alexa Routine inside the Alexa App on your phone. Make the trigger phrase whatever sounds more natural to you, and then have it turn on the momentary virtual switch. This will at least solve the unnatural verbal command issue.