Homey Community Forum

HomeyDuino issues / failure

I have grown quite pleased for the Homeduino, it allows me to perform all the home automation functions that I cannot find else where. From garage door opener to security devices.
BUT, the app has bugs.
A HomeyDuino can only reside in the Homey for about 3 month, then the functionality is reduces, all triggers and capabilities stops working. The Actions still work.
Remedy is to remove the device in Homey, and add it again - then I get ~3 month more. Very annoying when I have 8-10 devices = then I have to reinstall the device every 2 weeks.

And the app has the install bug, that it installs all homeyduino device in the installation - not just the one selected.

Anyone else having this issue.

/Casper

hmmm I can’t relate. I have a couple of homeyduino projects, and they all still work.
Are you sure it’s an Homeyduino problem? Maybe it’s a variable that gets a overflow?
Do you use millis() to trigger a function without the use of delay?
Because there is a bug inside the “blink without delay” sample code:
if (currentMillis - previousMillis >= interval) {
If the millis() counter eventually gets overflowed, it starts from 0 and this routine stops executing.

Maybe add a watchdog?

I also use the unsigned long currentMillis = millis(); if(currentMillis - previousMillis > interval) { previousMillis = currentMillis; updateSensor(); }. Does this include the bug, hehe? Could you help out how to add the watchdog? I am just copy pasteing, but so far my Homeyduino projects have been stable.

Thanks, good feedback, I do use the millis, but I also have a watchdog in several projects - this was my own first bugfix.
If this was the bug, a reboot of the NodeMCU should fix it, but neither a reboot nor a reprogramming/reflash, will recover the issue. Neither a reboot of the Homey.
Only fix (that I have found) is to remove the device in homey, and add it again - and then fix all the broken flows.

FWIW, millis() overflows after about 49 days.

This is a common issue with the ESP8266. The timer has a limit of +/- 50 days (2^32 / 1000 / 3600 / 24 = 49.7). The ESP32 doesn’t have this limit.

This week I had three devices malfunctioning.
Devices can be controlled but status is not read back correctly.
Without touching the device, I removed the device in homey app, and added again, all devices functional again.
The issue cannot be the device code. With this behavior it must be the homey app.
Any ideas on how to debug

If it’s the app, debugging will be difficult. A common workaround for any app that’s misbehaving is to restart it periodically (like every night). You need to enable the “Power user” experiment for that (in the Homey app).

Yesterday all my Homeyduino devices lost their connection at once as well. When I restart the Homeyduino app they all show the red exclamation mark, but when I pull the plug of the different devices they start reporting again. However some of them autocalibrates the longer they are power supplied, so it is not the best solution…

For users that use the blink without delay method:
https://www.arduino.cc/en/tutorial/BlinkWithoutDelay
And want to fix the 49 day overflow problem… I always add these lines:

if (previousMillis > currentMillis){
  previousMillis = currentMillis;
}

If the millis() overflows, the currentMillis are lower than the previousMillis and it resets the previousMillis.

If you want in depth information about the watchdog, I strongly recommend you google for it. I believe there are two watchdogs, a software and a hardware build in. There are several articles that go way deeper than I can go. For really important electronic projects, I use a separate watchdog outside the microcontroller, to absolutely make sure the microcontroller gets reset if it crashes.

You can also use the onboard LED for debugging purposes. Just let it flash inside the important part of the code. Then you know if the microcontroller crashed if Homey does not respond to it. Or the problem might be somewhere else.

Like I said earlier, I have several Homeyduino projects (like automated curtains) that work for about 6 months now (non stop, no power loss I think)

But I don’t use blink without delay. My sensors are looping without any delays, but instead I am using thresholds when they should send values, eg when the CO2 ppm value is 100ppm higher than last sent value, and also a separate tft display which just updates values when it receives a value sent from Homey. However I am better in copy+pasteing than coding, and I am also using a CLI installed version of Homeyduino to be able to have some custom capabilities, so there are a lot of possible errors on my side, ha!

One thought about my connectivity issue yesterday is that (since all connections broke) something happened with my wifi, even though I didn’t notice anything. All my Homeyduino devices are based on the Arduino OTA code but shouldn’t there be something looping the wifi connection in the loop section? https://github.com/esp8266/Arduino/blob/master/libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino

No, but you can check if there’s still a connection:

void loop() {
  if (WiFi.status() != WL_CONNECTED) {
    ESP.restart();
    return;
  }
  …
}

I’m just restarting the module if it isn’t connected anymore, but you could also just reconnect.

1 Like

Would be nice if you could describe some of your projects a bit more somewhere, for inspiration! Have read about your bluetooth unlocking dashboard thing…

Have too few rooms to build another air quality monitor, hehe, and too many wemos for not starting another project.