Glow / Hildebrand Display - Local MQTT Access - Template Help

I have the same issue as yourself, my IHD from both my supplier and Glow are showing values for usage which are off by a power of 1000. This must mean it is an issue with the supplier.

You aren’t by any chance with British Gas are you?

Hi @litepalmer , yes I am with British Gas! I thought the problem was fixed but it isn’t, so I have had to revert back to the DCC integration’s electricity cost entity.

Is yours showing the correct figures in the Energy column in the Sources box/card?

As another British Gas customer the numbers are also off by a power of 1000. I actually reported this to British Gas for their IHD and never got anywhere close to a resolution.

I have managed to resolve this in HA however.

I created a helper using the “Utility Meter” option and set the source as the import and then to reset daily. I then changed the Daily cost to use this as the source instead of the “Day” reading coming from the IHD.

Hi Rav101

I am getting the same issue did you manage to resolve this?

Thanks
Keith

Hi,
Thank you so much for taking the time to do this, firstly I have added the entities to the config.yaml but when I add the template and further 2 entities I get an error like @rav101 does about the error in the line.

Next when I try and add the sensors to the HA energy dashboard I get the following and wondered if anyone could help?

Hi all - proviso, never rely on me checking this forum as I do so once every several months, please contact support directly usually, thank you. In this case - do you all have L&G electricity meters? From speaking to L&G and Igloo we learnt there is a known bug on this meter which results in extremely low day/week/month consumption values, this is what you are seeing. The values are 1000 times lower than they should be which is why they seem to not appear at all.

L&G have advised that this is fixed in firmware version 38040202 or later - you can check your version in the Bright App (no idea if it is in the MQTT feed). You will need to ask your supplier to have your meter firmware updated; we recommend that you contact the Smart Meter Technical team.

We’ve had a few BG customers get very inaccurate replies from BG Customer Service - and are seeing if we can pursue this on your behalf via the DCC BG Account manager.

Hope this helps.

@rav101 @baffles

There was a problem with the indentation of those template sensors. I have updated my original post and fixed it. I must have messed it up at some point when copy/paste from my config files.

Have a try and let me know if you need any help.

3 months later…

I now use the lifetime cumulative registers from the meter and let the Energy dashboard chop them into daily, weekly, monthly totals. Apart from the very occasional hiccup, the registers are monotonically increasing with no glitches. I’ve had to bodge the standing charge (still can’t believe this isn’t a standard feature…) I have a template which clocks up 1Wh of consumption at midnight and then multiplies this by the standing charge x 1000 for each of gas and elec. Clumsy but it works, for now.

Need some help here…falling at the first hurdle :frowning:

Where do I put the first section of @robertalexa 's code?

I have most of my files split out into separate yaml files, and initially tried creating an mqtt.yaml, pasting in there and then referencing in my config.yaml. But it wont pass config check like that.

#split out files
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
switch: !include switch.yaml
sensor: !include sensor.yaml
mqtt: !include mqtt.yaml

ERROR -

Invalid config for [mqtt]: [mqtt] is an invalid option for [mqtt]. Check: mqtt->mqtt->mqtt. (See /config/configuration.yaml, line 16).

Line 16 is the sensor: include in the code above (the line before adding the mgtt include)

Tried putting them in the sensors.yaml, get an error trying to validate that way…

- platform: template
  sensors:
    current_grid_in_watts:
      friendly_name: "Grid Current Power_Watts"
      unit_of_measurement: "W"
      value_template: "{{ states('sensor.develco_zhemi101_8423021b_smartenergy_metering')|float / 4   }}"
      unique_id: '543534654798'
      device_class: power
- platform: template
  sensors:
    total_grid_in_kw:
      friendly_name: "Grid Used Power Kw"
      unit_of_measurement: "kw"
      value_template: "{{ states('sensor.develco_zhemi101_8423021b_smartenergy_metering_summation_delivered')|float / 4  }}"
      unique_id: '540094654795'
      device_class: power
- platform: template      
  sensors:
    office_right_socket_amps:
     friendly_name: "office right socket amps Shelly"
     unique_id: 'shelly_current_channel_1'
     unit_of_measurement: "A"
     value_template: "{{ (states('sensor.office_right_socket_shelly_watts') | float / states('sensor.office_right_socket_shelly_voltage') | float) | round(2)  }}"
     device_class: power
    office_left_socket_amps:
     friendly_name: "office left socket amps Shelly"
     unique_id: 'shelly_current_channel_2'
     unit_of_measurement: "A"
     value_template: "{{ (states('sensor.office_left_socket_power') | float / states('sensor.office_left_socket_voltage') | float) | round(2)  }}"
     device_class: power
    coffee_table_amps:
     friendly_name: "coffee table amps"
     unique_id: 'coffeetable_1'
     unit_of_measurement: "A"
     value_template: "{{ (states('sensor.coffee_table_power_watts') | float / 240 | float) | round(2)  }}"
     device_class: power
- mqtt:
  sensor:  
    - name: "Smart Meter Electricity: Export"
      unique_id: "smart_meter_electricity_export"
      state_topic: "glow/78E36DD0172C/SENSOR/electricitymeter"
      device_class: "energy"
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
      value_template: "{{ value_json['electricitymeter']['energy']['export']['cumulative'] }}"
      icon: "mdi:flash"
    - name: "Smart Meter Electricity: Import"
      unique_id: "smart_meter_electricity_import"
      state_topic: "glow/78E36DD0172C/SENSOR/electricitymeter"
      device_class: "energy"
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
      value_template: >
        {% if value_json['electricitymeter']['energy']['import']['cumulative'] == 0 %}
          {{ states('sensor.smart_meter_electricity_import') }}
        {% else %}
          {{ value_json['electricitymeter']['energy']['import']['cumulative'] }}
        {% endif %}
      icon: "mdi:flash"

ERROR -

Invalid config for [sensor]: required key not provided @ data[‘platform’]. Got None. (See /config/configuration.yaml, line 15).

Running out of skill now :wink:

In your mqtt file, but skip the mqtt heading (That is when people don’t split it in separate files and do everything from the configuration file).

Like this
image

1 Like

Booom…just like that. I was Sooo close :wink: Thank you so much…it was driving me nuts

All good on that piece, sensors all showing :slight_smile:

Should I add the cost templates to the mqtt file as well or should they go in maybe a separate templates file ?

EDIT - whacked in my config.yaml for now. Seems to be accepting it :slight_smile:

My approach was:
in configuration.yaml
image

PS: All my additional files are in an includes folder

Then in templates.yaml

Hope this helps

1 Like

Hi,
Does anyone know if it’s possible to either get or generate the current cost from data retrieved via MQTT? So like the cost per hour you can see on the CAD.

Thanks

Perfect, thanks @robertalexa !

One last question, is it possible to extract/add the ‘monitor individual devices’ section of the energy dashboard to add to your Lovelace version?

EDIT - Found it all at - Energy Cards - Home Assistant (home-assistant.io)

1 Like

Hi,
My CAD seems to not be sending “power” for Gas does something need to be enabled or has it been removed?

{
    "gasmeter": {
        "timestamp": "2022-10-15T08:46:05Z",
        "energy": {
            "import": {
                "cumulative": 11019.361,
                "day": 0,
                "week": 50.941,
                "month": 146.208,
                "units": "kWh",
                "cumulativevol": 987.06,
                "cumulativevolunits": "m3",
                "dayvol": 0,
                "weekvol": 50.941,
                "monthvol": 146.208,
                "dayweekmonthvolunits": "kWh",
                "mprn": "REDACTED",
                "supplier": "---",
                "price": {
                    "unitrate": 0.10424,
                    "standingcharge": 0.26627
                }
            }
        }
    }
}

This seems to be the only message it sends in relation to Gas. The electric equivalent has the extra power bit at the bottom.

Thanks

Gas power existed in the mqtt to start with but Glow has said they will remove it eventually because it is redundant and gas doesn’t need it. So they might have done that already

Thank you, sensor removed from my config. It did seem like it would be a little pointless as it updtes so infrequently.

I have created a current cost template should anyone want one

- name: "Smart Meter Electricity: Current Cost"
    unique_id: smart_meter_electricity_current_cost
    device_class: monetary
    unit_of_measurement: "GBP"
    state_class: "total_increasing"
    icon: mdi:cash
    state: "{{ (
        states('sensor.smart_meter_electricity_power') | float 
        / 1000 
        * states('sensor.smart_meter_electricity_import_unit_rate') | float
      ) | round(2) }}"

Note I convert my current power to watts so need to divide by 1000 if you are not converting kWh to W then you can just use the below.

  - name: "Smart Meter Electricity: Current Cost"
    unique_id: smart_meter_electricity_current_cost
    device_class: monetary
    unit_of_measurement: "GBP"
    state_class: "total_increasing"
    icon: mdi:cash
    state: "{{ (
        states('sensor.smart_meter_electricity_power') | float 
        * states('sensor.smart_meter_electricity_import_unit_rate') | float
      ) | round(2) }}"

@robertalexa I think I have found a problem with using stale records for Gas kWh. When my meter resets at midnight it reads 0 and we often don’t use any gas from midnight until 5am. This means that the stale record used to prevent zeros during the day causes the price to recalculate which then changes again when I get an actual reading.

Example:

  • Yesterday I used £1.46 of gas
  • Reset at midnight set this to 27p (standing charge)
  • It then when back to £1.46 shortly after as gas usage was the stale record
  • at around 4am we used some gas setting the daily cost to 93p
  • the energy dashboard now shows £2.39 of gas for today for 6.4kWh actual usage which should be 93p

Do I need to do a similar thing with the daily cost so that if gas from the MQTT reads zero, cost also equals zero as that would stop incorrect increments (I think)?

1 Like

Hi @hassio85

I am not seeing what you are seeing, so i suspect an issue with your mqtt feed data, possibly pushing wrong information?

Here is how my entities looked like for the last week

This sounds familiar to what someone else has encountering, but I do not fully remember the situation or the outcome. Please have a look at the replies above, as there will have steps about how to debug values from the mqtt feed to figure out which one (if any) is pushing erroneous data at weird times. It may be that you need specific way to combat your situation

Have a look and if you are stuck come back with some screenshots of your entities graphs, and we can check what is going wrong and when :slight_smile: