ChristianKuehnel / plantgateway

Bluetooth to mqtt gateway for Xiaomi Mi plant sensors
Apache License 2.0
271 stars 43 forks source link

switched to miflora instead of my own implementation #19

Closed ChristianKuehnel closed 6 years ago

ChristianKuehnel commented 6 years ago

this still needs some testing...

syssi commented 6 years ago

The brightness isn't fine:

Sun, 08 Apr 2018 11:15:33 INFO     loaded config file from /home/homeassistant/.plantgw.yaml
Sun, 08 Apr 2018 11:15:33 INFO     MQTT connection returned result: Connection Accepted.
Sun, 08 Apr 2018 11:15:33 INFO     Getting data from sensor plant
Sun, 08 Apr 2018 11:15:41 DEBUG    Call to <function BluepyBackend.connect at 0x764c5a50> failed, try 1 of 3
Sun, 08 Apr 2018 11:15:48 DEBUG    Received result for handle 56: 5E 15 32 2E 37 2E 30
Sun, 08 Apr 2018 11:15:48 DEBUG    Filling cache with new sensor data.
Sun, 08 Apr 2018 11:15:48 DEBUG    Received result for handle 53: 0F 01 00 F6 B7 01 00 3B BD 03 02 3C 00 FB 34 9B
Sun, 08 Apr 2018 11:15:48 DEBUG    Using cache (0:00:00.003136 < 0:10:00)
Sun, 08 Apr 2018 11:15:48 DEBUG    Using cache (0:00:00.004194 < 0:10:00)
Sun, 08 Apr 2018 11:15:48 DEBUG    Using cache (0:00:00.005069 < 0:10:00)
Sun, 08 Apr 2018 11:15:48 DEBUG    brightness: -18442
Sun, 08 Apr 2018 11:15:48 DEBUG    temperature: 27.1
Sun, 08 Apr 2018 11:15:48 DEBUG    conductivity: 957
Sun, 08 Apr 2018 11:15:48 DEBUG    battery: 94
Sun, 08 Apr 2018 11:15:48 DEBUG    moisture: 59
Sun, 08 Apr 2018 11:15:48 DEBUG    timestamp: 2018-04-08T11:15:48.808801
Sun, 08 Apr 2018 11:15:48 INFO     sent data to topic miflora/plant/
Sun, 08 Apr 2018 11:15:48 INFO     Getting data from sensor outdoor
Sun, 08 Apr 2018 11:15:50 DEBUG    Received result for handle 56: 64 15 32 2E 37 2E 30
Sun, 08 Apr 2018 11:15:50 DEBUG    Filling cache with new sensor data.
Sun, 08 Apr 2018 11:15:51 DEBUG    Received result for handle 53: 00 01 00 6A C7 00 00 2A 98 01 02 3C 00 FB 34 9B
Sun, 08 Apr 2018 11:15:51 DEBUG    Using cache (0:00:00.003239 < 0:10:00)
Sun, 08 Apr 2018 11:15:51 DEBUG    Using cache (0:00:00.004754 < 0:10:00)
Sun, 08 Apr 2018 11:15:51 DEBUG    Using cache (0:00:00.005941 < 0:10:00)
Sun, 08 Apr 2018 11:15:51 DEBUG    brightness: -14486
Sun, 08 Apr 2018 11:15:51 DEBUG    temperature: 25.6
Sun, 08 Apr 2018 11:15:51 DEBUG    conductivity: 408
Sun, 08 Apr 2018 11:15:51 DEBUG    battery: 100
Sun, 08 Apr 2018 11:15:51 DEBUG    moisture: 42
Sun, 08 Apr 2018 11:15:51 DEBUG    timestamp: 2018-04-08T11:15:51.244237
Sun, 08 Apr 2018 11:15:51 INFO     sent data to topic miflora/outdoor/
Sun, 08 Apr 2018 11:15:51 INFO     Disconnected MQTT connection

and sometimes the mqtt server isn't connected:

Sun, 08 Apr 2018 11:17:39 INFO     loaded config file from /home/homeassistant/.plantgw.yaml
Sun, 08 Apr 2018 11:17:39 INFO     Getting data from sensor plant
Sun, 08 Apr 2018 11:17:39 ERROR    could not read data from C4:7C:8D:62:E8:F6 (plant) with reason: not connected to MQTT server
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/plantgw/__init__.py", line 212, in process_all
    self.process_mac(sensor)
  File "/usr/local/lib/python3.5/dist-packages/plantgw/__init__.py", line 190, in process_mac
    self._publish(sensor_config, poller)
  File "/usr/local/lib/python3.5/dist-packages/plantgw/__init__.py", line 163, in _publish
    raise Exception('not connected to MQTT server')
Exception: not connected to MQTT server
could not read data from C4:7C:8D:62:E8:F6 (plant) with reason: not connected to MQTT server
Sun, 08 Apr 2018 11:17:39 INFO     MQTT connection returned result: Connection Accepted.
Sun, 08 Apr 2018 11:17:39 INFO     Getting data from sensor outdoor
Sun, 08 Apr 2018 11:17:41 DEBUG    Received result for handle 56: 64 15 32 2E 37 2E 30
Sun, 08 Apr 2018 11:17:41 DEBUG    Filling cache with new sensor data.
Sun, 08 Apr 2018 11:17:41 DEBUG    Received result for handle 53: FC 00 00 4B D2 00 00 2A 9B 01 02 3C 00 FB 34 9B
Sun, 08 Apr 2018 11:17:41 DEBUG    Using cache (0:00:00.001962 < 0:10:00)
Sun, 08 Apr 2018 11:17:41 DEBUG    Using cache (0:00:00.002560 < 0:10:00)
Sun, 08 Apr 2018 11:17:41 DEBUG    Using cache (0:00:00.003036 < 0:10:00)
Sun, 08 Apr 2018 11:17:41 DEBUG    battery: 100
Sun, 08 Apr 2018 11:17:41 DEBUG    moisture: 42
Sun, 08 Apr 2018 11:17:41 DEBUG    conductivity: 411
Sun, 08 Apr 2018 11:17:41 DEBUG    timestamp: 2018-04-08T11:17:41.693878
Sun, 08 Apr 2018 11:17:41 DEBUG    temperature: 25.2
Sun, 08 Apr 2018 11:17:41 DEBUG    brightness: -11701
Sun, 08 Apr 2018 11:17:41 INFO     sent data to topic miflora/outdoor/
Sun, 08 Apr 2018 11:17:41 INFO     try 1 of 6: could not process sensor(s) plant. Waiting 1 sec for next try
Sun, 08 Apr 2018 11:17:42 INFO     Getting data from sensor plant
Sun, 08 Apr 2018 11:17:49 DEBUG    Received result for handle 56: 5E 15 32 2E 37 2E 30
Sun, 08 Apr 2018 11:17:49 DEBUG    Filling cache with new sensor data.
Sun, 08 Apr 2018 11:17:49 DEBUG    Received result for handle 53: 0D 01 00 F6 B7 01 00 3A C4 03 02 3C 00 FB 34 9B
Sun, 08 Apr 2018 11:17:49 DEBUG    Using cache (0:00:00.003350 < 0:10:00)
Sun, 08 Apr 2018 11:17:49 DEBUG    Using cache (0:00:00.004388 < 0:10:00)
Sun, 08 Apr 2018 11:17:49 DEBUG    Using cache (0:00:00.005298 < 0:10:00)
Sun, 08 Apr 2018 11:17:49 DEBUG    battery: 94
Sun, 08 Apr 2018 11:17:49 DEBUG    moisture: 58
Sun, 08 Apr 2018 11:17:49 DEBUG    conductivity: 964
Sun, 08 Apr 2018 11:17:49 DEBUG    timestamp: 2018-04-08T11:17:49.511048
Sun, 08 Apr 2018 11:17:49 DEBUG    temperature: 26.9
Sun, 08 Apr 2018 11:17:49 DEBUG    brightness: -18442
Sun, 08 Apr 2018 11:17:49 INFO     sent data to topic miflora/plant/
Sun, 08 Apr 2018 11:17:49 INFO     Disconnected MQTT connection
coveralls commented 6 years ago

Coverage Status

Coverage remained the same at ?% when pulling 0c8449b7647926d5248c756bad5f312d560e0739 on miflora into 8819655a91aba06e15566303fd201aad886dad9a on master.

ChristianKuehnel commented 6 years ago

@syssi Thx for the tests. I the issues you found should be fixed now.

I also deployed this version to one of my machines to get better test coverage.

ChristianKuehnel commented 6 years ago

have it running on one of my machines for a week. looks good --> merging