Closed rb090 closed 4 years ago
Okay it is always good to talk about issues to get ideas how to solve them π. The reporting_method
in the section [General]
was wrong. This should be set to json so that it looks like this: reporting_method = json
.
So now when executing the python script (sudo python3 miflora-mqtt-daemon.py
) I see valid output which looks like this:
[2020-08-06 20:39:07] Retrieving data from sensor "MyPlant" ...
[2020-08-06 20:39:07] Result: {"light": 0, "temperature": 26.3, "moisture": 6, "conductivity": 0, "battery": 100}
Data for "Basilikum": {"light": 0, "temperature": 26.3, "moisture": 6, "conductivity": 0, "battery": 100, "timestamp": "2020-08-06 20:39:07", "name": "MyPlant", "name_pretty": "MyPlant", "mac": "C4:7C:8D:6B:43:76", "firmware": "3.2.2"}
But what I really cannot understand and it seems that sth. went wrong, when I change reporting_method
and also add the base_topic
described in the documentation I always get the error
Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon
Source: https://github.com/ThomDietrich/miflora-mqtt-daemon
[2020-08-06 17:59:17] Connecting to MQTT broker ...
[2020-08-06 17:59:17] MQTT connection error. Please check your settings in the configuration file "config.ini"
I want to use this sensor in Home Assistant so I change my configuration, it looks now like this:
[General]
# as described needed to publish to an MQTT broker following the HomeAssistant discovery format
reporting_method = homeassistant-mqtt
[Daemon]
# nothing defined
[MQTT]
# Default depends on the configured reporting_method
# Default for: mqtt-json, mqtt-smarthome, homeassistant-mqtt
base_topic = miflora
[Sensors]
MyPlant = C4:7C:8D:6B:43:76
That is why I reopened this issue, when changing the reporting_method
to sth else than json
the error is thrown π€. What I am doing exactly wrong in my config file? Can you please help me with this?
Okay now this issue should be solved. I added some logging to miflora-mqtt-daemon.py
from line 164 to 169. The logging output of the exception shows [Errno 111] Connection refused
. When seeing this error I checked if my MQTT Broker was installed correctly. That was the problem. I reinstall Mosquitto and everything works fine now.
It was necessary to add a timer service like described here: https://github.com/ThomDietrich/miflora-mqtt-daemon/issues/52#issuecomment-590190810
After that everything works also fine after reboot
Hi,
I bought this Mija-plantsensor and I clone this repository an try to query this sensor and to read data from it.
I followed all the steps from the README.md but I always get this output:
I really do not understand what went wrong - or what's wrong with my config.ini:
This file is in the root folder also where also the python script (
miflora-mqtt-daemon.py
) is located:I can see the plant sensor if I do
sudo hcitool lescan
:Can you please tell me what I am doing wrong?
I am thankful for every help and advice.