Skip to content

Commit

Permalink
Sensor type state attribute.
Browse files Browse the repository at this point in the history
I think, the component is pretty stable for public beta #7
  • Loading branch information
Magalex2x14 committed Dec 1, 2019
1 parent cb4addf commit b43e549
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions custom_components/mitemp_bt/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,18 +322,13 @@ def discover_ble_devices(config):
sensors = [TemperatureSensor(mac), HumiditySensor(mac)]
sensors_by_mac[mac] = sensors
add_entities(sensors)
getattr(sensors[0], "_device_state_attributes")[
"last packet id"
] = lpacket[mac]
getattr(sensors[1], "_device_state_attributes")[
"last packet id"
] = lpacket[mac]
getattr(sensors[0], "_device_state_attributes")[
"rssi"
] = lrssi[mac]
getattr(sensors[1], "_device_state_attributes")[
"rssi"
] = lrssi[mac]
for sensor in sensors:
getattr(sensor, "_device_state_attributes")[
"last packet id"] = lpacket[mac]
getattr(sensor, "_device_state_attributes")[
"rssi"] = lrssi[mac]
getattr(sensor, "_device_state_attributes")[
"sensor type"] = stype[mac]
if mac in batt:
getattr(sensors[0], "_device_state_attributes")[
ATTR_BATTERY_LEVEL
Expand Down

0 comments on commit b43e549

Please sign in to comment.