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

As long as the Arduino IDE Serial Monitor Window is set to 115,200 baud rate, AND you have not changed/added something in the sketch which would change the baud rate of the Arduino, it should just work. Perhaps your USB cable is a little 'iffy'? Maybe try another one? It could also be the Arduino MEGA board itself, having issues... :thinking:

All,

Based on another's user's report of an issue, I just tested Arduino IDE 1.8.15 with the ESP8266 2.7.4 board manager, and it compiles fine.

However, when I upgraded the ESP8266 support from 2.7.4 to 3.0.0, I received the flurry of compiler errors. Definitely something in the ESP8266 3.0.0 version (released a few days ago) that has broken things.

If anyone figures it out, please let us all know. For now, I recommend using ESP8266 2.7.4.

Serial monitor was set to 9600. Thanks for your patience in helping us beginners in debugging the fundamentals!

1 Like

Hi @ogiewon!

I've had to build some working hardware before starting to dig into the code.
Anway, now I'm checking the code of IS_Button: I don't know if I'm right, but I have the feeling that it's not exactly what I need. I mean, the device can manage up to 12 different buttons, and it's connected with I2C, hence there's no pin to monitor to decide what to send to hubitat.

After digging a bit around the code and the various classes, I've got an idea: could it be that I've really to extend the Executor class? I mean, I need to check the state of several buttons that could be connected to the device. Executor allows me to add a custom code that runs at every cycle, and send a customized string according to the button that I've pressed.
But, it could be that the handler is able to manage just a HIGH/LOW string. So, in the worst case, inside my main class I've to build 12 different classes, each of them sends a single message to the hub.
Is it correct? It looks that creating this piece of hardware is going to be much longer then expected...

Ok. I was way too fast to write the previous post. It look that I've to extent the class Sensor, because Executor has a totally different way of working.In detail, I don't manage any state, hence I don't have to handle any command from the hub.
But, it looks that that I really need 12 "small" sensors in my MPR121 device, each for each button that could be pressed/touched.

Ok, sounds like you’re beginning to understand the architecture a bit. I would still strongly recommend you START with the IS_Button device as an example device. Remove the part where it polls the GPIO input pin, and replace that code with your MPR121 library code. Once you get the MPR121 results, you can send pushed and released events for any of the 12 touch sensor inputs that have changed.

I hope this makes sense. If not, please feel free to ask any questions that you have.

Thank you for the answer.
Ok, I agree! It's definitely better than starting to implement a class without a good knowledge of the basis.

So, do you mean that I've to write a custom implementation of the function void InterruptSensor::update(), where instead of polling a pin I poll the sensor.
To send multiple buttons I simply add a suffix to the string with the number of the button, am I right?

On the hub, the device will send different strings, and for each one I can generate an event. Is it like this? Sorry, I still have to give a look in the Hubitat section of the code. I've had a first sight, but not really in detail.

Complete shot in the dark here, but has anyone used a board to connect to a hunter pro-c irrigation controller that will look at the weather and activate the rain skip function? My rain sensor broke, but my guess is it is just some sort of relay that completes the circuit activating a skip.

Probably an amateur question, can you have multiple Arduinos or multiple instances of Hubduino running at the same time? I want to be able to add sensors in a few different rooms without running all the wires back to a central location.
Thanks,

yes you can. when you create the virtual device, you specify the IP address of the arduino, so you can have multiple connected to one hub

2 Likes

Thanks mate,

So, I was able to handle a single touch sensor using this board Standalone Momentary Capacitive Touch Sensor Breakout [AT42QT1010] : ID 1374 : $5.95 : Adafruit Industries, Unique & fun DIY electronics and kits. The sensor works using an a IS_Button connected to a selected pin of the Arduino Nano 33 IoT.
But, with the MPR121 I get nothing: I can't send you the log (as a stupid I've deleted the sensor and all the logs...), but I remember that it was making a mess with multiple push/release/hold events. I try to investigate more what's going on (given that now I know what should happen when everything works) but I've a strong feeling that I need an array of IS_Button, built into the PS_Adafruit_MPR121. My first attempt was with sending an event for each button with a given suffix (button 1 -> pushed1, button 2 -> pushed2... ), but I've understood that it's not working.

Have you tried to use the board, if you've got one?

Now it's really late, I can't test anymore. But I'll try in the next days. Thanks for the cool work, anyway, it allows to integrate each type of hardware with the hub.

Is it possible to send data from the hub to the Arduino? Say I have a servo or LED strip connected to an Arduino. Can I control the servo or LEDs from my Hubitat?

Yes you can.

I assume your arduino that you want to control from hubitat has a network connection of some sorts ? If so, and you can control the servo by sending a command over http from a browser to the arduino, then it should be super easy to do that.

Excellent. I don't have it set up yet. I just bought my hubitat and move into a new house in a couple months. I didn't think it was worth the headache to set it up all now for only a couple months. I have a few ESP32s on the way.

Thanks for your help.

Duh you will be running Hubduino on the ESPs so yeah you will be able to for sure do LEDs from hubitat. I haven't done servos with it yet... Just search this thread, I'm sure there is something about servos in here.

I've successfully coded the management of different buttons with the mpr121 sensor. However, the board within the hub is recognised but no buttons are assigned (not only 1).
I've extended my handled class from InterruptSensor instead of IS_Button due to all the code that I should have removed or handled otherwise. But it looks that there's a deep difference between the two, that I'm not able to see and reproduce in my custom class.

Where is exactly defined/added /created the button that the board manages? Is just because its of the type IS_Button that's is recognised as a button?

I am not sure I understand exactly what you’re asking…:thinking:

As long as your new class sends events to the Hubitat hub in the form of “button1 pushed”, “button1 held”, and “button1 released”, the PARENT HubDuino device on your hub will generate events that any App on the hub can subscribe to. There will not be any Child devices created.

Note: “held” events are not required, if your code does not differentiate between “pushed” and “held”.

Note: the syntax I mention above must be followed exactly as I have shown it. For additional button numbers, simply increment the numeric value. Since the MPR121 supports 12 inputs, simply use the values 1 through 12 as the “button” suffix. “button1 pushed” through “button12 pushed”, for example.

Mhhh... That means that sending events of the type [device name] pushed #, where device name is TouchSensor is definitely not working.

Then, if the things are like this, I'm almost finished with my project.
I'll try in the evening and I'll report here the results.