core icon indicating copy to clipboard operation
core copied to clipboard

[ECOWITT] rain start detection binary sensor support

Open luzik opened this issue 1 year ago • 12 comments

The problem

After upgrading Ecowitt gateway to GW2000A_V3.1.5, there is new sensor called 'srain_piezo' with values 0 and 1. Please make it available in this integration.

More information there: https://meshka.eu/Ecowitt/dokuwiki/doku.php?id=start#ws90_wittboy at the end of chapter.

What version of Home Assistant Core has the issue?

2024.9.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Ecowitt

Link to integration documentation on our website

https://www.home-assistant.io/integrations/ecowitt/

Diagnostics information

rain start detection the WS90 and WS85 now have a rain start detection (detection of first raindrops) implemented. The GW2000 is the first console where this feature is implemented with firmware 3.1.5 - other IoT-enabled consoles to follow.

in the customized server post string, the observation will show as srain_piezo it can have the stus “1” - raining or “0” - no rain status 1 will be reset to 0

  • once the top is dry
  • after the amount of water on the top has remained unchanged for two hours

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

luzik avatar Sep 12 '24 18:09 luzik

Hey there @pvizeli, mind taking a look at this issue as it has been labeled with an integration (ecowitt) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of ecowitt can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign ecowitt Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


ecowitt documentation ecowitt source (message by IssueLinks)

home-assistant[bot] avatar Sep 12 '24 18:09 home-assistant[bot]

Same issue, but in my case (Wittboy - WS90) I go additional "2" value for srain_piezo

logs:

2024-09-15 17:31:06.298 WARNING (MainThread) [aioecowitt.server] Unhandled sensor type srain_piezo value 2
2024-09-15 19:03:28.575 WARNING (MainThread) [aioecowitt.server] Unhandled sensor type srain_piezo value 0
2024-09-15 19:03:47.287 WARNING (MainThread) [aioecowitt.server] Unhandled sensor type srain_piezo value 0
2024-09-15 19:04:03.168 WARNING (MainThread) [aioecowitt.server] Unhandled sensor type srain_piezo value 1

damianbartos avatar Sep 15 '24 18:09 damianbartos

Hi!

I have been looking for the "srain" too. I found it in the raw data, that is listed in the "Download Diagnostics". So it is available to the integration. If somebody with the necessary skills could integrate this as a kind of sensor?

"data": { "device": { "name": "GW2000A_V3.1.5", "model": "GW2000A", "frequency": "868M", "version": "143" }, "raw": { "__type": "<class 'multidict._multidict.MultiDict'>", "repr": "<MultiDict('stationtype': 'GW2000A_V3.1.5', 'runtime': '789105', 'heap': '157496', 'dateutc': '2024-09-21 15:23:30', 'tempinf': '73.04', 'humidityin': '59', 'baromrelin': '30.262', 'baromabsin': '28.107', 'tempf': '72.86', 'humidity': '42', 'winddir': '338', 'windspeedmph': '2.24', 'windgustmph': '2.68', 'maxdailygust': '6.71', 'solarradiation': '124.38', 'uv': '0', 'rrain_piezo': '0.000', 'erain_piezo': '0.000', 'hrain_piezo': '0.000', 'drain_piezo': '0.000', 'wrain_piezo': '0.819', 'mrain_piezo': '3.295', 'yrain_piezo': '45.661', 'ws90cap_volt': '5.3', 'ws90_ver': '143', **'srain_piezo': '0'**, 'soilmoisture1': '32', 'soilad1': '185', 'soilmoisture2': '55', 'soilad2': '259', 'soilmoisture3': '40', 'soilad3': '218', 'soilmoisture4': '56', 'soilad4': '284', 'soilmoisture5': '60', 'soilad5': '286', 'soilmoisture6': '63', 'soilad6': '306', 'soilmoisture7': '50', 'soilad7': '248', 'soilmoisture8': '60', 'soilad8': '285', 'soilbatt1': '1.5', 'soilbatt2': '1.7', 'soilbatt3': '1.7', 'soilbatt4': '1.5', 'soilbatt5': '1.7', 'soilbatt6': '1.6', 'soilbatt7': '1.6', 'soilbatt8': '1.5', 'wh90batt': '2.88', 'freq': '868M', 'model': 'GW2000A', 'interval': '60')>" },

Mike

run-mike avatar Sep 21 '24 16:09 run-mike

I have this message in my logs

''' Logger: aioecowitt.server Source: components/ecowitt/init.py:30 First occurred: 7:11:47 AM (22 occurrences) Last logged: 7:33:08 AM

Unhandled sensor type srain_piezo value 0 '''

lionslair avatar Sep 23 '24 23:09 lionslair

Same here:

Logger: aioecowitt.server
Source: components/ecowitt/__init__.py:30
First occurred: 07:43:08 (653 occurrences)
Last logged: 18:46:00

Unhandled sensor type srain_piezo value 0
Unhandled sensor type srain_piezo value 1

de-Techneut avatar Sep 25 '24 16:09 de-Techneut

dürfte allgemein sein, kann man das bitte einbinden. Ist durch das letzte Wittboy WS90 Firmware Update 1.4.7 als Funktion hinzugekommen.

Logger: aioecowitt.server Quelle: components/ecowitt/init.py:30 Erstmals aufgetreten: 26. September 2024 um 08:50:50 (10390 Vorkommnisse) Zuletzt protokolliert: 16:35:45

Unhandled sensor type srain_piezo value 0 Unhandled sensor type srain_piezo value 1

martin-st-81 avatar Sep 27 '24 14:09 martin-st-81

Same here:

Logger: aioecowitt.server
Quelle: components/ecowitt/__init__.py:30
Erstmals aufgetreten: 03:09:38 (16 Vorkommnisse)
Zuletzt protokolliert: 03:11:53

Unhandled sensor type srain_piezo value 1

smuliv avatar Sep 28 '24 01:09 smuliv

if someone is interested in creating a pr here are the needed changes. i will post this also in https://github.com/home-assistant-libs/aioecowitt, because the lib needs some changes too.

in aioecowitt lib:

calc.py:

***************
*** 151,156 ****
--- 151,158 ----
      if "yrain_piezo" in data:
          data["yrain_piezo"] = float(data["yrain_piezo"])
          data["yrain_piezomm"] = round(data["yrain_piezo"] * in_mm, 1)
+     if "srain_piezo" in data:
+         data["srain_piezo"] = int(data["srain_piezo"])
  
      # Pressure
      if "baromrelin" in data:

sensor.py:

***************
*** 77,82 ****
--- 77,83 ----
      LUX = 28
      PERCENTAGE = 29
      SOIL_RAWADC = 30
+     RAIN_STATE = 31
  
  
  @dataclass
***************
*** 442,447 ****
--- 443,449 ----
      "yrain_piezo": EcoWittMapping(
          "Yearly Rain Rate Piezo", EcoWittSensorTypes.RAIN_COUNT_INCHES
      ),
+     "srain_piezo": EcoWittMapping("Rain State Piezo", EcoWittSensorTypes.RAIN_STATE),
      "rrain_piezomm": EcoWittMapping("Rain Rate Piezo", EcoWittSensorTypes.RAIN_RATE_MM),
      "erain_piezomm": EcoWittMapping(
          "Event Rain Rate Piezo", EcoWittSensorTypes.RAIN_COUNT_MM

in ecowitt integration:

binary_sensor.py:

***************
*** 26,31 ****
--- 26,34 ----
          device_class=BinarySensorDeviceClass.BATTERY,
          entity_category=EntityCategory.DIAGNOSTIC,
      ),
+     EcoWittSensorTypes.RAIN_STATE: BinarySensorEntityDescription(
+         key="RAIN_STATE", device_class=BinarySensorDeviceClass.MOISTURE
+     ),
  }

smuliv avatar Sep 28 '24 12:09 smuliv

if someone is interested in creating a pr here are the needed changes. i will post this also in https://github.com/home-assistant-libs/aioecowitt, because the lib needs some changes too.

in aioecowitt lib:

calc.py:

***************
*** 151,156 ****
--- 151,158 ----
      if "yrain_piezo" in data:
          data["yrain_piezo"] = float(data["yrain_piezo"])
          data["yrain_piezomm"] = round(data["yrain_piezo"] * in_mm, 1)
+     if "srain_piezo" in data:
+         data["srain_piezo"] = int(data["srain_piezo"])
  
      # Pressure
      if "baromrelin" in data:

sensor.py:

***************
*** 77,82 ****
--- 77,83 ----
      LUX = 28
      PERCENTAGE = 29
      SOIL_RAWADC = 30
+     RAIN_STATE = 31
  
  
  @dataclass
***************
*** 442,447 ****
--- 443,449 ----
      "yrain_piezo": EcoWittMapping(
          "Yearly Rain Rate Piezo", EcoWittSensorTypes.RAIN_COUNT_INCHES
      ),
+     "srain_piezo": EcoWittMapping("Rain State Piezo", EcoWittSensorTypes.RAIN_STATE),
      "rrain_piezomm": EcoWittMapping("Rain Rate Piezo", EcoWittSensorTypes.RAIN_RATE_MM),
      "erain_piezomm": EcoWittMapping(
          "Event Rain Rate Piezo", EcoWittSensorTypes.RAIN_COUNT_MM

in ecowitt integration:

binary_sensor.py:

***************
*** 26,31 ****
--- 26,34 ----
          device_class=BinarySensorDeviceClass.BATTERY,
          entity_category=EntityCategory.DIAGNOSTIC,
      ),
+     EcoWittSensorTypes.RAIN_STATE: BinarySensorEntityDescription(
+         key="RAIN_STATE", device_class=BinarySensorDeviceClass.MOISTURE
+     ),
  }

You make one you deserve the credit

lionslair avatar Sep 28 '24 16:09 lionslair

Did it. Now I have my first contribution. Feels good :) Let's hope it gets approved.

smuliv avatar Sep 28 '24 17:09 smuliv

Tell me when the srain_piezo sensor will be added to Core Home Assistant?

It keeps giving warnings 'Unhandled sensor type srain_piezo value 0'

Oleg-Sob avatar Oct 10 '24 10:10 Oleg-Sob

Still waiting for my fix in https://github.com/home-assistant-libs/aioecowitt to get reviewed. https://github.com/home-assistant-libs/aioecowitt/pull/203 https://github.com/home-assistant-libs/aioecowitt/pull/202

After that I will recreate the pull request for the integration to not get declined again because of the dependency.

No idea when that will be approved. You can use my code in the previous post and make a custom integration in the meantime like I did.

smuliv avatar Oct 12 '24 21:10 smuliv

if someone is interested in creating a pr here are the needed changes. i will post this also in https://github.com/home-assistant-libs/aioecowitt, because the lib needs some changes too.

in aioecowitt lib:

calc.py:

***************
*** 151,156 ****
--- 151,158 ----
      if "yrain_piezo" in data:
          data["yrain_piezo"] = float(data["yrain_piezo"])
          data["yrain_piezomm"] = round(data["yrain_piezo"] * in_mm, 1)
+     if "srain_piezo" in data:
+         data["srain_piezo"] = int(data["srain_piezo"])
  
      # Pressure
      if "baromrelin" in data:

sensor.py:

***************
*** 77,82 ****
--- 77,83 ----
      LUX = 28
      PERCENTAGE = 29
      SOIL_RAWADC = 30
+     RAIN_STATE = 31
  
  
  @dataclass
***************
*** 442,447 ****
--- 443,449 ----
      "yrain_piezo": EcoWittMapping(
          "Yearly Rain Rate Piezo", EcoWittSensorTypes.RAIN_COUNT_INCHES
      ),
+     "srain_piezo": EcoWittMapping("Rain State Piezo", EcoWittSensorTypes.RAIN_STATE),
      "rrain_piezomm": EcoWittMapping("Rain Rate Piezo", EcoWittSensorTypes.RAIN_RATE_MM),
      "erain_piezomm": EcoWittMapping(
          "Event Rain Rate Piezo", EcoWittSensorTypes.RAIN_COUNT_MM

in ecowitt integration:

binary_sensor.py:

***************
*** 26,31 ****
--- 26,34 ----
          device_class=BinarySensorDeviceClass.BATTERY,
          entity_category=EntityCategory.DIAGNOSTIC,
      ),
+     EcoWittSensorTypes.RAIN_STATE: BinarySensorEntityDescription(
+         key="RAIN_STATE", device_class=BinarySensorDeviceClass.MOISTURE
+     ),
  }

I have Home Assistant OS, where I can find the folder and the files to make the change? I can't find where is located. Can you help me? I'm using File Editor as editor in HA. Thanks in advance

MarcoZ76 avatar Oct 18 '24 19:10 MarcoZ76

Would like to know what the state is of this issue.

My log is still getting filled with this alarm.

Logger: aioecowitt.server
Source: components/ecowitt/__init__.py:30
First occurred: 14:52:58 (1448 occurrences)
Last logged: 14:52:58

Unhandled sensor type srain_piezo value 0

de-Techneut avatar Oct 30 '24 14:10 de-Techneut

Just found this spamming my logs.

pashdown avatar Nov 01 '24 00:11 pashdown

bump on this one

nicholasmparker avatar Nov 03 '24 04:11 nicholasmparker

As long as my pull requests https://github.com/home-assistant-libs/aioecowitt/pull/202 and https://github.com/home-assistant-libs/aioecowitt/pull/203 have not been approved and merged, I cannot resubmit this pull request as it will be rejected again.

smuliv avatar Nov 04 '24 18:11 smuliv

Hopefully the powers that be will get around to merging your PR soon!

Nice work!

Presjar avatar Nov 06 '24 05:11 Presjar

Thanks for reporting the issue and thanks to the person that put in the PR. Now people just need to chill while we wait.

DanGarion avatar Nov 15 '24 00:11 DanGarion

Bump

MikeBP13 avatar Dec 02 '24 16:12 MikeBP13

Another bump. Still isn't fixed on 2024.12.2.

de-Techneut avatar Dec 10 '24 22:12 de-Techneut

Too late for Christmas, but maybe we'll get a fix still this year? :) would be very thankful!

0BanZai0 avatar Dec 26 '24 14:12 0BanZai0

If you just want to remove the logentries from the Home Assistant log, you can add the following to configuration.yaml

logger:
  filters:
    aioecowitt.server:
      - "Unhandled sensor type srain_piezo value"

janchrillesen avatar Dec 27 '24 10:12 janchrillesen

rather it is about implementing additional functionality than hiding log entries :)

opensource4life avatar Dec 27 '24 10:12 opensource4life

I am really looking forward to rain start detection field.... Just got an ecowit as a xmas present, and wanting to send notifications of when rain starts and ends (WAF - Make sure the washing is not on the outside line - lol). This field would make the automation so much simpler, as the embedded firmware will take care of the logic - like it turns to no rain after 2 hours automatically without rain or when the sensor is dry... It is really a critical field on a weather station... Any chance of getting this merge done soon - great work by others in bringing the field to home assistant... Now we want to use it !!!!

kchambersoz avatar Dec 30 '24 21:12 kchambersoz

Nothing changed in the latest update.

CMDR-Sloma avatar Jan 04 '25 11:01 CMDR-Sloma

still getting the warning too

zipzagster avatar Jan 07 '25 00:01 zipzagster

@pvizeli can you take a look on it and merge it ?

NimlothPL avatar Jan 07 '25 12:01 NimlothPL

Still waiting - it appears code was graciously fixed almost 4 months ago - but nothing since... Several requests for @pvizeli to look at it and merge - no response... no updates... @homeassistant how can we escalate or have someone look at it please....

Or do we just go and take this code private to another library so it can be used....

How do we progress this? Any chanch @frenck could help since I have seen he has recently commented on other bugs with ecowit ?

kchambersoz avatar Jan 20 '25 22:01 kchambersoz

Please still the same :-(

Image

JanKraslice avatar Jan 23 '25 20:01 JanKraslice