Glow / Hildebrand Display - Local MQTT Access - Template Help

Thank you @robertalexa for an excellent configuration. Works a treat.
I do have one issue with it and I have not been able to figure out how to use the data to work around this.
The issue is that the “Smart Meter Electricity: Cost (Today)” templates are fine if you are on a fixed tariff. I have been trying to work out how to make sure that each reported KWH from MQTT is recorded with its own unit rate and then added up, but my limited understanding of things is getting in the way.
Is there anyone on here that has either worked this out or knows what can be done for this?

Thank you and regards,
Chris.

Hi @c-home-assistant

As far as I know there is no such thing yet. I know @resoai has had a play with it but he was not considering it stable. Maybe in the future things will change :slight_smile:

Thanks for your help. I have raised a meter firmware upgrade request with British Gas but I remain doubtful the software issue will be fixed…

Hi @robertalexa I’ve tried setting up my energy tracking today. I can see values coming through on all the mqtt sensors, but when trying to configure gas consumption I don’t get any available drop downs. configuring electricity consumption is fine.

1 Like

I’ve run in to the same issue today as @RobertAmour . I’ve checked the two sensors and the gas and electricity are set-up exactly the same with the correct yaml in place for statistics but the electricity appears in the drop-down and the gas doesn’t. It’s odd.

1 Like

@RobertAmour @neil.sayer This appears to be a bug introduced by HA in some recent update. The statistics don’t show up for me in the dropdown either, but my Energy dashboard was working fine. I have tried to set the entity manually, just to test for you, and it broke for me too. And can’t revert to the correct Long Term Statistic. Sad moment :frowning:

I will look tomorrow and see if there are any open issues on HA, I have doubled checked the long term statistics and nothing changed there, but I know HA released some things to do with gas entities and changing the unit of measurement.

WIll keep you updated

LE: Energy dashboard doesn't allow adding MWh / GJ for Gas · Issue #81496 · home-assistant/core · GitHub

1 Like

For people that want to work around this issue:

You will have to manually edit a HA file:
.storage/energy

In there you will find something like this, where you have your previously added import. Add the gas bit manually. Don’t forget to restart HA after.

    "energy_sources": [
      {
        "type": "grid",
        "flow_from": [
          {
            "stat_energy_from": "sensor.smart_meter_electricity_import",
            "stat_cost": "sensor.smart_meter_electricity_cost_today",
            "entity_energy_price": null,
            "number_energy_price": null
          }
        ],
        "flow_to": [
          {
            "stat_energy_to": "sensor.smart_meter_electricity_export",
            "stat_compensation": null,
            "entity_energy_price": null,
            "number_energy_price": 0.15
          }
        ],
        "cost_adjustment_day": 0.0
      },
      {
        "type": "gas",
        "stat_energy_from": "sensor.smart_meter_gas_import",
        "stat_cost": "sensor.smart_meter_gas_cost_today",
        "entity_energy_price": null,
        "number_energy_price": null
      },

Deffo a HA bug, hand in tight, will all be fine soon :slight_smile:

1 Like

Thanks @robertalexa - workaround works perfectly.

1 Like

@robertalexa yep, works spot on. Thank you.

Hi. I’m new to using HomeAssistant, HACS and the Glow IHD/CAD.

With thanks to help from samsharp99 over on GitHub I’ve now installed the custom repository by megakid. It is quite simply superb and many thanks for making this available.

One question. On the energy monitor my total gas vol import for the day is remaining at 0kWh but I can see the incremental daily vols are correct. Why doesn’t the total for the day equal the last published figure?

Unfortunately I am not up to speed with any of the changes that megakid did on his repo. All i know is he took insipiration from here and did that, but I am not sure if he kept it up to date or deviated from the code I have provided in the second post.

So my advice would be to try and ask on his repo as an issue and see what advice he can provide.

I intend to create a HACS repo in the near future so I can keep things easier for people and be able to offer support and updates in a standardised fashion

3 Likes

@robertalexa
Right from when I first requested help in templating the local MQTT feed your input into this topic has been invaluable. As such I, for one, would really welcome a properly maintained HACS integration.

Thanks for the kind words. I would truly like to do that too, but my spare time is really limited at the moment. Will do my best to find some time sooner rather than later

Thanks @robertalexa I will ask on his repo page and see what happens.

Look forward to any HACS install you may offer in the future because whilst I enjoy reading what has been written I’m still very much working my way through all of this and a custom repo helped a lot.

I’ve been trying to do a calculated export since my provider is one of those that doesn’t set the field in the smart meter (also the prices are way off, but that’s something I’ll take up with them sometime).

The plan was to first take negative import to create an export:

  - name: "Smart Meter Electricity: Export Power"
    unique_id: smart_meter_electricity_export_power
    device_class: power
    unit_of_measurement: "kW"
    state_class: "measurement"
    icon: mdi:flash
    state: >
      {% set value = states('sensor.smart_meter_electricity_power') | float %}
      {{ -value if value < 0 else 0 }}

Then convert this to a total in the sensors.yaml:

- platform: integration
  source: sensor.smart_meter_electricity_export_power
  name: "Smart Meter Electricity: Export (Calculated)"
  unique_id: smart_meter_electricty_export_calculated
  unit_prefix: k
  round: 2
  method: left

The problem is smart_meter_electricity_export_power never appears in the entity list, so I can’t tell if it’s working - there are no errors in the logs. The second one does appear so it has recognised the entity exists otherwise it’d fail on the source line… So there’s likely an error there but it’s not showing up anywhere.

Alas testing is somewhat unreliable as it’s winter… I might get some export tomorrow or maybe not for weeks depending on the weather.

@robertalexa I’m relatively new to HA but I’d also like to offer my thanks for what you and others have done here. I found it invaluable in bootstrapping me into getting my Glow IHD working with MQTT.

Similar to some of the other posters, I too am having funny Smart Meter Gas: Import (Today) readings, but I’m checking those out at present with a Debug entry and also a Utility Meter Helper setup. I’ll decide which way to jump in a couple of days once I collect a few days more data.

I exchanged a couple of emails with Hildebrand Support a few weeks ago over a different subject, and they hinted that they are considering releasing their own HA Integration for the Glow IHD, as they are aware there are several offerings about and support for them seems to be patchy. Whether this might be a DCC or Local MQTT integration, whether it will be HACS or their own repo, I have no idea. I did tell them that I thought the community would welcome such a move, so I hope I haven’t trodden on anyones toes!
Regards

@Tech49 Glad you found this useful. Let me know how your debugging goes and if you think i can help in any way!

As to Hildebrand doing their own integration, that would be absolutely epic on their side and I will 100% support them in that direction. As much as I am a big fan of open source and community written pieces of code, knowing that you have the same team of people that develop the physical device do the software integration as well means they can syncronise releases, there should be no unexpected changes, no fires to put out in a rush. So if they go that direction, I can only applaud the effort, of course for as long as they actually look after their product - we all know there are brands out there who did something and then it became a forgotten thing. Of course I can’t speak on behalf of the team of guys looking after the DCC integration, but i am sure they would be happy to see their original implementation be re-used for the greater benefit of the community :slight_smile:

@robertalexa Thank you for your very positive reply. It’s obvious, even to me, from reading this thread, that the way that Smart Electricity and Gas Meters seem to be rolled out here in the UK at least, is far from ideal, with each meter brand/energy supplier seemingly doing their own thing when it comes to local MQTT integrations. How Hildebrand would deal with this diversity might well be a factor in any decision they come to. But Smart Homes with reatime data are here to stay, and there’s an opportunity for someone to establish a market lead. I’ll certainly be having a conversation with Octopus as to why they didn’t offer me an IHD with CAD instead of the one that now sits in a box in the loft

I had similar issues. I now use the lifetime cumulative values from the Glow IHD as state_class : total_increasing and let the Energy Dashboard sort it out. The daily kWh readings for both electricity and gas in HA now much my IHD to a tiny fraction of a kWh, which is good enough for me.

Mine broke too, unsurprisingly. Gas consumption still worked but the fudge I built to add the standing charge broke. Poking around in Energy Dashboard only broke it more! Your post reminded me that I could restore .storage/energy from a backup so I’ve got most of it back - thanks!

2022-11-18 00:00:00.018 ERROR (MainThread) [homeassistant.helpers.event] Error while processing state change for sensor.gas_standing_charge
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/util/unit_conversion.py", line 71, in convert
from_ratio = cls._UNIT_CONVERSION[from_unit]
KeyError: 'Wh'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 284, in _async_state_change_dispatcher
hass.async_run_hass_job(job, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 573, in async_run_hass_job
hassjob.target(*args)
File "/usr/src/homeassistant/homeassistant/components/energy/sensor.py", line 424, in async_state_changed_listener
self._update_cost()
File "/usr/src/homeassistant/homeassistant/components/energy/sensor.py", line 390, in _update_cost
converted_energy_price = converter(
File "/usr/src/homeassistant/homeassistant/util/unit_conversion.py", line 73, in convert
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Wh is not a recognized volume unit.
1 Like