rbaron / b-parasite

🌱💧 An open source DIY soil moisture sensor
1.84k stars 143 forks source link

Repeating measurement #181

Open Nerdboy2 opened 4 months ago

Nerdboy2 commented 4 months ago

Hello! I finally got my first stick up and running but it behaves a little weird I think. The last few days it seems to repeat the same values over and over again. This is the result in HA image

The voltage is stable at ~3.1V, I have not watered it, I have a polyurethane coating on it (Boat varnish) and I use the bparasite encoding and an ESP32 as a bridge.

Hope I got all the necessary information... Any clues what could cause this and what remedy there is?

rbaron commented 4 months ago

Hey @Nerdboy2,

From a quick glance my first theory is that the sensor is not transmitting a stale, static value, but the Home Assistant chart is displaying a straight line connecting the last transmitted value to now.

My guess is that the sensor stopped working, which can be for a number of reasons, depending on your setup. I would try: restarting the sensor; replacing the battery, re-pairing (if using zigbee).

If not, some questions:

Nerdboy2 commented 4 months ago

So far I only have this board up and running. It's the 1.2.0 version running the BLE sample with standard settings. I run the latest version of ESPHome and HA.

All values from the sensor is the same. However, I have a DHT sensor on the ESP32 running the bridge and that works fine, no issues what so ever.

The issue is resolved temporarily when I press the restart button on the ESP32. ie, the bridge starts sending the correct values again.

My first thought was a RAM-issue but then the DHT sensor should show the same behavior. So my current theory is some kind of problem with the ble_tracker in ESPHome.

So far I have found no pattern to this issue. It seems to happen at random.

Nerdboy2 commented 4 months ago

I left the log open for a while, then this just happened.

`

`

Any clue what to do with it? Caus I have no idea

rbaron commented 3 months ago

From the ESPHome logs you posted, it looks like the ESP32 is having issues with the ble scanner. There's a watchdog timer (ESPHome code here that reboots the whole ESP32 if the BLE scanner doesn't successfully restart. It's difficult to pin point a reason from a distance, but it could be hardware (e.g.: an old ESP32 board, or issues related to different variants) or software (scanner settings, too many BLE devices being scanned).

I would try to simplify the ESPHome setup to the bare minimum, with just the bluetooth_proxy and remove every other feature/sensor. I'd pay extra attention to keep the default BLE scanning window and interval, as running BLE and WiFi at the same time can get finicky.

As a second step I would get a different ESP32 board and re-run the simplified test setup. I myself am running a few ESP32-S3 boards around the house.

Nerdboy2 commented 3 months ago

Alright thanks, Ill try that!

I am aware this is not really related to the bparasite, but is it possible to have the ESP32 deliver the data through USB? My initial googling says no but I only found old threads on the HA forum.

rbaron commented 3 months ago

While testing I usually set the log level to DEBUG on the component I'm interested in. Then I see the messages via the USB-UART adapter. But I suspect that it won't help a lot in this case, since the issue seems to be in the BLE scanner. I think you'd see something similar to the log you posted above: ESP32 rebooting due to the watchdog triggering.