[Custom Component] GreenSens plant sensor component

A while ago I got some plant sensors and a hub from a kickstarter project. They are called GreenSens.
The creators have now documented the api for this and I wrote a python library and a custom component for this.

I am not an expert, just a hobbyist and both projects leave some room for improvement, but I figured there might be people who are looking for this.

Python library: pygreensens
Custom component: HA Greensens

Feel free to comment on this or improve the code yourself!

My apologies… there is still one thing I have to fix: the sensor only update at boot…
I am working on it and hopefully I can fix this soon.

UPDATE: Current version on Github is working. I also added a bit more functionality and configuration options. For now I incorporated the python lib for the api, to make it a bit easier. I know this isn’t the best practice and I will change this in the next version.

The python library that I linked in my original post, is working, but had a few design flaws that made it difficult to use in HA. The new one I wrote does not have this issue and will soon be available on Pypi.
Python library has been fixed. In the next update of the custom component, I will make use of the python library, instead of adding the code in the component itself.

1 Like

Interesting plant sensor. How it is communicating? Over WiFi? Do I need that usb dongle?

@caear1987 The sensors send an RF 433mhz signal to the dongle. The dongle keeps connection to the cloud. The sensors run on solar, so the one important thing with these sensors is the amount of daylight they get. As far as I can tell, my sensors send their status once per hour on regular days. On dark days, this might be less.

In theory, you could do without the dongle, if you have an alternative RF receiver and manage to decode the RF message (which I partially did before the API was public), but this will take some time and effort.

1 Like

Hi @pijiulaoshi, may I ask you to explain how to integrate the custom component to my home assistant? I am new in that topic and would really appreciate to get my greensens senor running :slightly_smiling_face:
At the moment I only used add-ons…would be the first time to add a custom component for me…
Thanks in advance!

Hi @jjurrpf, there are two ways (that I know of).
If you are planning on using more custom integrations, I would suggest installing HACS (HACS Website)

If you just want to use this one:

  • create a folder in your config folder, named custom_components
  • download the files from github
  • place the contents of the custom_components folder from github in your own custom_components folder
  • setup the integration in your configuration.yaml (you will have to restart before everything works)

I tried to find a more elaborate post on this, but I couldn’t find much. This page may give you som info on installing components, if my explanation was not clear enough :slight_smile: example of custom_component install

Let me know if you get it working!

Thanks a lot for the help.
What I already did is to add the custom component (GitHub - pijiulaoshi/ha_greensens: Custom component for Home Assistant that gets plant sensor data for GreenSens plant sensors)
via HACS to my installation.
Is there something I have to do with the python script as well?
I think I need some help when it comes to the configuration.yaml and the mentioned configuration:

greensens:
username: (req) [greensens username]
password: (req) [greensens password]
add_main_sensor: (optional, boolean, default = True) [Sets up a main sensor with all data per sensor]
name_language: (optional, default = “LA”, options = “LA”, “EN”, “DE”) [ sets plant name language]
monitored_conditions: (optional, default = all see below) [sets up a sensor per plant per condition]
- temperature
- moisture
- illumination

Where I have to add this part and could you give me an example filling in the needed data (dummy data)?

Thanks again for your help!

Hi again,
first of all thanks a lot - it is running :slight_smile:
Perhaps - if it is an easy one - is it possible to change the status (1,2,3) to some more meaningful (perfect, ok, bad) and to change the color related to the status?
Furthermore there is already a nice flower as picture - how to change the picture?

Again - thanks a lot for your help and your effort!

Hi @jjurrpf,

Good to hear it’s working for you. I have thought about doing this before, but so far I have not been able to get my sensors to all possible states :smiley: I tried too much and too little water, etc… the only thing that is hard for me to change, is the amount of sunlight. Therefore, I have not been able to match the numbers to a status message. (if you have that info, feel free to share it or make a PR on github with a fix to my code)

As for changing the icon color: So far I have not been able to do this at a integration level. I have managed to do this in my own Home Assistant, by using customizations and Custom UI (Custom UI - icon color change)

If I find the necessary info and the ways to add your requests, I will. However, for now I don’t think I am able to.

I forgot to answer one of your questions. If you want to change icons of entities, have a look at customizations.

Hi i am struggling to get this in hassio. I have downloaded and copied files in custom_components. But still not able to install the integration. I don’t know what i am missing. I am running hassio and hacs.
Can you point me in the good direction pls?

Thanks

Hi @Houtje76 are you trying this through te UI or with config.yaml? I haven’t created an option for UI yet, so you will have to do this by using the configuration.yaml file.

I haven’t been very active in terms of maintaining this integration because I recently moved and haven’t unpacked my sensors. So it may also have issues with the most recent updates of home-assistant. (Up until November 2021 the integration still worked)

Thank you very much for your reply.
I discovered that there was no install by ui. Did it by config and now the entitys are in my hassio.
I am not a programmer otherwise i would help you to improve the integration.

I hope you pic it up when you are settled and maybe finetune the integration.

T. I. A.

I am glad it worked out for you. Even though you are not a programmer, feel free to give feedback or report problems!