Plant / Soil Sensing

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Plant / Soil Sensing

H Plato
Just wanted the list to know that there’s a way to get cheap plant sensor data into Misterhouse.

I bought a few of these ($12) https://www.aliexpress.com/item/Original-Xiaomi-Mi-Plants-Monitor-Flower-Plants-Tester-Xiaomi-Flora-Sensor-with-Bluetooth-Connection-White/32689446831.html. Using a raspberrypi 3 with built in bluetooth, I’m polling these devices every 4 hours and then sending the data into MH via MQTT. 

Seems to work reliably, and hopefully will prevent dead plants in the future. If there’s interest I can update the wiki with the code for the scripts and the install steps.


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Reply | Threaded
Open this post in threaded view
|

Re: Plant / Soil Sensing

Eloy Paris
Hi Howard,

On Sat, Dec 10, 2016 at 10:08:20AM -0700, H Plato wrote:

> Just wanted the list to know that there’s a way to get cheap plant sensor data into Misterhouse.
>
> I bought a few of these ($12) https://www.aliexpress.com/item/Original-Xiaomi-Mi-Plants-Monitor-Flower-Plants-Tester-Xiaomi-Flora-Sensor-with-Bluetooth-Connection-White/32689446831.html. Using a raspberrypi 3 with built in bluetooth, I’m polling these devices every 4 hours and then sending the data into MH via MQTT.
>
> Seems to work reliably, and hopefully will prevent dead plants in the future. If there’s interest I can update the wiki with the code for the scripts and the install steps.

Thanks for the heads up. Looks like a pretty cool and useful gadget.

I'd love to see wiki documentation on how you put everything together.

I recently bought this soil moisture sensor:

https://www.tindie.com/products/miceuz/i2c-soil-moisture-sensor/

and I have not integrated it with MH yet. My plan is to use an Arduino
(a Moteino, actually) but I then need to find a way to bridge the
Arduino to MH, and the two options that I am considering are xPL and
MQTT, so looking at how others have done this already would be very
helpful.

Cheers!

Eloy Paris.-


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Reply | Threaded
Open this post in threaded view
|

Re: Plant / Soil Sensing

dbemowsk
Eloy and Howard,

I am not a user of MisterHouse any more, but as a previous user, I still watch the forum a bit.  I stopped using it when my Raspberry Pi that was running it had died.  This was right around the time that I had stumbled upon MySensors which I have grown to LOVE.  At that time, there was no integration for MySensors in MH, so I decided to look at other automation software.  I am currently running Domoticz, but will soon be getting a Vera controller.  Both have VERY good MySensors support.

I see that someone has now integrated some support for MySensors to MH.  Creating and implementing a MySensors gateway and a node for this sensor would be a good way to go IMHO.  You would not only get easy connectivity of your sensor to MH, but you would gain the added ability to easily add other MySensors devices in the future.  Being that this sensor is I2C, it should be fairly easy to integrate as a MySensors device.  There are also a few projects already out there for soil moisture sensing on the MySensors forum.  Here are two of them with good information.


Hope that helps some

Dan Bemowski

On Sat, 2016-12-10 at 14:05 -0500, Eloy Paris wrote:
Hi Howard,

On Sat, Dec 10, 2016 at 10:08:20AM -0700, H Plato wrote:


Just wanted the list to know that there’s a way to get cheap plant sensor data into Misterhouse.

I bought a few of these ($12) https://www.aliexpress.com/item/Original-Xiaomi-Mi-Plants-Monitor-Flower-Plants-Tester-Xiaomi-Flora-Sensor-with-Bluetooth-Connection-White/32689446831.html. Using a raspberrypi 3 with built in bluetooth, I’m polling these devices every 4 hours and then sending the data into MH via MQTT. 

Seems to work reliably, and hopefully will prevent dead plants in the future. If there’s interest I can update the wiki with the code for the scripts and the install steps.
Thanks for the heads up. Looks like a pretty cool and useful gadget.

I'd love to see wiki documentation on how you put everything together.

I recently bought this soil moisture sensor:


and I have not integrated it with MH yet. My plan is to use an Arduino
(a Moteino, actually) but I then need to find a way to bridge the
Arduino to MH, and the two options that I am considering are xPL and
MQTT, so looking at how others have done this already would be very
helpful.

Cheers!

Eloy Paris.-


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Reply | Threaded
Open this post in threaded view
|

Re: Plant / Soil Sensing

Lieven Hollevoet
Administrator
In reply to this post by H Plato
Hello Howard,

yes +1 from me if you find some time to document this. I’ll be experimenting with bluetooth in the future for some sensors and I plan to use the RPi as gateway too. So it would be a head-start if I could take a look in your code setup.

Are you using Mosquitto MQTT?

Best regards,
 Lieven.

> Op 10 dec. 2016, om 18:08 heeft H Plato <[hidden email]> het volgende geschreven:
>
> Just wanted the list to know that there’s a way to get cheap plant sensor data into Misterhouse.
>
> I bought a few of these ($12) https://www.aliexpress.com/item/Original-Xiaomi-Mi-Plants-Monitor-Flower-Plants-Tester-Xiaomi-Flora-Sensor-with-Bluetooth-Connection-White/32689446831.html. Using a raspberrypi 3 with built in bluetooth, I’m polling these devices every 4 hours and then sending the data into MH via MQTT.
>
> Seems to work reliably, and hopefully will prevent dead plants in the future. If there’s interest I can update the wiki with the code for the scripts and the install steps.
>
> <PastedGraphic-2.png>
> ------------------------------------------------------------------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today.http://sdm.link/xeonphi________________________________________________________
> To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users
>


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Reply | Threaded
Open this post in threaded view
|

Re: Plant / Soil Sensing

H Plato
Yes, Mosquitto on Ubuntu 14.04, with just the default setup.

libmosquitto-dev:amd64                                      1.4.8-0mosquitto1                                   amd64        MQTT version 3.1/3.1.1 client library, development files
libmosquitto0                                               0.15-2ubuntu1                                       amd64        MQTT version 3.1 client library
libmosquitto1:amd64                                         1.4.8-0mosquitto1                                   amd64        MQTT version 3.1/3.1.1 client library
mosquitto                                                   1.4.8-0mosquitto1                                   amd64        MQTT version 3.1/3.1.1 compatible message broker
mosquitto-clients                                           1.4.8-0mosquitto1                                   amd64        Mosquitto command line MQTT clients

I’ll put something better together later, but here’s the basics of the setup. I use the miflora python module, perl code to send MQTT data, and a bash script run through cron

To get things started;

- hcitool lescan shows the nearby bluetooth devices. For the miflora we’re looking for ‘flower care’ and ‘flower mate’
- I then installed this python module with easy_install -U (https://pypi.python.org/pypi/miflora/0.1.4)
- I then used CPAN to install Net::MQTT:Simple

This is the perl script to write data to a csv and upload to an mqtt server

#upload_mqtt
#!/usr/bin/perl

use Net::MQTT::Simple;

my $sensor = $ARGV[0];
my %data =();
my $exit = 1;
my $host = “server";
my $file = "/var/log/soil_sensors.log";

my $mqtt1 = Net::MQTT::Simple->new($host);

unless ($sensor) {

        print "Error, Sensor name missing from command line arguments\n";

} else {
   foreach $line ( <STDIN> ) {
      chomp( $line );
      my ($attr,$value) = $line =~ /^([^:]+):\s*(.*)/;
      #print "$sensor:$line attr=$attr value=$value\n";
      if ($attr and $value) {
         $data{$attr} = $value;
         #publish "topic/here" => "Message";
         $mqtt1->publish("soil/$sensor/$attr",$data{$attr});
         print "publish \"soil/$sensor/$attr\" => $data{$attr}\n";
         $exit = 0;
      }
   }
   unless ($exit) {
      open FILE, '>>', $file or warn "error $!";
      print FILE time . ",$sensor,$data{FW},$data{Name},$data{Temperature},$data{Moisture},$data{Light},$data{Conductivity},$data{Battery}\n";
      close FILE;
   }
   print "done ($exit)\n"
}
exit $exit;

And this is the python code — which is just the slightly adapted ‘demo.py’ that comes with the python modules;

#get_miflora
#!/usr/bin/python3

import sys

from miflora.miflora_poller import MiFloraPoller, \
    MI_CONDUCTIVITY, MI_MOISTURE, MI_LIGHT, MI_TEMPERATURE, MI_BATTERY

poller = MiFloraPoller(sys.argv[1])
print("Getting data from Mi Flora")
print("FW: {}".format(poller.firmware_version()))
print("Name: {}".format(poller.name()))
print("Temperature: {}".format(poller.parameter_value("temperature")))
print("Moisture: {}".format(poller.parameter_value(MI_MOISTURE)))
print("Light: {}".format(poller.parameter_value(MI_LIGHT)))
print("Conductivity: {}".format(poller.parameter_value(MI_CONDUCTIVITY)))
print("Battery: {}".format(poller.parameter_value(MI_BATTERY)))

and this is the bash script that polls the sensors. I retry 3 times every 5 minutes in case a device times out.

#!/bin/bash

SENSORS=2
SENSOR=("C4:7C:8D:xx:xx:xx" "C4:7C:8D:xx:xx:xx");
STATUS=("1" "1")

function get_data {

for ((i=1; i<=$SENSORS; i++))
   do
     if [ ${STATUS[i-1]} -ne 0 ]
        then
           echo $i ${SENSOR[i-1]}
           /usr/local/share/miflora/miflora/get_miflora ${SENSOR[i-1]} | /usr/local/share/miflora/upload_mqtt $i
           STATUS[i-1]=$?
           echo status=${STATUS[i-1]}
     fi
   done
}

get_data

sleep 300

get_data

sleep 300

get_data

sleep 300

get_data

and finally this is the MH code that pulls the data from the MQTT source:

require mqtt; #noloop
       
$mqtt2 = new mqtt('mqtt', '127.0.0.1', 1883, 'soil/#', "", "", 121);
       
$sensor1_temp = new mqtt_Item($mqtt1, "soil/1/Temperature");
$sensor1_moist = new mqtt_Item($mqtt1, "soil/1/Moisture");
$sensor1_light = new mqtt_Item($mqtt1, "soil/1/Light");
$sensor1_cond = new mqtt_Item($mqtt1, "soil/1/Conductivity");
$sensor1_batt = new mqtt_Item($mqtt1, "soil/1/Battery");

$sensor2_temp = new mqtt_Item($mqtt1, "soil/2/Temperature");
$sensor2_moist = new mqtt_Item($mqtt1, "soil/2/Moisture");
$sensor2_light = new mqtt_Item($mqtt1, "soil/2/Light");
$sensor2_cond = new mqtt_Item($mqtt1, "soil/2/Conductivity");
$sensor2_batt = new mqtt_Item($mqtt1, "soil/2/Battery");


$t_sensor1_data = new Timer;
$t_sensor2_data = new Timer;

$soil_data_status = new Generic_Item;
$soil_data_status -> xAP_enable;
 
$v_print_soil_timer = new Voice_Cmd("Print [sensor1,all] timer data to the log file");
$v_print_soil_data = new Voice_Cmd("Print [sensor1,all] mqtt data to the log file");
 
if ($Startup) {
        set $soil_data_status "online";
        set $t_sensor1_data 24*60*60;
        set $t_sensor2_data 24*60*60;
        start $t_sensor1_data;
        start $t_sensor2_data;
}
 
if (state_changed $sensor1_temp) {
        print_log "[mqtt_soil]: sensor1 temperature changed to " . state $sensor1_temp . " degrees";
}

if (state_changed $sensor1_moist) {
        print_log "[mqtt_soil]: sensor1 moisture changed to " . state $sensor1_moist . " %";
}

if (state_changed $sensor1_light) {
        print_log "[mqtt_soil]: sensor1 light changed to " . state $sensor1_light . " lux";
}

if (state_changed $sensor1_cond) {
        print_log "[mqtt_soil]: sensor1 conductivity/fertility changed to " . state $sensor1_cond . " ";
}

if (state_changed $sensor1_batt) {
        print_log "[mqtt_soil]: sensor1 battery changed to " . state $sensor1_batt . " %";
}

if ((state_now $sensor1_temp) or (state_now $sensor1_moist) or (state_now $sensor1_light) or (state_now $sensor1_cond) or (state_now $sensor1_batt)) {
        stop $t_sensor1_data;
        set $t_sensor1_data 24*60*60;
        start $t_sensor1_data;
}
       
if (expired $t_sensor1_data) {
        print_log "[mqtt_soil]: WARNING: Sensor 1 Data expired!";
        set $soil_data_status "offline";
}

if (state_changed $sensor2_temp) {
        print_log "[mqtt_soil]: sensor2 temperature changed to " . state $sensor2_temp . " degrees";
}

if (state_changed $sensor2_moist) {
        print_log "[mqtt_soil]: sensor2 moisture changed to " . state $sensor2_moist . " %";
}

if (state_changed $sensor2_light) {
        print_log "[mqtt_soil]: sensor2 light changed to " . state $sensor2_light . " lux";
}

if (state_changed $sensor2_cond) {
        print_log "[mqtt_soil]: sensor2 conductivity/fertility changed to " . state $sensor2_cond . " ";
}

if (state_changed $sensor2_batt) {
        print_log "[mqtt_soil]: sensor2 battery changed to " . state $sensor2_batt . " %";
}

if ((state_now $sensor2_temp) or (state_now $sensor2_moist) or (state_now $sensor2_light) or (state_now $sensor2_cond) or (state_now $sensor2_batt)) {
        stop $t_sensor2_data;
        set $t_sensor2_data 24*60*60;
        start $t_sensor2_data;
}

if (expired $t_sensor2_data) {
        print_log "[mqtt_soil]: WARNING: Sensor 2 Data expired!";
        set $soil_data_status "offline";
}

if  ((state $soil_data_status eq "offline") and (active $t_sensor1_data) and (active $t_sensor2_data)) {
        print_log "[mqtt_soil]: All data is now active";
        set $soil_data_status "online";
}

if (my $state = said $v_print_soil_timer) {
}

if (my $state = said $v_print_soil_data) {

        print_log "[mqtt_soil]: sensor1 temperature is " . state $sensor1_temp . " degrees";
        print_log "[mqtt_soil]: sensor1 moisture is " . state $sensor1_moist . " %";
        print_log "[mqtt_soil]: sensor1 light is " . state $sensor1_light . " lux";
        print_log "[mqtt_soil]: sensor1 conductivity/fertility is " . state $sensor1_cond . " ";
        print_log "[mqtt_soil]: sensor1 battery is " . state $sensor1_batt . " %";

        print_log "[mqtt_soil]: sensor2 temperature is " . state $sensor2_temp . " degrees";
        print_log "[mqtt_soil]: sensor2 moisture is " . state $sensor2_moist . " %";
        print_log "[mqtt_soil]: sensor2 light is " . state $sensor2_light . " lux";
        print_log "[mqtt_soil]: sensor2 conductivity/fertility is " . state $sensor2_cond . " ";
        print_log "[mqtt_soil]: sensor2 battery is " . state $sensor2_batt . " %";
}


> On Dec 11, 2016, at 12:48 PM, Lieven Hollevoet <[hidden email]> wrote:
>
> Hello Howard,
>
> yes +1 from me if you find some time to document this. I’ll be experimenting with bluetooth in the future for some sensors and I plan to use the RPi as gateway too. So it would be a head-start if I could take a look in your code setup.
>
> Are you using Mosquitto MQTT?
>
> Best regards,
> Lieven.
>
>> Op 10 dec. 2016, om 18:08 heeft H Plato <[hidden email]> het volgende geschreven:
>>
>> Just wanted the list to know that there’s a way to get cheap plant sensor data into Misterhouse.
>>
>> I bought a few of these ($12) https://www.aliexpress.com/item/Original-Xiaomi-Mi-Plants-Monitor-Flower-Plants-Tester-Xiaomi-Flora-Sensor-with-Bluetooth-Connection-White/32689446831.html. Using a raspberrypi 3 with built in bluetooth, I’m polling these devices every 4 hours and then sending the data into MH via MQTT.
>>
>> Seems to work reliably, and hopefully will prevent dead plants in the future. If there’s interest I can update the wiki with the code for the scripts and the install steps.
>>
>> <PastedGraphic-2.png>
>> ------------------------------------------------------------------------------
>> Developer Access Program for Intel Xeon Phi Processors
>> Access to Intel Xeon Phi processor-based developer platforms.
>> With one year of Intel Parallel Studio XE.
>> Training and support from Colfax.
>> Order your platform today.http://sdm.link/xeonphi________________________________________________________
>> To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users
>>
>


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Reply | Threaded
Open this post in threaded view
|

Re: Plant / Soil Sensing

Lieven Hollevoet
Administrator
Hello Howard,

OK, thanks!

Best regards,
 Lieven.

> Op 11 dec. 2016, om 21:04 heeft H Plato <[hidden email]> het volgende geschreven:
>
> Yes, Mosquitto on Ubuntu 14.04, with just the default setup.
>
> libmosquitto-dev:amd64                                      1.4.8-0mosquitto1                                   amd64        MQTT version 3.1/3.1.1 client library, development files
> libmosquitto0                                               0.15-2ubuntu1                                       amd64        MQTT version 3.1 client library
> libmosquitto1:amd64                                         1.4.8-0mosquitto1                                   amd64        MQTT version 3.1/3.1.1 client library
> mosquitto                                                   1.4.8-0mosquitto1                                   amd64        MQTT version 3.1/3.1.1 compatible message broker
> mosquitto-clients                                           1.4.8-0mosquitto1                                   amd64        Mosquitto command line MQTT clients
>
> I’ll put something better together later, but here’s the basics of the setup. I use the miflora python module, perl code to send MQTT data, and a bash script run through cron
>
> To get things started;
>
> - hcitool lescan shows the nearby bluetooth devices. For the miflora we’re looking for ‘flower care’ and ‘flower mate’
> - I then installed this python module with easy_install -U (https://pypi.python.org/pypi/miflora/0.1.4)
> - I then used CPAN to install Net::MQTT:Simple
>
> This is the perl script to write data to a csv and upload to an mqtt server
>
> #upload_mqtt
> #!/usr/bin/perl
>
> use Net::MQTT::Simple;
>
> my $sensor = $ARGV[0];
> my %data =();
> my $exit = 1;
> my $host = “server";
> my $file = "/var/log/soil_sensors.log";
>
> my $mqtt1 = Net::MQTT::Simple->new($host);
>
> unless ($sensor) {
>
> print "Error, Sensor name missing from command line arguments\n";
>
> } else {
>   foreach $line ( <STDIN> ) {
>      chomp( $line );
>      my ($attr,$value) = $line =~ /^([^:]+):\s*(.*)/;
>      #print "$sensor:$line attr=$attr value=$value\n";
>      if ($attr and $value) {
>         $data{$attr} = $value;
>         #publish "topic/here" => "Message";
>         $mqtt1->publish("soil/$sensor/$attr",$data{$attr});
>         print "publish \"soil/$sensor/$attr\" => $data{$attr}\n";
>         $exit = 0;
>      }
>   }
>   unless ($exit) {
>      open FILE, '>>', $file or warn "error $!";
>      print FILE time . ",$sensor,$data{FW},$data{Name},$data{Temperature},$data{Moisture},$data{Light},$data{Conductivity},$data{Battery}\n";
>      close FILE;
>   }
>   print "done ($exit)\n"
> }
> exit $exit;
>
> And this is the python code — which is just the slightly adapted ‘demo.py’ that comes with the python modules;
>
> #get_miflora
> #!/usr/bin/python3
>
> import sys
>
> from miflora.miflora_poller import MiFloraPoller, \
>    MI_CONDUCTIVITY, MI_MOISTURE, MI_LIGHT, MI_TEMPERATURE, MI_BATTERY
>
> poller = MiFloraPoller(sys.argv[1])
> print("Getting data from Mi Flora")
> print("FW: {}".format(poller.firmware_version()))
> print("Name: {}".format(poller.name()))
> print("Temperature: {}".format(poller.parameter_value("temperature")))
> print("Moisture: {}".format(poller.parameter_value(MI_MOISTURE)))
> print("Light: {}".format(poller.parameter_value(MI_LIGHT)))
> print("Conductivity: {}".format(poller.parameter_value(MI_CONDUCTIVITY)))
> print("Battery: {}".format(poller.parameter_value(MI_BATTERY)))
>
> and this is the bash script that polls the sensors. I retry 3 times every 5 minutes in case a device times out.
>
> #!/bin/bash
>
> SENSORS=2
> SENSOR=("C4:7C:8D:xx:xx:xx" "C4:7C:8D:xx:xx:xx");
> STATUS=("1" "1")
>
> function get_data {
>
> for ((i=1; i<=$SENSORS; i++))
>   do
>     if [ ${STATUS[i-1]} -ne 0 ]
>        then
>           echo $i ${SENSOR[i-1]}
>           /usr/local/share/miflora/miflora/get_miflora ${SENSOR[i-1]} | /usr/local/share/miflora/upload_mqtt $i
>           STATUS[i-1]=$?
>           echo status=${STATUS[i-1]}
>     fi
>   done
> }
>
> get_data
>
> sleep 300
>
> get_data
>
> sleep 300
>
> get_data
>
> sleep 300
>
> get_data
>
> and finally this is the MH code that pulls the data from the MQTT source:
>
> require mqtt; #noloop
>
> $mqtt2 = new mqtt('mqtt', '127.0.0.1', 1883, 'soil/#', "", "", 121);
>
> $sensor1_temp = new mqtt_Item($mqtt1, "soil/1/Temperature");
> $sensor1_moist = new mqtt_Item($mqtt1, "soil/1/Moisture");
> $sensor1_light = new mqtt_Item($mqtt1, "soil/1/Light");
> $sensor1_cond = new mqtt_Item($mqtt1, "soil/1/Conductivity");
> $sensor1_batt = new mqtt_Item($mqtt1, "soil/1/Battery");
>
> $sensor2_temp = new mqtt_Item($mqtt1, "soil/2/Temperature");
> $sensor2_moist = new mqtt_Item($mqtt1, "soil/2/Moisture");
> $sensor2_light = new mqtt_Item($mqtt1, "soil/2/Light");
> $sensor2_cond = new mqtt_Item($mqtt1, "soil/2/Conductivity");
> $sensor2_batt = new mqtt_Item($mqtt1, "soil/2/Battery");
>
>
> $t_sensor1_data = new Timer;
> $t_sensor2_data = new Timer;
>
> $soil_data_status = new Generic_Item;
> $soil_data_status -> xAP_enable;
>
> $v_print_soil_timer = new Voice_Cmd("Print [sensor1,all] timer data to the log file");
> $v_print_soil_data = new Voice_Cmd("Print [sensor1,all] mqtt data to the log file");
>
> if ($Startup) {
> set $soil_data_status "online";
> set $t_sensor1_data 24*60*60;
> set $t_sensor2_data 24*60*60;
> start $t_sensor1_data;
> start $t_sensor2_data;
> }
>
> if (state_changed $sensor1_temp) {
> print_log "[mqtt_soil]: sensor1 temperature changed to " . state $sensor1_temp . " degrees";
> }
>
> if (state_changed $sensor1_moist) {
> print_log "[mqtt_soil]: sensor1 moisture changed to " . state $sensor1_moist . " %";
> }
>
> if (state_changed $sensor1_light) {
> print_log "[mqtt_soil]: sensor1 light changed to " . state $sensor1_light . " lux";
> }
>
> if (state_changed $sensor1_cond) {
> print_log "[mqtt_soil]: sensor1 conductivity/fertility changed to " . state $sensor1_cond . " ";
> }
>
> if (state_changed $sensor1_batt) {
> print_log "[mqtt_soil]: sensor1 battery changed to " . state $sensor1_batt . " %";
> }
>
> if ((state_now $sensor1_temp) or (state_now $sensor1_moist) or (state_now $sensor1_light) or (state_now $sensor1_cond) or (state_now $sensor1_batt)) {
> stop $t_sensor1_data;
> set $t_sensor1_data 24*60*60;
> start $t_sensor1_data;
> }
>
> if (expired $t_sensor1_data) {
> print_log "[mqtt_soil]: WARNING: Sensor 1 Data expired!";
> set $soil_data_status "offline";
> }
>
> if (state_changed $sensor2_temp) {
> print_log "[mqtt_soil]: sensor2 temperature changed to " . state $sensor2_temp . " degrees";
> }
>
> if (state_changed $sensor2_moist) {
> print_log "[mqtt_soil]: sensor2 moisture changed to " . state $sensor2_moist . " %";
> }
>
> if (state_changed $sensor2_light) {
> print_log "[mqtt_soil]: sensor2 light changed to " . state $sensor2_light . " lux";
> }
>
> if (state_changed $sensor2_cond) {
> print_log "[mqtt_soil]: sensor2 conductivity/fertility changed to " . state $sensor2_cond . " ";
> }
>
> if (state_changed $sensor2_batt) {
> print_log "[mqtt_soil]: sensor2 battery changed to " . state $sensor2_batt . " %";
> }
>
> if ((state_now $sensor2_temp) or (state_now $sensor2_moist) or (state_now $sensor2_light) or (state_now $sensor2_cond) or (state_now $sensor2_batt)) {
> stop $t_sensor2_data;
> set $t_sensor2_data 24*60*60;
> start $t_sensor2_data;
> }
>
> if (expired $t_sensor2_data) {
> print_log "[mqtt_soil]: WARNING: Sensor 2 Data expired!";
> set $soil_data_status "offline";
> }
>
> if  ((state $soil_data_status eq "offline") and (active $t_sensor1_data) and (active $t_sensor2_data)) {
> print_log "[mqtt_soil]: All data is now active";
> set $soil_data_status "online";
> }
>
> if (my $state = said $v_print_soil_timer) {
> }
>
> if (my $state = said $v_print_soil_data) {
>
>        print_log "[mqtt_soil]: sensor1 temperature is " . state $sensor1_temp . " degrees";
>        print_log "[mqtt_soil]: sensor1 moisture is " . state $sensor1_moist . " %";
>        print_log "[mqtt_soil]: sensor1 light is " . state $sensor1_light . " lux";
>        print_log "[mqtt_soil]: sensor1 conductivity/fertility is " . state $sensor1_cond . " ";
>        print_log "[mqtt_soil]: sensor1 battery is " . state $sensor1_batt . " %";
>
>        print_log "[mqtt_soil]: sensor2 temperature is " . state $sensor2_temp . " degrees";
>        print_log "[mqtt_soil]: sensor2 moisture is " . state $sensor2_moist . " %";
>        print_log "[mqtt_soil]: sensor2 light is " . state $sensor2_light . " lux";
>        print_log "[mqtt_soil]: sensor2 conductivity/fertility is " . state $sensor2_cond . " ";
>        print_log "[mqtt_soil]: sensor2 battery is " . state $sensor2_batt . " %";
> }
>
>
>> On Dec 11, 2016, at 12:48 PM, Lieven Hollevoet <[hidden email]> wrote:
>>
>> Hello Howard,
>>
>> yes +1 from me if you find some time to document this. I’ll be experimenting with bluetooth in the future for some sensors and I plan to use the RPi as gateway too. So it would be a head-start if I could take a look in your code setup.
>>
>> Are you using Mosquitto MQTT?
>>
>> Best regards,
>> Lieven.
>>
>>> Op 10 dec. 2016, om 18:08 heeft H Plato <[hidden email]> het volgende geschreven:
>>>
>>> Just wanted the list to know that there’s a way to get cheap plant sensor data into Misterhouse.
>>>
>>> I bought a few of these ($12) https://www.aliexpress.com/item/Original-Xiaomi-Mi-Plants-Monitor-Flower-Plants-Tester-Xiaomi-Flora-Sensor-with-Bluetooth-Connection-White/32689446831.html. Using a raspberrypi 3 with built in bluetooth, I’m polling these devices every 4 hours and then sending the data into MH via MQTT.
>>>
>>> Seems to work reliably, and hopefully will prevent dead plants in the future. If there’s interest I can update the wiki with the code for the scripts and the install steps.
>>>
>>> <PastedGraphic-2.png>
>>> ------------------------------------------------------------------------------
>>> Developer Access Program for Intel Xeon Phi Processors
>>> Access to Intel Xeon Phi processor-based developer platforms.
>>> With one year of Intel Parallel Studio XE.
>>> Training and support from Colfax.
>>> Order your platform today.http://sdm.link/xeonphi________________________________________________________
>>> To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users
>>>
>>
>


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users