Skip to content

Commit 86116dd

Browse files
authored
Merge pull request #33 from vivo/alex_dev
修复温度单位为℉,上报不准问题
2 parents 7044738 + bd4b798 commit 86116dd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

custom_components/vivohomebridge/vbridge.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def diff_states(old_state, new_state):
276276
attributes_map.append(target_map)
277277
unit = new_attrs.get(CONF_UNIT_OF_MEASUREMENT)
278278
if device_class == SensorDeviceClass.TEMPERATURE:
279-
current_attrs[ATTR_TEMPERATURE] = VSensorModel.sensor_h2v_val(
279+
current_attrs["state"] = VSensorModel.sensor_h2v_val(
280280
device_class, unit, new_state.state
281281
)
282282
else:
@@ -621,10 +621,11 @@ def flush_device_status(self, reason: str, device: dict):
621621
attributes_map.append(target_map)
622622
unit = attributes.get(CONF_UNIT_OF_MEASUREMENT)
623623
if device_class == SensorDeviceClass.TEMPERATURE:
624-
attributes[ATTR_TEMPERATURE] = self.sensor_model.sensor_h2v_val(
624+
attributes["state"] = self.sensor_model.sensor_h2v_val(
625625
device_class, unit, device_state.state
626626
)
627-
attributes["state"] = device_state.state
627+
else:
628+
attributes["state"] = device_state.state
628629
elif device_platform == Platform.WATER_HEATER:
629630
attributes_map = self.water_heater_model.attributes_map
630631
attributes["state"] = device_state.state

0 commit comments

Comments
 (0)