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

Thank you

All,

Release 1.1.7 of HubDuino is now available for your use. This release includes some nice usability enhancements, especially for the initial setup process.

[UPDATE 1.1.7] This is a significant update to the Parent Drivers. Changes include:

  1. MAC Address no longer required when setting up a Parent Device. Only the IP Address/Port is required to help simplify initial startup. This also means that the micro-controller can be replaced with different hardware, as long as it runs the same sketch and uses the same IP address. This ability to swap boards is only possible with freshly installed HubDuino boards, due to changes in the Child Device Network IDs. These are now based on the parent's device.Id, instead of the parent's device.deviceNetworkId.
  2. Number of Buttons no longer required when setting up a Parent Device. This will be automatically determined and configured. Please be sure to update your Arduino library's IS_Button.cpp file, and rebuild/reload the sketch for this to work on new installations.
  3. New setting for Device Timeout - number of seconds before marking the micro-controller 'not present'. In the event that your Arduino/ESP8266 boards decides to go offline, the Parent Device now implements the Presence Capability. This will indicate whether or not the micro-controller has sent data to the hub within the user defined timeout setting (defaults to 900 seconds.) You can use this as a trigger in RM, for example, to send a notification that something may be wrong with HubDuino Microcontroller to Hubitat Hub communications.

Please let me know if you find any issues.

I would like to thank @lelynch, @jdjmailbox, @dan.t, and @Ryan780 for their assistance in Beta Testing these changes.

9 Likes

I was literally just trying to figure out a way to do this a couple of days ago by looking at the "lastUpdated" attribute for the child devices. Of course, finding a way to evaluate that against the current time in Rule Machine was a fool's errand... You must be a mind reader.

Thanks for all your work on this project! I've only been fiddling with your code for a couple of weeks, but I have already hacked it together to integrate my garage door, fire place, and alarm system - each for relative peanuts using no-name ESP8266 modules.

Next up is another ESP to read contacts as leak sensors for both HVAC units and both Water Heaters in our attic.

1 Like

Trying to use A0 for the DoorControl contact sensor. Doesnt seem to be working.

I have tried
pinMode(A0, INPUT_PULLUP); // set pull-up on analog pin 0
pinMode(A0, INPUT);

Doesnt work.

Do I need to use digital read or analog read???

Are you using an ESP8266? If so, I don't believe you can use it as a digital input...but there is a way...!!!

I just merged a pull request in my ST_Anything GitHub repository. This change allows for the A0 pin to be used as a digital input for the ESP8266 based boards.

Grab the latest InterruptSensor.cpp and give it a try. I haven't tested this new version yet, so I'd appreciate your feedback. This new version should 'just work' with the IS_Contact and IS_DoorControl devices.

I am using the D8 board with the ESP-12 on it. I just updated InterruptSensor.cpp only.

Connecting A0 to ground shows no change in DoorControl.

Ah yes... You're going to need to use an external pullup resistor. The pin needs to be either at a positive voltage or Gnd. Here's the gotcha!!!! The AO pin on the actual ESP8266-12e chip can only handle 1 volt. Boards like the Wemos D1 and NodeMcu implement a voltage divider to make sure that the 3.3vcc voltage is scaled from 0 to 1.0v.

I'll have to look up how to do it. I did read that it only supports 1v max.

Here's the voltage divider that I'd use. Use Vcc (3.3V) from the ESP8266 and a GND pin from the ESP8266 to generate the 1v attached to the A0 pin. This will keep it pulled up HIGH, when the contact sensor is OPEN. When you close the contact sensor (wired between GND and A0), the input will be pulled LOW, and the contact sensor will be detected as CLOSED (hopefully!)

Note: you could probably also use a ~20K and ~10K resistor as well.

I was just looking at that site. :+1:

I'll give it a try and report back. Thanks for the help!

1 Like

It is a no go. pulling the pin to 1v did not change the state.

I hate to ask the obvious... after you downloaded the new InterruptSensor.cpp file, you did recompile and load the sketch to your ESP-12 chip?

Just checking...:wink:

Did you use a voltmeter to verify the A0 pin voltage is changing between 1v and 0v when you open and close the contact sensor?

I'll need to break out a board and do some testing.

Ok it is working after restarting the board. Think the board froze. I tired the relay and it wasnt working. After restarting everything is working great! Now to just solder everything in place. Thanks for your help once again Dan!

Ended up using a 20k from the 3.3 and a 8.8k. That gave me .994 volts

1 Like

Awesome! Thanks for the feedback.

I have not been able to play with it in the last 5 days due to work. But I have noticed using A0 is making the board run really slow. Changing this to another pin makes it snappy again. Any workarounds you can think of to fix this? I am using the tx/rx pins for a bme280 so I am unable to check the serial output. I do also have debug logging disabled. I am using all usable pins on the esp12. 8 relays, bme280, and A0 for the contact sensor. Maybe too much for it? It is when I comment out one of the relays and change the contact sensor from A0 to one of the relays pins that things get snappy once again.

Reading an analog input pin is much slower than reading a digital pin. Maybe I could modify the code to only read the A0 pin once every ~1000 times through the loop(). This would greatly reduce the load without sacrificing much responsiveness. I’ll have to think about it...:thinking:

1 Like

@jayme9 - please grab the latest version of InterruptSensor.h and InterruptSensor.cpp from my GitHub repository. I think this version may help improve the performance when using the ESP8266's A0 pin as a contact sensor.

Please let me know how it goes.

I flashed the update and it looks to be working. It has been running for 40 mins and is still snappy. However I did accidentally over volt A0 and may have damaged the chip. I definitely lost pin 13 for what ever reason. I do not have anything on A0 at this time and cant confirm for sure that everything is golden. I will have to replace the chip on the board with a new esp12 or just get a new board. But the update code seems to be working. It was running really slow with A0 not commented out and now is running fine.

Thanks Dan

1 Like

@ogiewon - I've got two MKR1010 boards running HubDuino. Loving it. One of them is monitoring levels in two fuel tanks. I have this set up and running fine between HE and the Arduino. I have the fuel level being sent back to HE as a "Voltage" which I have scaled relative to the resistance of the fuel level sending unit on an Analog pin. Here are my questions:

1.) How do I view "Voltage" in the HE dashboards?
2.) I tried to implement the ArduinoOTA over the air update library in setup() and then put a poll in loop() but ran into all sorts of errors. Wondering if you have tried this and is there something specific in your code which is preventing this?

I am relatively new to HE and not a professional programmer, but I can certainly find my way around. If you can just point me in the right direction for either of these two I can run with it.

I have to stress what a great app this is!

This one is fairly easy... In the Dashboard, select the Tile Type of Attribute. Then type in the attribute name of "voltage" paying attention to the case of the characters (i.e. all lower case.)

I currently do not have any support for Arduino OTA updates except for the ESP8266 boards. There has been a recent development with respect to Arduino OTA support from the folks at Arduino.cc. Previously, OTA updates were somewhat of a custom/community solution, specific to the ESP boards. I have had time to mess around with adding the more generic OTA update support to HubDuino/ST_Anything.