Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ECOWITT] rain start detection binary sensor support #125850

Open
luzik opened this issue Sep 12, 2024 · 19 comments
Open

[ECOWITT] rain start detection binary sensor support #125850

luzik opened this issue Sep 12, 2024 · 19 comments
Assignees

Comments

@luzik
Copy link

luzik commented Sep 12, 2024

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

@home-assistant
Copy link

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)

@damianbartos
Copy link

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

@run-mike
Copy link

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

@lionslair
Copy link

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
'''

@de-Techneut
Copy link

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

@martin-st-81
Copy link

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

@smuliv
Copy link

smuliv commented Sep 28, 2024

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
Copy link

smuliv commented Sep 28, 2024

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
+     ),
  }

@lionslair
Copy link

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

@smuliv
Copy link

smuliv commented Sep 28, 2024

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

@Oleg-Sob
Copy link

Oleg-Sob commented Oct 10, 2024

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'

@smuliv
Copy link

smuliv commented Oct 12, 2024

Still waiting for my fix in https://github.com/home-assistant-libs/aioecowitt to get reviewed.
home-assistant-libs/aioecowitt#203
home-assistant-libs/aioecowitt#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.

@MarcoZ76
Copy link

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

@de-Techneut
Copy link

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

@pashdown
Copy link

pashdown commented Nov 1, 2024

Just found this spamming my logs.

@nicholasmparker
Copy link

bump on this one

@smuliv
Copy link

smuliv commented Nov 4, 2024

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

@Presjar
Copy link

Presjar commented Nov 6, 2024

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

Nice work!

@DanGarion
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests