flower care

Mi Flora plant sensor

Step-by-step how-to guide install the Mi Flora plant sensor on a Raspberry Pi 4, with the latest Raspbian Buster image and Domoticz.

For this how-to we will be using our highly regarded Python Plugin Manager. In case you have not installed this yet, take a look at the prerequisites, you will find a link to the related how-to to install this.

Please be aware that when you buy your Flower Mate from China, you need to buy the International model and NOT the Chinese/Asian model!

There are also reports that Xiaomi would or could be bricking these devices using the native Flower Care app. Personally I do not have experienced these issues, but just to be safe:

You don’t need the Flower Mate app to get this device working with Domoticz!!!

This how-to is part of a bigger series of Domoticz how-to’s on sancla.com!

This tutorial has been verified with:
Domoticz 2020.1
Python Plugin Manager version 1.5.1
The Mi Flower Mate plugin version 1.0.0

Prerequisites

Tested with

  • Raspberry Pi 4 (MEM 2GB with 16GB sd-card)
  • Raspbian Buster Lite 4.19, Februari 2020
  • Domoticz Stable 2020.1 (compile date 22-3-2020)
  • Domoticz Python plugin manager dated March 29, 2020

Step 1: Install the Bluepy library

Before we can install the plugin we need to install the bluepy library. This library enables Python to talk to Bluetooth devices under Linux. Without this library, the plugin can’t talk to your Flower Mate. Start by connecting with SSH to your Domoticz installation and run the following commands:

sudo apt-get install python3-pip libglib2.0-dev -y
sudo pip3 install bluepy

Step 2: Install the Mi Flower Mate Plugin

Next is to install the Mi Flower Mate Plugin with the Python Plugin Manager (PP-Manager). Add a new hardware device under Domoticz and use the following settings to create the hardware device (and activate the plugin):

  • Enabled: Enabled
  • Name: PP-Mi Flower Mate
  • Type: Python Plugin Manager
  • Data Timeout: Disabled
  • Plugin to install: Xiaomi Mi Flower Mate
  • Auto Update: All (NotifyOnly)
  • Security Scan: False
  • Debug: False
Installing the Xiaomi Mi Flower Mate plugin with the Python Plugin Manager
Installing the Xiaomi Mi Flower Mate plugin with the Python Plugin Manager

Reboot Domoticz once you have installed the new hardware device, to load the plugin within Domoticz. You can reboot Domoticz from the webinterface menu: Setup -> More Options -> Restart System.
Or with SSH: sudo reboot

The next step is to add the Xiaomi Mi Flower Mate hardware device, after the plugin has been activated.
Use the following settings:

  • Enabled: Enabled
  • Name: Mi Flower Mate
  • Type: Xiaomi Mi Flower Mate
  • Data Timeout: Disabled
  • Device selection: Automatic *
Adding the Mi Flower Mate hardware device
Adding the Mi Flower Mate hardware device

Once a Flower Mate device is found, it will automatically add the found sensors to Domoticz:

Mi Flower Mate device found in Domoticz
Mi Flower Mate device found in Domoticz

* Device selection

For the device selection you can also add the devices manually. This is especially useful if you have multiple devices or if you have ‘interference’ from the flower mate of your neighbor(s).

If you are using the manual option, scan for your Flower Mates to find their mac-addresses by entering this command into a terminal:

sudo hcitool lescan

Let it run for a while (or for the inpatient ones, whip out the battery from the flower mate and put it back in). After a while, bluetooth devices in the area will start to show up. Look for found devices named “Flower care” or similar.

Bluetooth scanning for Flower Mate devices
Bluetooth scanning for Flower Mate devices

Step 3: Enabling the device in Domoticz

Once you have acquired your Flower Mate device in Domoticz, automatically or manually, you need to enable the device in order to receive updates. This is done this way as this enables the plugin to actively pull an update from the Mi Flower Mate device. But only once, not continuously (by design to save power and put you in control).

Pull a Flower Mate Update
Pull a Flower Mate Update

Step 4: Automatically update the sensors

However, as great as it is to manually update the sensors every time, automatically updating your Mi Flower Mate sensors would be even better. Luckily, we can do this very easily under Domoticz, thanks to the design choices the developer made.

I present you 2 different options:

  • Option A: Using a device timer
  • Option B: Using a Blockly script

Option A: Create device timers

The easiest way to automatically trigger an update of the sensors is to enable the devices and enable a timer for this device. After you enabled all the Mi Flower Mate devices, look for it under the Switches tab in Domoticz.

Then click on the “Timers” button to configure the timer:

Adding a timer under Domoticz
Adding a timer under Domoticz

On of the nice things of working with timers is that you can add multiple timers. In this example I created 4 timers, to the sensors receives an update every 6 hours.

Keep in mind that the more frequent you pull an update from your Mi Flower Mate, the worse the energy consumption will be and the faster the battery will be drained!

Configuring timers for the Mi Flower Mate
Configuring timers for the Mi Flower Mate

Option B: Create a Blockly script

In this example I created a fairly easy to duplicate Blockly script to update the sensors daily. There are others ways to script this, even better with LUA, Python or dzVents scripts. But this example should give you a fairly good start with Blockly. Keep in mind that the more frequent you pull an update from your Mi Flower Mate, the worse the energy consumption will be and the faster the battery will be empty!

Mi Flower Update Script
Mi Flower Update Script

Don’t forget:

  • Save your script!
  • Enable the “update Mi Flowermates” device under Devices!

More information:

READ MORE

P1 Energy Meter for Domoticz

Step-by-step how-to guide connect the P1 Landis+Gyr Energy meter, on a Raspberry Pi 4, with the latest Raspbian Buster image and Domoticz.

This how-to is part of a bigger series of Domoticz how-to’s on sancla.com!

Until recently most Dutch household’s where provided with an old analog energy meter, for electricity and natural gas. These meters have been replaced in recent years (per designation of Dutch law) with a new generation P1 smart energy meters. Apart from the fact that the energy companies can now remotely read out the meters, they are also equipped with a local data port. This port can be utilized to constantly monitor these energy-meters including the meter values.

In this how-to we are going to connect this smart meter to our Raspberry Pi based Domoticz installation.

This tutorial has been verified with:
Domoticz 2020.1

Prerequisites

Tested with

  • Raspbian Buster Lite 4.19, Februari 2020
  • Domoticz Stable 2020.1 (compile date 22-3-2020)
  • TFDI FT232RL based USB to serial to RJ11 cable (P1 cable)

USB to serial to RJ11 cable

Our Chinese friends are well versed in preparing and making P1 cable solutions that also work well in combination with Domoticz. Under prerequisites are 2 links included with which you can order them ready-made. Also, these cables can often be ordered well through European web shops with a shorting shipping time (but often the price is higher).

For this post I ordered a cable from China and took it apart for you, so that you can see for yourself how they work. That way you can save even more costs by ordering the parts separately in China and assembling them yourself.

Configuring the P1 Smart Meter

Once you have the right cable, you can hook it up to your energy meter and Domoticz. After this, configure the new hardware device as follows:

  • Enabled: Enabled
  • Name: P1 Energy Meter
  • Type: P1 Smart Meter USB
  • Data Timeout: Disabled
  • Serial Port: Select your USB to serial adapter, in this case the TFDI FT232RL chip based adapter
  • Baudrate: 115200 bits per second (baud)
  • CRC message validation: Enabled
  • Rate Limit: empty
Configure the P1 hardware in Domoticz
Configure the P1 hardware in Domoticz

It can take a while for all devices to become visible in Domoticz, as these devices will only receive an update if the value in the meter changes. For example the gas meter, it will often take a while before it becomes visible. Certainly in the summer, when gas consumption is low, this can take some time.

P1 devices appear in Domoticz
P1 devices appear in Domoticz

READ MORE

Domoticz Plugin Manager

Step-by-step how-to guide install the Python Plugin (PP) manager on a Raspberry Pi 4, with the latest Raspbian Buster image and Domoticz.

Until earlier, plugins in Domoticz where a bit of a nightmare. In some cases it still is, mostly because Domoticz is an ongoing project that is still being developed. and for the most part, it will always be a work in progress, as is the nature of most open source projects. But life got easier since 2018 with the Python V3 based Plugin Manager for Domoticz. This how-to article guides you true the installation of this great piece of software and how to use it.

This how-to is part of a bigger series of Domoticz how-to’s on sancla.com!

This tutorial has been verified with:
Domoticz 2020.1
Python Plugin Manager version 1.5.1

Prerequisites

Tested with

  • Raspbian Buster Lite 4.19, Februari 2020
  • Domoticz Stable 2020.1 (compile date 22-3-2020)
  • Domoticz Python plugin manager dated January 2th, 2020

Step 1: Preparation

Connect with SSH to your Domoticz installation and follow below instructions.

First, make sure that git is installed:

sudo apt-get update
sudo apt-get install git python3-pip -y

Next, make sure the correct Python library is installed on your system.
First, check the current installed Python version:

python3 -V

My results:

[email protected]:~ $ python3 -V
Python 3.7.3

Also, check the library version with this command:

dpkg --get-selections | grep libpython

My results:

[email protected]:~ $ dpkg –get-selections | grep libpython
libpython-stdlib:armhf install
libpython2-stdlib:armhf install
libpython2.7-minimal:armhf install
libpython2.7-stdlib:armhf install
libpython3-stdlib:armhf install
libpython3.7:armhf install
libpython3.7-minimal:armhf install
libpython3.7-stdlib:armhf install

As you can see, both the Python 2.7 and the 3.7 libraries are installed, but Python version 3.7.3 is active. However, in order to use the Plugin Manager, we also need the corresponding “dev” libraries. Run the following commands to install them:

sudo apt-get install python3.7 libpython3.7 python3.7-dev
sudo systemctl restart domoticz.service

Step 2: Install the Python Plugin Manager

Now everything is ready for the Python Plugin Manager, it’s time to install it. Run the below commands to install the PP-Manager plugin.

cd
cd domoticz/plugins
git clone https://github.com/ycahome/pp-manager.git PP-MANAGER
cd PP-MANAGER
chmod +x plugin.py
sudo systemctl restart domoticz.service

The plugin manager should be installed and ready in Domoticz. Go to your Domoticz hardware page and you can now use it to install plugins.

The Python Plugin Manager now available in Domoticz
The Python Plugin Manager now available in Domoticz

Before you start installing plugins, make sure to check the Domoticz Plugin page in advance. Not all plugins are duly tested and some need some steps in advance. As stated earlier, Domoticz and the plugin manager are work in progress (but very good progress!).

https://www.domoticz.com/wiki/Plugins

For more information about the Python Plugin Manager, you can follow one of these sites:

READ MORE