Skip to content

Commit

Permalink
Merge pull request #36 from vladimir-babichev/main
Browse files Browse the repository at this point in the history
  • Loading branch information
megakid committed May 19, 2023
2 parents 1f44999 + 9eac7af commit 9fec589
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions custom_components/hildebrand_glow_ihd_mqtt/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
"name": "Smart Meter Electricity: Cost (Today)",
"device_class": SensorDeviceClass.MONETARY,
"unit_of_measurement": "GBP",
"state_class": None,
"state_class": SensorStateClass.TOTAL,
"icon": "mdi:cash",
"func": lambda js : round(js['electricitymeter']['energy']['import']['price']['standingcharge'] + \
(js['electricitymeter']['energy']['import']['day'] * js['electricitymeter']['energy']['import']['price']['unitrate']), 2),
Expand Down Expand Up @@ -206,7 +206,7 @@
{
"name": "Smart Meter Gas: Import (This week)",
"device_class": SensorDeviceClass.ENERGY,
"unit_of_measurement": ENERGY_KILO_WATT_HOUR,
"unit_of_measurement": ENERGY_KILO_WATT_HOUR,
"state_class": SensorStateClass.TOTAL_INCREASING,
"icon": "mdi:fire",
"func": lambda js : js['gasmeter']['energy']['import']['week']
Expand Down Expand Up @@ -250,7 +250,7 @@
"name": "Smart Meter Gas: Cost (Today)",
"device_class": SensorDeviceClass.MONETARY,
"unit_of_measurement": "GBP",
"state_class": None,
"state_class": SensorStateClass.TOTAL,
"icon": "mdi:cash",
"func": lambda js : round((js['gasmeter']['energy']['import']['price']['standingcharge'] or 0)+ \
((js['gasmeter']['energy']['import']['day'] or 0) * (js['gasmeter']['energy']['import']['price']['unitrate'] or 0)), 2),
Expand Down Expand Up @@ -284,7 +284,7 @@ async def mqtt_message_received(message: ReceiveMessage):

await mqtt.async_subscribe(
hass, data_topic, mqtt_message_received, 1
)
)



Expand All @@ -304,7 +304,7 @@ async def async_get_device_groups(deviceUpdateGroups, async_add_entities, device
deviceUpdateGroups[device_id] = groups

return deviceUpdateGroups[device_id]


class HildebrandGlowMqttSensorUpdateGroup:
"""Representation of Hildebrand Glow MQTT Meter Sensors that all get updated together."""
Expand Down Expand Up @@ -347,8 +347,8 @@ def __init__(self, device_id, name, icon, device_class, unit_of_measurement, sta
self._attr_state_class = state_class
self._attr_entity_category = entity_category
self._attr_should_poll = False
self._func = func

self._func = func
self._attr_device_info = DeviceInfo(
connections={("mac", device_id)},
manufacturer="Hildebrand Technology Limited",
Expand Down

0 comments on commit 9fec589

Please sign in to comment.