-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Moisture sensor HG9901 - Rebranded from Amazon #3190
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
Comments
Some more infos:
According to the monitor: Sensor 2: (cff9) Sensor 1: (80d6) Sensor 2: (cff9) I think the last info missing is the "f" , the "light" part and the final "07". I don't have a clue what those are and how the light is calculated. But we are close to fully decode the sensor |
Hey, So the display also show battery level and signal strength. It might be that the "f" could indicate the battery level. Additional note: The sensors will only send data if the sensor register a change in values. It is not time based but status based BR |
Copy some decoder as template, change it (at least the r_device name), edit include/rtl_433_devices.h, add your files with git (no need to commit yet), run There is now also https://triq.org/rtl_433/CONTRIBUTING.html#adding-a-new-decoder |
Hey, I just found out in Reddit. Some people are also working on it but the Moisture sensor is called differently. At the end it is still a HG9901: https://www.reddit.com/r/RTLSDR/comments/1ce3fef/anyone_played_with_decoding_bigtride_soil_sensors/ But I was right with my research. Good Thing, I could practice again how to decode a sensor :D BR |
Always a good puzzle and nice to have independent confirmation. |
@zuckschwerdt could you please help again. I'm don't know C at all. I finish to edit a hg9901.c file. When I add it to the rtl_433_devices.h. I get the following error when i try to compile: My rtl_433_devices.h looks like that:
|
Did you run |
So I have the code ready but, I fail currently to use the ./maintainer_update.py
|
I did follow the manual: There is now also https://triq.org/rtl_433/CONTRIBUTING.html#adding-a-new-decoder I'm stuck at this point of the tutorial after adding the git add command. Maintainer is complaining Add your files with Git (no need to commit yet)
What did I do wrong ?
Still get compile errors. |
You need to re-add with |
Oh and |
@zuckschwerdt thank you I did manage to compile it !! Now I can improve the code |
Thank you again for your patience !! |
:( my sensor code is not working. So transition from found encoding to getting it seen by rtl_433 by the decoder |
Someone with better coding experience could take a look. I'm having some issues. Please see below my current code.
|
Maybe add |
Hey just checked,
So baby steps. But still can show the normal way RTL_433 normally shows it with the decoding of the infos |
I have my first version working !!! Still open points:
|
Fixed that issue. Last challenge the battery
|
Hey again, So I can read my both sensors but according to my readings my soil is boiling :D. I need to see how to fix it. 0x84 ==> -4°C. And Battery part still looks fishy from the data. .
|
Bit 8 must indicate negative values somehow. You need to log the real temp and the hex values so we can figure out the encoding. |
Thanks for the feedback, I got the following numbers: 00 ==> 0 aa55 cff9 3d 82 f 60 00 Preamble: aa55 And Battery part seems off. It might battery % |
@inonoob : yes your temp is signed value by the first bit. Add this 2 lines before the data_make :
|
Just mask out bit 8 and if set multiply the rest with -1. |
The latest version:
|
Hey all, so code is running ! But I'm not sure about the battery support. For the presume battery status I did see the following numbers: 0x3, 0x7, 0xb, 0xf. It could be the percentage of the battery. I also need to see if my code is working for temps under 0°C. I hope this night it get cold enough ! As soon as I'm ready, I need to check ask @zuckschwerdt how to push my code to the repo. Proof:
I also check against the display the classification for the light intensity. My current values. 60 NOR_ Fully working code if someone wants to try:
|
Hey all, I have my latest version done for release! @zuckschwerdt please see attached my hg9901.c . You can integrate it to the main code if you want. Current output example of the current code.
Proof:
For the Light Intensity topic: This table was proposed by Chatgpt but I don't think it is correct. LOW-: 0 - 10 |
@inonoob : About Light Intensity. may I propose to convert to LUX, values as per the user guide, the range is from 0 to 15000LUX
|
@ProfBoc75 thank you for finding the last piece of puzzle. we could add even Lux and the Light level. Now it must be translated to code :D |
Here might be the working code:
|
I need to test it tomorrow. I don't have the rtl sdr with me. |
@inonoob : more simple, for all values int lux = light_intensity * 100 Then the 9 tests to set the light level. In result (data_make) keep only lux and light_level (remove light intensity) |
like this
|
I'm not too good in C : char *light_level = "UNKNOWN"; const char *light_level = "UNKNOWN"; Which one should I use ? |
We don't really want that "light level" string. Other devices don't have that and it can easily be added for all light sensors with the hass script or something. I'll now change |
Ok cool then I would say sensor fully defined :). Case closed. Thanks for the support and again patience. I learned a lot again |
Another approach, just to get values as close as the sensor display (but agree with you, can be done externally) :
...
or only level value without text:
|
From a home assistant point of view it might be easier with the idea from @ProfBoc75 ? |
What is the connection between light_level and light_intensity? Is it some (linear) computed value or something like a UV index? |
Hey @zuckschwerdt As of now the sensor only transmit the values in hex and represent the lux level from 0 to 15000. The classification is only done on the display. Question here is if RTL_433 should provide this classification or just provide the "raw" lux value as INT. If only raw value is given then in home assistant the classification from lux to low, nor and high needs to be done with the example above. Or Classification is done via 0 to 8 and in home assistant only 0 equals Low- ; 1= low ; 2 = low+ ;.... @zuckschwerdt from your experience what would you prefer or is your guidance? To stick with the philosophy of rtl_433 less calculations is more ? I'm fine with both ways and will adapte in home assistant. |
@inonoob : The purpose of rtl_433 is to get data and presents them with as less as possible modification, but to be as much as possible aligned with what is on the sensor display, and at least scaled when conversion and unit are known. For a weather station, the light value in Lux is the expected information that we want and nothing else from this value.
...the light is required by the plants, so based on the light intensity, they divided it into 9 levels, the 3 firsts are not enough for the plants (LOW), the 3 last levels are too much (HIGH), and the 3 in the middle (NORMAL) are the expected level of light for the plants. This level of light is only for this purpose / use case, and shown on the sensor's display. We know how to get / define levels, so, it could be nice to have at rtl_433, the 9 words or the 9 values, that could trigger a light ON if Low Light for example, but yes, this can be done by HA or any smart home automation solution. FYI, extract of the user guide: |
The background is, I did that for my wife and challenge to bring it to rtl_433 ;). I want to create a dashboard in HA with the same details as shown on the external display. For me sort of you have the same info on the display and HA. Different source to display information but same content. Lux is now nice to have as addition but I wanted to avoid the topic why is there Lux and there low, nor and high. But HA has a good plant add-on https://github.com/Olen/homeassistant-plant Which works with lux. It depend on the user requirements. |
@inonoob , @zuckschwerdt : In conclusion from my side, the decoding should stay at rtl_433 level providing standardized values (understandable by smart home automation, like HA / Domoticz / ... ), and yes, the final presentation is at HA level, which is much more powerful, flexible, can be customized, and so on. |
Hey all, I now have it reporting over MQTT in HA but the values get overwritten. So the ID and the values.
MQTT topic: rtl_433/rtl433serverpi/devices/HG9901 It should look like this: MQTT topic: rtl_433/rtl433serverpi/devices/HG9901/53241 Is it because it is not defined as ID ?
|
I can confirm. I did recompile with the change and it is working now. we need to rename from sensor_id to id:
|
As I see it the display is the true representation. Unless values are cumulative we should present all the parameters the display provides. If there are more details to show we can do that also. So in this case we should output the lux and the 9 different light intensity strings. For normalized data the strings are ignored and the lux value is used. |
If the light text strings are critical to the sensor then I agree, we should output that. I'm not sure if there is a simple lux to light level mapping? The light level is indicated with a nibble. Can you capture that (int) value together with the lux (int) value and plot a graph over a day-night cycle (for a wide range as possible)? The idea is then to either also output the light level as number, for graphing, or to just use them for the text as graphing lux is all anybody would ever need. |
Hey all, Here is an example of HA how it currently look likes: You can see the text and the LUX level as plot. Lux has an official unit "lx". For the light level there is non. For me the Mapping and Lux level is ok. Here is my MQTT extract. I did use my code with all the available information:
|
I also own this moisture sensor. It is very interesting because the sensor is very cheap and has a very strong signal (compared to other more expensive moisture sensors). In Germany it is also sold under the brand "dr meter", see Probably for some people it might be interesting how the sensor looks like without chassis: I would appreciate it a lot if you add it to the main branch. |
thx inonoob, good work, and a usefull device not only for gardener.. thx Tuxyso: i ordered it an hour ago, for my wife.. 26.99 Euro , we will see.. |
@inonoob - thanks for the work on this! I've been trying to get it working locally. But to no avail :/
I assume
means its found something? Or does this mean it is just checking for the correct sensor. I'm not seeing any results though. I believe I've pulled your latest code, but I have also ran the code from the branch in #3194 |
Uh oh!
There was an error while loading. Please reload this page.
Dear all,
I have a new challenge. I recently bought some sensors for checking the moisture and temperature of the garden.
I bought a rebranded version from amazon but with the FCCid, I could find the real supplier.
https://fccid.io/2AAXF-HG9901
https://www.amazon.de/dp/B0CRKN18C9
Sensor has the following data which is tracked:
It is working on the 433Mhz range. I manage to get a capture of the signal and could create a decoder:
rtl_433 -t biastee -X 'n=name,m=OOK_PWM,s=600,l=1392,r=3808,g=1056,t=318,y=0, preamble=55aa'
I use a RTL_SDR version 4 with an adapter therefore I had the biastee activated.
signal.zip
With the data and my past experience, my feeling say the 55aa needs to be inverted and is the preamble. I tried bitbench but I'm not yet there.
Does anyone have a better idea how to decode. I wasn't sure about the 8 at the end if it is CRC ?
I already had some signal dumps:
Many thanks for the support. This is only the second sensor I try to decode.
best regards
The text was updated successfully, but these errors were encountered: