I’d really like to add plantlink integration into HA. PlantLink is a platform designed to monitor your indoor and outdoor plants and alert you when the plant needs water. It consists of 2 components. A sensor, that’s placed directly in the plants soil, that takes the readings, and a base station that takes those readings and transfers them to the plantlink servers/app. The devices communicate via zigbee radios, and are fairly easy to use and setup, and relatively low cost. Their website is here: http://myplantlink.com/
Plantlink offers an API to check the status of your plants, pull values, etc. I’ve successfully added plantlink to openhab via http, parsing the returned values via JSON, and in come cases converting the output to something usable. The API is documented here: https://market.mashape.com/danwiding/plantlink
I’m wondering if it would be possible to add a plantlink component to HA?
I’m not exactly sure how to go about this, or even where to start.
Any suggestions would be greatly appreciated.
This would be pretty cool, I have a Plantlink system that I have yet to tinker with. But alas, I don’t think that I can offer any help, coding is not my forte. I did see a few python modules on github that states that it can communicate with the hub.
I would also be interested in learning how you connected to OpenHAB. Any chances that you could show a few examples?
@berniebl If you wouldn’t mind, would you link the python modules here, so we have them?
The OH integration was a bit harry, but it worked. Basically I was polling the http api looking at a particular plant, then using JSONPATH to parse for a decimal/string. it got interesting when I tried to pull the “updated” & “water_needed” date & time, because they’re in epoch. So I had an automation rule fire that would convert the epoch to something I could work with.
If you look into the API documentation above, it’ll help you get your auth token. I then used Postman (chrome add-on) to pull the data from the API, and used that to build the above URL’s for each element. Figuring out the JSONPATH was a bit tricky, and honestly just involved a lot of trial and error. If you want the full example, including rules and everything let me know, I’ll toss it up on my site. (Rather not post it here, as it’s OH specific)
Thanks for the OpenHab examples, I may take you up on getting the entire set of rules etc. Do you know if everything would work with OpenHab 2? I am still undecided between Home Assistant and OpenHab at this time and also undecided between getting Plantlink going or trying the Xiaomi Plant sensors.
As far as Python libraries, I will list a few things that I found, again, since I am not a coder, I may think that it’s a library that can be used, but it may just be a single module, you may know better than I for these thing. Not all are from Github either.
Updated the Status value template, now it actually reads the plant status such as Too Dry, or Optimal, as opposed to 0…4.
Simple replace:
value_template: '{{ value_json.status }}'
With:
value_template: >
{% if value_json.status == 0 %}
Needs Water
{% elif value_json.status == 1 %}
Dry
{% elif value_json.status == 2 %}
Good
{% elif value_json.status == 3 %}
Good
{% elif value_json.status == 4 %}
Too Wet
{% else %}
value_json.status
{% endif %}
Please note; I haven’t been able to verify all the status codes, so if you get something other than Too Dry, Dry, Optimal, Wet, Too Wet, please let me know.
It’s been working great for the most part, there’s been a few instances where the plantlink dashboard API has been unavailable, but that’s pretty rare. To answer your question, yes, it’s pulling data from the cloud. As far as I can tell, there’s no way to poll data locally from the plantlink hub thing, but I haven’t had time to reverse engineer it yet.
Cool gonna try I bought like 20 of these things when they went on sale at Home Depot!
On smarthings they where using them direct connected to smarthings hub instead of the hub they come with. Maybe look at how they did that? I got a SamrtThings hub laying around here also so may just try that also.
Hey all just finally started using this myself are there any code updates to the rest sensor? I think maybe the status value isn’t right? Thanks for the write up as well it was very helpful to get things going.
Edit: it looks like value_json.status is now being sent back as a string so I just needed to wrap the numbers in quotes and its working. Thank you for the post and updates @xstrex! I wonder if we can maybe just add this to zha or deconz for local integration