lywsd03mmc AttributeError passive
See original GitHub issueDescribe the bug When added 2 lywsd03mmc getting error when start deamon lywsd03mmc running custom firmware and advertising type set to custom Config
manager:
sensor_config:
topic: homeassistant
retain: true
topic_subscription:
update_all:
topic: homeassistant/status
payload: online
command_timeout: 120
workers:
lywsd03mmc:
args:
devices:
657: A4:C1:38:04:E6:57
54E: A4:C1:38:A2:D5:4E
topic_prefix: mijasensor_gen2
update_interval: 240
passive: false
Debug gateway logs run gateway.py with -d switch and paste formatted output log
2021-01-05 00:22:32,446 DEBUG bt-mqtt-gw.workers_manager workers_manager.py:83:register_workers - Added thermostat config with a 2 seconds timeout
2021-01-05 00:22:32,451 DEBUG bt-mqtt-gw.workers_manager workers_manager.py:93:register_workers - Added thermostat worker with 240 seconds interval and a 120 seconds timeout
2021-01-05 00:22:33,551 INFO bt-mqtt-gw.workers.lywsd03mmc lywsd03mmc.py:15:_setup - Adding 2 lywsd03mmc devices
2021-01-05 00:22:33,553 INFO bt-mqtt-gw.workers.lywsd03mmc lywsd03mmc.py:18:_setup - Adding lywsd03mmc device '657' (A4:C1:38:04:E6:57)
Traceback (most recent call last):
File "./gateway.py", line 83, in <module>
manager.register_workers(global_topic_prefix)
File "/home/pi/bt-mqtt-gateway/workers_manager.py", line 78, in register_workers
command_timeout, global_topic_prefix, **worker_config["args"]
File "/home/pi/bt-mqtt-gateway/workers/base.py", line 9, in __init__
self._setup()
File "/home/pi/bt-mqtt-gateway/workers/lywsd03mmc.py", line 19, in _setup
self.devices[name] = lywsd03mmc(mac, timeout=self.command_timeout, passive=self.passive)
AttributeError: 'Lywsd03MmcWorker' object has no attribute 'passive'
Server (please complete the following information):
- Distro: Raspbian
Issue Analytics
- State:
- Created 3 years ago
- Comments:30 (13 by maintainers)
Top Results From Across the Web
Passive BLE Monitor integration (Xiaomi Mijia BLE MiBeacon ...
I just want to see if I can make my Xiaomi “Temperature and Humidity Monitor 2” LYWSD03MMC sensors working on a fresh installation...
Read more >FAQ | Passive BLE Monitor integration - GitHub Pages
Passively monitors BLE messages from Xiaomi Mijia BLE MiBeacon, Qingping, ATC, ... I get AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH' in ...
Read more >bt-mqtt-gateway - Bountysource
A simple Python script which provides a Bluetooth to MQTT gateway, easily extensible via custom workers. See [Wiki](https://github.com/zewelor/bt-mqtt-gateway/ ...
Read more >https://raw.githubusercontent.com/custom-component...
"""Passive BLE monitor sensor platform. ... _unit_of_measurement = old_state.unit_of_measurement except AttributeError: pass self.
Read more >Home Assistant Xiaomi Temperature & Humidity Sensor ...
Add Passive BLE Monitor custom component in Home Assistant ... Xiaomi Temperature & Humidity Sensor LYWSD03MMC from 1 to 4pcs (AliExpress ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The format is expected to change to new “HA_BLE” in newer versions when it becomes available in Home Assistant. Participate in Support home brew DIY sensors After the formation of a new version, the format ATC1441 will no longer be supported.
There is something wrong for sure with the calculation of the temperature when the temperature goes below zero (not sure about the exact value). I am running passive mode with the ATC firmware from @pvvx, with advertising mode set as atc1441.
2021-01-28 22:15:47,346 DEBUG bt-mqtt-gw.workers.lywsd03mmc lywsd03mmc.py:39:status_update - a4:c1:38:8f:ea:f5 - received scan data 1a18a4c1388feaf500e5285c0bd6de 2021-01-28 22:15:47,347 DEBUG bt-mqtt-gw.workers.lywsd03mmc lywsd03mmc.py:39:status_update - a4:c1:38:35:90:c4 - received scan data 1a18a4c1383590c4ffe452440b0414 2021-01-28 22:15:47,348 DEBUG bt-mqtt-gw.workers.lywsd03mmc lywsd03mmc.py:87:readAll - a4:c1:38:8f:ea:f5 - found values 22.900000, 40, 92 2021-01-28 22:15:47,349 DEBUG bt-mqtt-gw.workers.lywsd03mmc lywsd03mmc.py:87:readAll - a4:c1:38:35:90:c4 - found values 6550.800000, 82, 68
So the data with temperature ‘ffe4’ gets converted to a temp of 6550.800000. The calculation seems wrong:
int(data[16:20], 16) / 10
Compare this with the calculation that is done in this https://github.com/JsBergbau/MiTemperature2 where it works fine:
temperature = int.from_bytes(bytearray.fromhex(data[16:20]),byteorder='big',signed=True) / 10.
@westenberg