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

Just use the wifi of your phone (with a fixed IP assigned by your router/dhcp server) to determine presence. I believe there is a IP ping app for HE that can be used to ping the fixed ip of your phone and report status.

You get better distance than ble and not need and additional hardware.

I experimented with an ESP32 using BLE for arrival/presence in my vehicle (using a BLE beacon) with Tasmota on the ESP32 instead of Hubduino and found the ble reliability at distance lacking. I was looking for distances over 30' though and even though BLE is purported to support greater distances it did not.

Now if your looking for indoor presence location in a particular location in a home BLE would definitely work better however you would need multiple ESP32's placed in specific locations and then compare the ble rssi of each esp32/ble to determine your approximate location.

1 Like

Yes, I am testing/playing with "IPhone WiFi Presence Sensor" driver (it works very well with my
Android phones) as we speak. It is very reliable but it is too slow. I leave in big apartment
complex. My phone(s) can connect to my WiFi router only when I an almost next to the
front door. It takes almost 2 min before phone is connected and driver reported "present".
This 2min delay drives my wife crazy and as a result this specific automation is no go.
I also experimented with Alexa and HE Geofencing. For some reason I could not make HE
Geofencing working no matter what I tried but Alexa Geofencing seems to be very reliable.
The problem with Geofencing is - I have to create relatively long (about 15-20min) time
window when door allowed to be opened. I have MS installed right near the front door
which will trigger Auto Unlock RM rule. This 20min window when door could be opened
by MS does look secure enough but this is a min required time for parking car and get into
the apartment complex.
So, I do have at least two working solutions but neither one is satisfactory.
WiFi Sensor is too slow, Geofencing in my case is insecure.

I red in many posts, BLE option could be faster vs WiFi but I did not tested it yet.
That is why I am willing to try how BLE will work.

If you can run an instance of Home Assistant, there is a simple integration to bring HA devices into Hubitat. That might be a pretty quick, simple test to see if BLE “presence” would even work for your requirements. My guess is that the WiFi solution will be similar in speed to connect, once in range. But WiFi should have a much longer range.

I am trying to avoid to introduce extra hw (rpi) and sw but maybe I will try.

I guess, I figured out what is wrong with WiFi.
Phone(s) itself connects relatively quickly. But driver reporting is very slow.
It looks like driver poling intrval is 1 min (not adjustable) and driver needs
to see few successful responses before reporting "present" state.
All this makes perfect sense but results in very long unacceptable delay.
BLE also may have the same problem. Let me see.

You could try tasker or macrodroid on the phone to trigger an action based on wifi connection, geofence, etc.

Might work better then pinging from hubitat since the app is on the phone itself. It should immediately detect the wifi connection.

1 Like

OK, I tested Android "Tasker" as a "WiFi Arrival Sensor".
This one is definitely faster vs "Phone WiFi Presence Sensor".
Let me see how this will work on a long run.

1 Like

Any plans to support ESP32-S2?
I recently started using this board for a soil moisture sensor because of its low power requirements in deep sleep, compared with the ESP32-S2.
It would seem to be a good platform for HubDuino sensors that just need to wake up once and a while and report values to the hub.
Some comparisons with ESP32 here:
ESP32-S2 vs ESP32 - IoT Assistant

I don’t have an ESP32-S2 to test with, unfortunately. Is it supported in the Arduino IDE line the original ESP32? If so, have you tried it? We’re there any errors?

Yes, it is supported in Arduino by the Expressif Systems v2.0.3 library.
I did receive errors when I tried to compile it when specifying the ESP32S2 Dev Module.

Just for fun, I decided to change it to the ESP32 Dev Module (non-S2) and get many of the same errors (see below).

  • What board library should I be using to successfully compile for a regular S2?
    I guess I should start by getting ESP32 to compile before worrying about the -S2.

Art

Arduino: 1.8.16 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None"











C:\Users\Art\Documents\Arduino\libraries\ST_Anything\Everything.cpp: In static member function 'static bool st::Everything::sendSmartStringNow(String&)':
C:\Users\Art\Documents\Arduino\libraries\ST_Anything\Everything.cpp:246:2: warning: no return statement in function returning non-void [-Wreturn-type]
  }
  ^
In file included from C:\Users\Art\Documents\Arduino\libraries\OneWire\OneWire.cpp:144:
C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h: In function 'void directModeInput(uint32_t)':
C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:141:26: error: 'rtc_gpio_desc' was not declared in this scope
         uint32_t rtc_reg(rtc_gpio_desc[pin].reg);
                          ^~~~~~~~~~~~~
C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:141:26: note: suggested alternative: 'rtc_io_desc'
         uint32_t rtc_reg(rtc_gpio_desc[pin].reg);
                          ^~~~~~~~~~~~~
                          rtc_io_desc
In file included from C:\Users\Art\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\cores\esp32/Arduino.h:36,
                 from C:\Users\Art\Documents\Arduino\libraries\OneWire\OneWire.cpp:142:
C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:158:38: error: 'esp32_gpioMux' was not declared in this scope
         ESP_REG(DR_REG_IO_MUX_BASE + esp32_gpioMux[pin].reg) = pinFunction;
                                      ^~~~~~~~~~~~~
C:\Users\Art\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\cores\esp32/esp32-hal.h:73:47: note: in definition of macro 'ESP_REG'
 #define ESP_REG(addr) *((volatile uint32_t *)(addr))
                                               ^~~~
In file included from C:\Users\Art\Documents\Arduino\libraries\OneWire\OneWire.cpp:144:
C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h: In function 'void directModeOutput(uint32_t)':
C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:169:26: error: 'rtc_gpio_desc' was not declared in this scope
         uint32_t rtc_reg(rtc_gpio_desc[pin].reg);
                          ^~~~~~~~~~~~~
C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:169:26: note: suggested alternative: 'rtc_io_desc'
         uint32_t rtc_reg(rtc_gpio_desc[pin].reg);
                          ^~~~~~~~~~~~~
                          rtc_io_desc
In file included from C:\Users\Art\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\cores\esp32/Arduino.h:36,
                 from C:\Users\Art\Documents\Arduino\libraries\OneWire\OneWire.cpp:142:
C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:186:38: error: 'esp32_gpioMux' was not declared in this scope
         ESP_REG(DR_REG_IO_MUX_BASE + esp32_gpioMux[pin].reg) = pinFunction;
                                      ^~~~~~~~~~~~~
C:\Users\Art\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\cores\esp32/esp32-hal.h:73:47: note: in definition of macro 'ESP_REG'
 #define ESP_REG(addr) *((volatile uint32_t *)(addr))
                                               ^~~~
Multiple libraries were found for "WiFi.h"
 Used: C:\Users\Art\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\WiFi
 Not used: C:\Users\Art\Documents\Arduino\libraries\WiFiNINA
 Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
exit status 1
Error compiling for board ESP32 Dev Module.


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Ahh, that makes sense.

From the ReadMe…

WARNING - If using an ESP32, make sure you are using v1.06 of the Arduino ESP32 Board manager along with Arduino IDE v1.8.16. Version 2.0.0+ of the ESP32 Board package for the Arduino IDE has made some significant breaking changes.

Looks like I’ll finally need to get sorted out in order to support newer ESP32 models. Not sure when exactly I’ll have time to work on it, though. :thinking: IIRC, it was not exactly a quick fix.

I rolled the esp32 board library back to v1.06 and, sure enough, it compiled fine when specifying the esp32 dev board. V2.0.3 is required for these esp32-s2 boards and the soil sensor functionality, however, so I'll have to give up on the idea of making them work with HubDuino for the time being. I do have a couple of the older versions based on the esp8266 so perhaps I work with those for now and put up with the lower resolution and higher current consumption.

Meanwhile, I have an ESP32-S2 DevKitM-1 that I'd be happy to donate to your porting efforts, whenever you get around to it.

Art

1 Like

OK,
I added to my setup Home Assistance running on RPI 3b (had few around).
Added MQTT Broker and Virtual Devices to the HA.
Programmed one of spare ESP32 with ESPresence project.
Today finally I got everything working.
Preliminary testing is very good.
Response for Arrival Detection is under 5 sec and so far very consistent.
Response from all other things I tried based on WiFi connection detection
(tasker on Android, IPhone Arrival Sensor on HE) is very slow and inconsistent.
Best result was around 40 sec and happens 1 out of 20 times.
All GPS related service in my case unacceptable because time between
sensor is activated and physical presence near door is around 15-20 min.
This is very unsecure. Plus in many cases me and my wife not even carrying
phones. With this setup all what I need - is a little BT Beacon devices on the
keychains.

Bottom line.
Finally I got what I wanted but this requires few extra components
(thanks, everything is local, no clouds) and relatively complex setup.
It will be very nice if you can add BT Beacon tracking to the Hubduino.
But of course, if this is not time prohibitive and you have some interest
in doing this.

1 Like

Art,

I have identified and corrected the source of the error you reported regarding the latest ESP32 v2.0.3 board manager. Please update your ST_Anything Arduino Libraries, specifically the "OneWire" library from my GitHub repository. This new version is a little bit experimental. It was modified by another user who is attempting to get the Author/Maintainer of OneWire to incorporate the changes to support the v2.0.3 ESP32 Arduino board manager.

Please give it a try and let me know how it goes. :sunglasses:

Thanks, Dan. I'm traveling right now but should be able to get to it by Tuesday or Wednesday.

1 Like

Shot in the dark here.

I have an esp based integration I found a tutorial on for our hot tub. I am running it through HA and using the device bridge app. I have it working but I also find it very cumbersome to have to one HA for one single device. I am confident that this app can be used to directly work with the hot tub. Issue is that I would need some help in modification to the code that is flashed to the esp.

I'm still receiving errors, Dan. Since my original post, I received a new computer, so I have a fresh install of Arduino and the ST_Anything libraries.

Here are the errors:

Arduino: 1.8.19 (Windows 10), Board: "ESP32S2 Dev Module, Disabled, Disabled, Disabled, UART0, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi), QIO, 80MHz, 4MB (32Mb), 921600, None"





















C:\Users\Art\Documents\Arduino\libraries\ST_Anything\Everything.cpp: In static member function 'static bool st::Everything::sendSmartStringNow(String&)':

C:\Users\Art\Documents\Arduino\libraries\ST_Anything\Everything.cpp:246:2: warning: no return statement in function returning non-void [-Wreturn-type]

  }

  ^

In file included from C:\Users\Art\Documents\Arduino\libraries\OneWire\OneWire.cpp:144:

C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h: In function 'void directModeInput(uint32_t)':

C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:141:26: error: 'rtc_gpio_desc' was not declared in this scope

         uint32_t rtc_reg(rtc_gpio_desc[pin].reg);

                          ^~~~~~~~~~~~~

C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:141:26: note: suggested alternative: 'rtc_io_desc'

         uint32_t rtc_reg(rtc_gpio_desc[pin].reg);

                          ^~~~~~~~~~~~~

                          rtc_io_desc

In file included from C:\Users\Art\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\cores\esp32/Arduino.h:36,

                 from C:\Users\Art\Documents\Arduino\libraries\OneWire\OneWire.cpp:142:

C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:158:38: error: 'esp32_gpioMux' was not declared in this scope

         ESP_REG(DR_REG_IO_MUX_BASE + esp32_gpioMux[pin].reg) = pinFunction;

                                      ^~~~~~~~~~~~~

C:\Users\Art\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\cores\esp32/esp32-hal.h:73:47: note: in definition of macro 'ESP_REG'

 #define ESP_REG(addr) *((volatile uint32_t *)(addr))

                                               ^~~~

In file included from C:\Users\Art\Documents\Arduino\libraries\OneWire\OneWire.cpp:144:

C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h: In function 'void directModeOutput(uint32_t)':

C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:169:26: error: 'rtc_gpio_desc' was not declared in this scope

         uint32_t rtc_reg(rtc_gpio_desc[pin].reg);

                          ^~~~~~~~~~~~~

C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:169:26: note: suggested alternative: 'rtc_io_desc'

         uint32_t rtc_reg(rtc_gpio_desc[pin].reg);

                          ^~~~~~~~~~~~~

                          rtc_io_desc

In file included from C:\Users\Art\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\cores\esp32/Arduino.h:36,

                 from C:\Users\Art\Documents\Arduino\libraries\OneWire\OneWire.cpp:142:

C:\Users\Art\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:186:38: error: 'esp32_gpioMux' was not declared in this scope

         ESP_REG(DR_REG_IO_MUX_BASE + esp32_gpioMux[pin].reg) = pinFunction;

                                      ^~~~~~~~~~~~~

C:\Users\Art\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\cores\esp32/esp32-hal.h:73:47: note: in definition of macro 'ESP_REG'

 #define ESP_REG(addr) *((volatile uint32_t *)(addr))

                                               ^~~~

Multiple libraries were found for "WiFi.h"

 Used: C:\Users\Art\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\WiFi

 Not used: C:\Users\Art\Documents\Arduino\libraries\WiFiNINA

 Not used: C:\Program Files (x86)\Arduino\libraries\WiFi

exit status 1

Error compiling for board ESP32S2 Dev Module.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

The errors appear to still be coming from the "OneWire" Arduino library. Are you 100% positive that you have downloaded the latest "OneWire" Arduino library from my GitHub repository? (Not the latest GitHub "Release", as that will not have this particular change, yet.)

You were right, Dan. I had downloaded the zip which must have been the release version of the library.
I used GitHub Desktop to clone the repository and replaced my OneWire library with that one and now have a clean compile. Thanks for taking care of this so quickly.

Now for the task of making this all work with my new soil moisture sensors!

Art

1 Like

After many years of being away from this I got Hubduino installed and working and integrated into my HousePanel - so super cool. Thanks @ogiewon Dan. Here’s a photo of my bread board integration. Will package it up later nice and tidy.

1 Like

Glad to hear! Have fun, Ken!