If anyone is looking to use MQTT Discovery to pull all the sensors into one device then I have scripted this. So assuming you have the MQTT side of things all up and running
- Copy code to notepad
- find and replace REDACTED with the MAC address of your IHD (without the colons)
- Create a new automation in HA
- Click the button to edit YAML
- Copy and paste that code that now includes the MAC of your IHD
- Save automation (Giving it whatever name you want)
- Run it
This will create an electric and gas meter device and add all the sensors underneath. You still need to add the daily cost templates if you want them.
description: ""
mode: single
trigger: []
condition: []
action:
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_electricity_export/config
payload: >-
{
"name": "Smart Meter Electricity: Export",
"unique_id": "smart_meter_electricity_export",
"state_topic": "glow/REDACTED/SENSOR/electricitymeter",
"device_class": "energy",
"unit_of_measurement": "kWh",
"state_class": "total_increasing",
"value_template": "{% raw %}{{ value_json['electricitymeter']['energy']['export']['cumulative'] }}{% endraw %}",
"icon": "mdi:flash",
"device": {
"identifiers": "Smart Electricity Meter via IHD",
"name": "smart_electricty_meter_REDACTED",
"model": "Smart Electricity Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_electricity_import/config
payload: >-
{
"name": "Smart Meter Electricity: Import",
"unique_id": "smart_meter_electricity_import",
"state_topic": "glow/REDACTED/SENSOR/electricitymeter",
"device_class": "energy",
"unit_of_measurement": "kWh",
"state_class": "total_increasing",
"value_template": "{% raw %} {% if value_json['electricitymeter']['energy']['import']['cumulative'] == 0 %} {{ states('sensor.smart_meter_electricity_import') }} {% else %} {{ value_json['electricitymeter']['energy']['import']['cumulative'] }} {% endif %}{% endraw %}",
"icon": "mdi:flash",
"device": {
"identifiers": "Smart Electricity Meter via IHD",
"name": "smart_electricty_meter_REDACTED",
"model": "Smart Electricity Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_electricity_import_today/config
payload: >-
{
"name": "Smart Meter Electricity: Import (Today)",
"unique_id": "smart_meter_electricity_import_today",
"state_topic": "glow/REDACTED/SENSOR/electricitymeter",
"device_class": "energy",
"unit_of_measurement": "kWh",
"state_class": "measurement",
"value_template": "{% raw %} {% if value_json['electricitymeter']['energy']['import']['day'] == 0 and now() > now().replace(hour=0).replace(minute=1).replace(second=0).replace(microsecond=0) %} {{ states('sensor.smart_meter_electricity_import_today') }} {% else %} {{ value_json['electricitymeter']['energy']['import']['day'] }} {% endif %}{% endraw %}",
"icon": "mdi:flash",
"device": {
"identifiers": "Smart Electricity Meter via IHD",
"name": "smart_electricty_meter_REDACTED",
"model": "Smart Electricity Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_electricity_import_week/config
payload: >-
{
"name": "Smart Meter Electricity: Import (This week)",
"unique_id": "smart_meter_electricity_import_week",
"state_topic": "glow/REDACTED/SENSOR/electricitymeter",
"device_class": "energy",
"unit_of_measurement": "kWh",
"state_class": "measurement",
"value_template": "{% raw %}{{ value_json['electricitymeter']['energy']['import']['week'] }}{% endraw %}",
"icon": "mdi:flash",
"device": {
"identifiers": "Smart Electricity Meter via IHD",
"name": "smart_electricty_meter_REDACTED",
"model": "Smart Electricity Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_electricity_import_month/config
payload: >-
{
"name": "Smart Meter Electricity: Import (This month)",
"unique_id": "smart_meter_electricity_import_month",
"state_topic": "glow/REDACTED/SENSOR/electricitymeter",
"device_class": "energy",
"unit_of_measurement": "kWh",
"state_class": "measurement",
"value_template": "{% raw %}{{ value_json['electricitymeter']['energy']['import']['month'] }}{% endraw %}",
"icon": "mdi:flash",
"device": {
"identifiers": "Smart Electricity Meter via IHD",
"name": "smart_electricty_meter_REDACTED",
"model": "Smart Electricity Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_electricity_import_unit_rate/config
payload: >-
{
"name": "Smart Meter Electricity: Import Unit Rate",
"unique_id": "smart_meter_electricity_import_unit_rate",
"state_topic": "glow/REDACTED/SENSOR/electricitymeter",
"device_class": "monetary",
"unit_of_measurement": "GBP/kWh",
"state_class": "measurement",
"value_template": "{% raw %}{{ value_json['electricitymeter']['energy']['import']['price']['unitrate'] }}{% endraw %}",
"icon": "mdi:cash",
"device": {
"identifiers": "Smart Electricity Meter via IHD",
"name": "smart_electricty_meter_REDACTED",
"model": "Smart Electricity Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_electricity_import_standing_charge/config
payload: >-
{
"name": "Smart Meter Electricity: Import Standing Charge",
"unique_id": "smart_meter_electricity_import_standing_charge",
"state_topic": "glow/REDACTED/SENSOR/electricitymeter",
"device_class": "monetary",
"unit_of_measurement": "GBP",
"state_class": "measurement",
"value_template": "{% raw %}{{ value_json['electricitymeter']['energy']['import']['price']['standingcharge'] }}{% endraw %}",
"icon": "mdi:cash",
"device": {
"identifiers": "Smart Electricity Meter via IHD",
"name": "smart_electricty_meter_REDACTED",
"model": "Smart Electricity Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_electricity_power/config
payload: >-
{
"name": "Smart Meter Electricity: Power",
"unique_id": "smart_meter_electricity_power",
"state_topic": "glow/REDACTED/SENSOR/electricitymeter",
"device_class": "power",
"unit_of_measurement": "kW",
"state_class": "measurement",
"value_template": "{% raw %} {% if value_json['electricitymeter']['power']['value'] < 0 %} {{ states('sensor.smart_meter_electricity_power') }} {% else %} {{ value_json['electricitymeter']['power']['value'] }} {% endif %}{% endraw %}",
"icon": "mdi:flash",
"device": {
"identifiers": "Smart Electricity Meter via IHD",
"name": "smart_electricty_meter_REDACTED",
"model": "Smart Electricity Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_gas_import/config
payload: >-
{
"name": "Smart Meter Gas: Import",
"unique_id": "smart_meter_gas_import",
"state_topic": "glow/REDACTED/SENSOR/gasmeter",
"device_class": "energy",
"unit_of_measurement": "kWh",
"state_class": "total_increasing",
"value_template": "{% raw %} {% if value_json['gasmeter']['energy']['import']['cumulative'] == 0 %} {{ states('sensor.smart_meter_gas_import') }} {% else %} {{ value_json['gasmeter']['energy']['import']['cumulative'] }} {% endif %}{% endraw %}",
"icon": "mdi:fire",
"device": {
"identifiers": "Smart Gas Meter via IHD",
"name": "smart_gas_meter_REDACTED",
"model": "Smart Gas Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_gas_import_today/config
payload: >-
{
"name": "Smart Meter Gas: Import (Today)",
"unique_id": "smart_meter_gas_import_today",
"state_topic": "glow/REDACTED/SENSOR/gasmeter",
"device_class": "energy",
"unit_of_measurement": "kWh",
"state_class": "measurement",
"value_template": "{% raw %} {% if value_json['gasmeter']['energy']['import']['day'] == 0 and now() > now().replace(hour=0).replace(minute=1).replace(second=0).replace(microsecond=0) %} {{ states('sensor.smart_meter_gas_import_today') }} {% else %} {{ value_json['gasmeter']['energy']['import']['day'] }} {% endif %}{% endraw %}",
"icon": "mdi:fire",
"device": {
"identifiers": "Smart Gas Meter via IHD",
"name": "smart_gas_meter_REDACTED",
"model": "Smart Gas Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_gas_import_week/config
payload: >-
{
"name": "Smart Meter Gas: Import (This week)",
"unique_id": "smart_meter_gas_import_week",
"state_topic": "glow/REDACTED/SENSOR/gasmeter",
"device_class": "energy",
"unit_of_measurement": "kWh",
"state_class": "measurement",
"value_template": "{% raw %}{{ value_json['gasmeter']['energy']['import']['week'] }}{% endraw %}",
"icon": "mdi:fire",
"device": {
"identifiers": "Smart Gas Meter via IHD",
"name": "smart_gas_meter_REDACTED",
"model": "Smart Gas Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_gas_import_month/config
payload: >-
{
"name": "Smart Meter Gas: Import (This month)",
"unique_id": "smart_meter_gas_import_month",
"state_topic": "glow/REDACTED/SENSOR/gasmeter",
"device_class": "energy",
"unit_of_measurement": "kWh",
"state_class": "measurement",
"value_template": "{% raw %}{{ value_json['gasmeter']['energy']['import']['month'] }}{% endraw %}",
"icon": "mdi:fire",
"device": {
"identifiers": "Smart Gas Meter via IHD",
"name": "smart_gas_meter_REDACTED",
"model": "Smart Gas Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_gas_import_unit_rate/config
payload: >-
{
"name": "Smart Meter Gas: Import Unit Rate",
"unique_id": "smart_meter_gas_import_unit_rate",
"state_topic": "glow/REDACTED/SENSOR/gasmeter",
"device_class": "monetary",
"unit_of_measurement": "GBP/kWh",
"state_class": "measurement",
"value_template": "{% raw %}{{ value_json['gasmeter']['energy']['import']['price']['unitrate'] }}{% endraw %}",
"icon": "mdi:cash",
"device": {
"identifiers": "Smart Gas Meter via IHD",
"name": "smart_gas_meter_REDACTED",
"model": "Smart Gas Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true
- service: mqtt.publish
data:
topic: homeassistant/sensor/smart_meter_gas_import_standing_charge/config
payload: >-
{
"name": "Smart Meter Gas: Import Standing Charge",
"unique_id": "smart_meter_gas_import_standing_charge",
"state_topic": "glow/REDACTED/SENSOR/gasmeter",
"device_class": "monetary",
"unit_of_measurement": "GBP",
"state_class": "measurement",
"value_template": "{% raw %}{{ value_json['gasmeter']['energy']['import']['price']['standingcharge'] }}{% endraw %}",
"icon": "mdi:cash",
"device": {
"identifiers": "Smart Gas Meter via IHD",
"name": "smart_gas_meter_REDACTED",
"model": "Smart Gas Meter via IHD",
"manufacturer": "Hildebrand"
}
}
retain: true