just to bring us in the same level. The broker ist in the middle and openhab and miflora are connecting to the broker. Based on this you need to understand that the mqtt binding establishes the connection between broker and openhab. If you restart openhab you should find some kind off connection message in the openhab log. Next part is then to connect miflora. It should be possible to use the same credentials as in opnehab. If you have success with that is shown within the miflora status.
To check if the broker is working you should use a tool like mqttspy. With this tool it is possible to establish ab connection to the broker and read all miflora readings.
Miflora ---- ------ Mqtt broker -------- openhab
So i think we should first check if the broker is running
setting up and working with MQTT is out of the scope of the daemon documentation but you should find everything you need to first make sure MQTT is up and running here:
@curlyel happy you got it working right away. The battery information would certainly be something we can add. Please create a GitHub issue! The battery use is something I never looked at closely but I’ve been polling my sensors at home for quite some time now and they report 90-something percent. I wonder if those readings are correct. @skatun do you know more?
Regarding signal quality: Please check the output of sudo systemctl status miflora.service, also there is the idea to enhance this: https://github.com/ThomDietrich/miflora-mqtt-daemon/issues/16
One of my miflora is down to 19% now! I bought it 26/10/2016 add 3 weeks for shipping from china, and we probably end up with 1.5-1.8 years of battery time at 20C
One thing @ThomDietrich I would like to mentioned what I recently implemented lately is this: Number Miflora_Sensor4_Moisture “Sensor4 Soil Moisture [%d %%]” <text> (gMiflora, Group_Moisture,Group_Moisture_LivingRoom) {mqtt="<[mosquitto:miflora/sensor4:state:JSONPATH($.moisture)]", expire=“1h” }
Which will tell me if i have not got an update from my sensor in the last hour! Works like a charm.
Also I know that the py script says something about signal strength, maybe we could also forward this info to the broker? And finally I were wondering if you do check if the sensor have changed its value(any of the 4 value it reports) from last reading or not, if it hasn’t the sensor needs to be reset.
In generally the connection miflora -> RasPi3 -> WLAN -> mqtt-broker -> OpenHAB works for me.
Credentials are correct.
But only ~3-4 packages per day are reaching the broker.
“sudo hcitool lescan” lists a lot of Bluetoothdevices but nearly never the miflora sensor.
Hello, just to let you know, I tried to install the Daemon directly from openhabian, with the optional component installation, but it didn’t work (something wrong with the colorama module in python).
for more details, see below
Excited to get this up and going. Want to use it in our greenhouse. Will be quite awesome to keep track of the state of our seedlings. I have two that I have used for some time on the android app but want to integrate into openhab. Having issues right off the bat though.
I’m on OH2.3 and raspi. Installed Bluez per the instructions. Checked I have version 5.43 running. When I run
sudo hcitool lescan
I get Set scan parameters failed: Input/output error. Did some reading but could not overcome that. Found an article here that uses the bluetoothctl to search for bluetooth. That worked in a sense. It finds the controller and says searching but never finds the sensor even though its right by the raspi. I have connect the sensor to my phone and it has the latest version of the plant care software running on it.
Thoughts on how to get them connected? Sounds like most people on here it just connects.
But I saw somewhere in old posts that they could see the connection quality. Was that taken out again?
It`s very hard for me to currently find out why it would not work through a window. It did sometimes and then all of a sudden it does not again?! Any idea?
What kind of window do you have. I am moving from the miflora daemon to the Bluetooth binding from @vkolotov and while this i regocnized that the sensore on our veranda are nearly never reached. In the blutooth diskussion some other people have the same problem. Modern Windows …
If your windows are about 10 years old, then they are maybe the problem.
There is no particular reason to move to the bluetooth binding except from tha fact that the bluetooth binding does not only recognise the miflora sensors
I am still not able to connect one of my flora sensors… when i search via the hcitool i found booth of them…
I also stand the “problem” sensor in front of my PI…no connection possible…any ideas?
[13:39:44] openhabian@openHABianPi:~$ python3 /opt/miflora-mqtt-daemon/miflora-mqtt-daemon.py
Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon
Source: https://github.com/ThomDietrich/miflora-mqtt-daemon
[2018-07-02 13:39:45] Connecting to MQTT broker ...
[2018-07-02 13:39:45] MQTT connection established
Adding sensor to device list and testing connection ...
Name: "Spathiphyllum"
connect: Device or resource busy (16)
connect: Device or resource busy (16)
[2018-07-02 13:40:56] Initial connection to Mi Flora sensor "Spathiphyllum" (C4:7C:8D:65:DE:85) failed.
Adding sensor to device list and testing connection ...
Name: "Begonia_Corallina"
Internal name: "Begonia_Corallina"
Device name: "Flower care"
MAC address: C4:7C:8D:65:DE:9F
Firmware: 3.1.8
[2018-07-02 13:41:02] Initial connection to Mi Flora sensor "Begonia_Corallina" (C4:7C:8D:65:DE:9F) successful
[2018-07-02 13:41:02] Announcing Mi Flora devices to MQTT broker for auto-discovery ...
[2018-07-02 13:41:02] Retrieving data from sensor "Spathiphyllum" ...
connect: Device or resource busy (16)
connect: Device or resource busy (16)
connect: Device or resource busy (16)
[2018-07-02 13:41:52] Retrying ...
connect: Device or resource busy (16)
Another try…
Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon
Source: https://github.com/ThomDietrich/miflora-mqtt-daemon
[2018-07-02 13:45:38] Connecting to MQTT broker ...
[2018-07-02 13:45:38] MQTT connection established
Adding sensor to device list and testing connection ...
Name: "Spathiphyllum"
[2018-07-02 13:47:30] Initial connection to Mi Flora sensor "Spathiphyllum" (C4:7C:8D:65:DE:85) failed.
Adding sensor to device list and testing connection ...
Name: "Begonia_Corallina"
Characteristic value/descriptor read failed: Internal application error: I/O
connect error: Transport endpoint is not connected (107)
Internal name: "Begonia_Corallina"
Device name: "Flower care"
MAC address: C4:7C:8D:65:DE:9F
Firmware: 3.1.8
[2018-07-02 13:48:32] Initial connection to Mi Flora sensor "Begonia_Corallina" (C4:7C:8D:65:DE:9F) successful
[2018-07-02 13:48:32] Announcing Mi Flora devices to MQTT broker for auto-discovery ...
[2018-07-02 13:48:33] Retrieving data from sensor "Spathiphyllum" ...
[2018-07-02 13:50:23] Retrying ...
[2018-07-02 13:52:13] Failed to retrieve data from Mi Flora sensor "Spathiphyllum" (C4:7C:8D:65:DE:85), success rate: 0%
[2018-07-02 13:52:13] Retrieving data from sensor "Begonia_Corallina" ...
[2018-07-02 13:52:17] Result: {"light": 987, "temperature": 23.9, "moisture": 28, "conductivity": 324, "battery": 99}
[2018-07-02 13:52:17] Publishing to MQTT topic "miflora/Begonia_Corallina"
[2018-07-02 13:52:18] Sleeping (300 seconds) ...
[2018-07-02 13:57:18] Retrieving data from sensor "Spathiphyllum" ...
Hi guys,
thanks for the great work. I got everything working except the daemon. I get the following error:
pi@raspberrypi:~ $ sudo systemctl start miflora.service
Job for miflora.service failed because the control process exited with error code.
See "systemctl status miflora.service" and "journalctl -xe" for details.
pi@raspberrypi:~ $ sudo systemctl status miflora.service
● miflora.service - Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon
Loaded: loaded (/etc/systemd/system/miflora.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2018-07-08 15:34:49 UTC; 3s ago
Docs: https://github.com/ThomDietrich/miflora-mqtt-daemon
Process: 912 ExecStart=/opt/miflora-mqtt-daemon/miflora-mqtt-daemon.py (code=exited, status=203/EXEC)
Main PID: 912 (code=exited, status=203/EXEC)
Jul 08 15:34:48 raspberrypi systemd[1]: miflora.service: Unit entered failed state.
Jul 08 15:34:48 raspberrypi systemd[1]: miflora.service: Failed with result 'exit-code'.
Jul 08 15:34:49 raspberrypi systemd[1]: miflora.service: Service hold-off time over, scheduling restart.
Jul 08 15:34:49 raspberrypi systemd[1]: Stopped Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon.
Jul 08 15:34:49 raspberrypi systemd[1]: miflora.service: Start request repeated too quickly.
Jul 08 15:34:49 raspberrypi systemd[1]: Failed to start Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon.
Jul 08 15:34:49 raspberrypi systemd[1]: miflora.service: Unit entered failed state.
Jul 08 15:34:49 raspberrypi systemd[1]: miflora.service: Failed with result 'exit-code'.
config.ini has enabled the daemon. I have a Rasperry Zero W. Can someone help to get the script started as service?
My Linux knowledge is unfortunately very limited.
Thanks,
Matthias