Plant sensor

Hi, is there anyone that knows if it is possible to bind Ventus plant sensor to Openhab? They are way cheaper then the koubachi sensors, so then it is possible to get several of them.
They uses 433MHz RF signals, what dongle do I need to fetch the signals?

1 Like

I only spent the briefest of time looking but my first impression would be no, you cannot interface these senors with OH without a whole lot of work on your part. This vendor is not listed as supported by the RFXCOM binding which appears to be the binding for these sorts of devices.

Getting a USB dongle to send/receive on 433MHz only gives you half of the solution. You also need to know what messages to send and receive and in what formats. From what I could tell in my brief looking these sensors do not have a published messaging API so you will have to reverse engineer the messages. This is not a small effort.

Assuming that you did manage to reverse engineer the message protocol you would then either use the Serial binding to communicate with a USB 433MHz transceiver, update the RFXCOM binding, or have to write a new binding to support the new protocol.

But I didn’t spend much time searching on this. Someone more knowledgeable might prove me wrong.

Another option is to use the electronics directly but put in an esp8266 as the brain.

This one is cheaper then koubachi but still 4x the ventus one…

So finally I got a round to work on my plant project:)

So a while back I backed WIO Link on kickstarter. So I took this shield hooked up a pump true a groove relay a groove moisture sensor and got it up running with ifttt.

So thats all fine, however I would like to add it to openhab. I can do this in various way, ifttt,https, curl . I think https is the easiest and best right?

So I start with defining a number for the moisture level:

Number plant1Moisture "Moisture [%1I]" <moisture> (groupPlant) { http="<[https://iot.seeed.cc/v1/node/GroveMoistureA0/moisture?access_token=30f76b7aac3eb14a6993c1f9dbadd0d1]" }

the call returns : {“moisture”: 720} where number is any value between 0 and 1023

So my questions are:

How do I get the number correctly in to the numberItem.

How often will the number be updated?

How can i display the number in my sitemap as:To wet, Moist and dry ?

and then I need to create rule if the moisture level is to low then send

https://iot.seeed.cc/v1/node/GroveRelayD0/onoff/[on]?access_token=30f76b7aac3eb14a6993c1f9dbadd0 to start the pump. Leave the pump on for 5s then switch it off and check the moisture level again after 15min or so, when the water has spread in the soil.

Any help will be highly appreciated.

The value returned is JSON. If it is always just the one value you can probably get away with just using a regular expression:

REGEX(.*\"moisture\"\:[\s]+([\d]+).*)

which will extract one or more digits which follow '“moisture”: '.

If the returned values can be more complex JSON it might be worth setting up a rule to parse the JSON and extract the value and/or extract multiple values and populate a bunch of Items based on one request.

You can also do a JSON parse and extraction using the JavaScript Transform as documented on the HTTP binding’s wiki page.

Per the HTTP binding wiki page:

By default, the binding checks once every second (1000 milliseconds) to see if any bound items should be retrieved.

The easiest would probably be a proxy Item and a rule to convert a range of values into the indicated String.

val DateTime pumpOn = null

rule "Turn on pump"
when
    Item plant1Moisture changed
then
    if((plant1Moisture.state as DecimalType) < 50 && (pumpOn == null || pumpOn.isBefore(now.minusMinutes(15)) {
        sendHttpGetRequest("https://iot.seeed.cc/v1/node/GroveRelayD0/onoff/[on]?access_token=30f76b7aac3eb14a6993c1f9dbadd0")
        Thread::sleep(5000)
        sendHttpGetRequest("https://iot.seeed.cc/v1/node/GroveRelayD0/onoff/[off]?access_token=30f76b7aac3eb14a6993c1f9dbadd0")
        pumpOn = now
    }
end

Theory of operation:

The rule triggers when the moisture level changes. If the reading is too low and it has been at least 15 minutes since we last turned on the pump, turn it on, wait five seconds, then turn is off.

Thanks, I am working on it now.

my plant.items file now looki like this:

Number Plant_Moisture "Moisture" <humidity> (Group_Plant) {http="<[https://iot.seeed.cc/v1/node/GroveMoistureA0/moisture?access_token=30f76b7aac3eb14a6993c1f9dbadd0d1:60000:REGEX(.*\"moisture\"\:[\s]+([\d]+).*)]" }

However the file will not load into the designer:

Any idea what I can do to be able to use the designer?

hmm
My log file spits out:

18:20:02.370 [INFO ] [c.internal.ModelRepositoryImpl:98   ] - Refreshing model 'plant.items'
18:20:02.379 [DEBUG] [i.internal.GenericItemProvider:154  ] - Processing binding configs for items from model 'plant.items'
18:20:02.381 [WARN ] [h.i.HttpGenericBindingProvider:105  ] - bindingConfig is NULL (item=Plant_Moisture (Type=NumberItem, State=Uninitialized)) -> process bindingConfig aborted!
18:20:02.383 [DEBUG] [i.internal.GenericItemProvider:419  ] - Couldn't find ItemFactory for item 'null' of type 's'
18:20:02.385 [DEBUG] [i.internal.GenericItemProvider:419  ] - Couldn't find ItemFactory for item 'null' of type 'd'

I did install the http binding and added to my sitemap as follow:

Frame label="Plants" {
		Text item=Plant_Moisture icon="humidity"
	}

Where the plant Item is:

Number Plant_Moisture "Moisture [%d %%]" <humidity> (Group_Plant) {http="<[https://iot.seeed.cc/v1/node/GroveMoistureA0/moisture?access_token=30f76b7aac3eb14a6993c1f9dbadd0d1:1000:REGEX(.*\"moisture\"\:[\s]+([\d]+).*)]" }

It looks like there might be a syntax error of some sort in that Items file. There is nothing obvious in your pasted in code but that is the first thing I would check.

Try commenting the Item out and gradually adding in parts until the error reappears.

after rebooting a few times the plant.items file finally got loaded into the designer… So the regex you provided has some error mistakes in it. So I figured out i rather start to try get the whole string out.

To do so i have a few question.

can I just define a string item like this:

String Plant_Moisture "Moisture" <humidity> (Group_Plant) {http="<[https://iot.seeed.cc/v1/node/GroveMoistureA0/moisture?access_token=30f76b7aac3eb14a6993c1f9dbadd0d1]"}

How can I add it to my sitemap, or preferably how can I debug it? Like

Serial.println(Plant?Moisture);

When I did so I get these error messages:

 Binding configuration of type 'http' of item ‘Plant_Moisture‘ could not be parsed correctly.
org.openhab.model.item.binding.BindingConfigParseException: bindingConfig 'https://iot.seeed.cc/v1/node/GroveMoistureA0/moisture?access_token=30f76b7aac3eb14a6993c1f9dbadd0d1' doesn't represent a valid in-binding-configuration. A valid configuration is matched by the RegExp '(.*?)(\{.*\})?:(?!//)(\d*):(.*)'
        at org.openhab.binding.http.internal.HttpGenericBindingProvider.parseInBindingConfig(HttpGenericBindingProvider.java:171) ~[na:na]
        at org.openhab.binding.http.internal.HttpGenericBindingProvider.parseBindingConfig(HttpGenericBindingProvider.java:136) ~[na:na]
        at org.openhab.binding.http.internal.HttpGenericBindingProvider.processBindingConfiguration(HttpGenericBindingProvider.java:101) ~[na:na]
        at org.openhab.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:348) [org.openhab.model.item_1.8.0.jar:na]
        at org.openhab.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:324) [org.openhab.model.item_1.8.0.jar:na]
        at org.openhab.model.item.internal.GenericItemProvider.processBindingConfigsFromModel(GenericItemProvider.java:171) [org.openhab.model.item_1.8.0.jar:na]
        at org.openhab.model.item.internal.GenericItemProvider.modelChanged(GenericItemProvider.java:390) [org.openhab.model.item_1.8.0.jar:na]
        at org.openhab.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:159) [org.openhab.model.core_1.8.0.jar:na]
        at org.openhab.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:100) [org.openhab.model.core_1.8.0.jar:na]
        at org.openhab.model.core.internal.folder.FolderObserver.checkFolder(FolderObserver.java:142) [org.openhab.model.core_1.8.0.jar:na]
        at org.openhab.model.core.internal.folder.FolderObserver.run(FolderObserver.java:99) [org.openhab.model.core_1.8.0.jar:na]

Today I came across a better looking device then my homemade sensor:
http://www.gearbest.com/other-garden-supplies/pp_373947.html

So I will keep you guys posted on this sensor as soon as I get it.

I’ve gotten a couple of these working.

My setup is the following:

  • Rpi1 with Raspian Jessie and Bluetooth dongle
  • I run a script every hour to check the status
  • I send data to Openhab using mqtt

I use this script for firmware 2.6.6 to be able to read values:

Running the supplied demo I will get this output:

pi@colibri:~/miflora $ python3 demo.py 
Getting data from Mi Flora
FW: 2.6.6
Name: Flower care
Temperature: 21.8
Moisture: 56
Light: 73
Conductivity: 2822
Battery: 100

I will order more sensor right away, seems to me you get quite much for 11$.

I will use my Rpi1 with bluetooth dongle to detect presence as well see @rlkoshak post about presence.

Regards, S

Sweet, Mine still hasn’t arrived!! Its been 22days now, where did you order yours?

Hi!

Ordered them in the 27th of october and they were delivered to Sweden on November 14.
https://m.aliexpress.com/item/32695192704.html

Regards s

I just ordered another 3, from your link. Hopefully I can monitor my Christmas tree:) Can you also show your items and rules files? Maybe we can make a binding out of it.

I’ve not come that far yet.
I only have 2 plants hooked up at the moment.
PlantBenji (Benjamin Ficus) and PlantPiff (Helix)

Items


Group Plants
Group PlantTemperature
Group PlantMoisture
Group PlantLight
Group PlantConductivity
Group PlantBattery

Group    PlantBenji             "Plant Benji"               <plant>        (Plants)
Number   PlantBenjiTemperature  "Benji [%.2f °C]"           <temperature>  (Temperature, PlantTemperature, gHistory, PlantBenji) { mqtt="<[mosquitto:plants/benji/temp:state:default]" }
Number   PlantBenjiMoisture     "Benji [%d %%]"             <moisture>     (PlantMoisture, gHistory, PlantBenji)     { mqtt="<[mosquitto:plants/benji/moist:state:default]" }
Number   PlantBenjiLight        "Benji [%d Lux]"            <sun>          (PlantLight, gHistory, PlantBenji)        { mqtt="<[mosquitto:plants/benji/light:state:default]" }
Number   PlantBenjiConductivity "Benji [%d uS/cm]"          <conductivity> (PlantConductivity, gHistory, PlantBenji) { mqtt="<[mosquitto:plants/benji/fert:state:default]" }   
Number   PlantBenjiBattery      "Benji [%d %%]"             <battery>      (PlantBattery, Battery, PlantBenji)       { mqtt="<[mosquitto:plants/benji/battery:state:default]" }
DateTime PlantBenjiLastUpdate   "[%1$tm/%1$td %1$tH:%1$tM]" <clock>        (PlantLastUpdate, PlantBenji)

Group    PlantPiff             "Plant Piff"                 <plant>        (Plants)
Number   PlantPiffTemperature  "Piff [%.2f °C]"             <temperature>  (Temperature, PlantTemperature, gHistory, PlantPiff) { mqtt="<[mosquitto:plants/piff/temp:state:default]" }
Number   PlantPiffMoisture     "Piff [%d %%]"               <moisture>     (PlantMoisture, gHistory, PlantPiff)     { mqtt="<[mosquitto:plants/piff/moist:state:default]" }
Number   PlantPiffLight        "Piff [%d Lux]"              <sun>          (PlantLight, gHistory, PlantPiff)        { mqtt="<[mosquitto:plants/piff/light:state:default]" }
Number   PlantPiffConductivity "Piff [%d uS/cm]"            <conductivity> (PlantConductivity, gHistory, PlantPiff) { mqtt="<[mosquitto:plants/piff/fert:state:default]" }   
Number   PlantPiffBattery      "Piff [%d %%]"               <battery>      (PlantBattery, Battery, PlantPiff)       { mqtt="<[mosquitto:plants/piff/battery:state:default]" }
DateTime PlantPiffLastUpdate   "[%1$tm/%1$td %1$tH:%1$tM]"  <clock>        (PlantLastUpdate, PlantPiff)

Rules:

import java.util.Date
val String LOG_BENJI = "PlantBenji"
val String LOG_PIFF = "PlantPiff"

rule "UpdateTimestampBenji"
when
  Item PlantBenji received update
then
  logInfo(LOG_BENJI, "Updating timestamp for PlantBenji")
  PlantBenjiLastUpdate.postUpdate(new Date())
end

rule "UpdateTimestampPiff"
when
  Item PlantPiff received update
then
  logInfo(LOG_PIFF, "Updating timestamp for PlantPiff")
  PlantPiffLastUpdate.postUpdate(new Date())
end

I plan on adding notifications when they need to be watered etc. Would have to set up intervals for acceptable values etc.

Regards, S

1 Like

Hi, now my bluetooth dongle arrived as well as my sensors:)

@Seaside How do I install and run this: open-homeautomation/miflora from the git? Do you have some commands to pull it from git and put into the script folder and the you set up a cronjob with exec binding that runs demo.py every hour?

I have never used script like this before so I am a bit lost:)

Hi!

Check this thread out:

Regards, S

Basically you do
git clone https://github.com/open-homeautomation/miflora
and call build.sh
You would have to install some dependencies though. Look at the thread, hopefully I can answer questions if you have any.

Regards, S