Glow / Hildebrand Display - Local MQTT Access - Template Help

My Smart Gas meter sometimes loses connection with the smart electricity meter. It usual sorts itself out after some time. I’ve noticed that Bright app can backfill the missing data into the previously zero time slots. This is a nice feature but the integration doesn’t seem to pick up this delayed information but just lumps it into the next data point.

I’ve no idea what might be involved but do you think it might be possible to emulate the bright app with this integration or is that going to be too much effort?

Thanks

This unfortunately is not possible due to how Home Assistant tracks history and statistics. Neither of these can be backfilled (set a data value for a previous point in time). Data can only be added to the current point in time, which means the whole difference between last reading the current reading is associated with NOW. So in the statistics of the energy dashboard this is plotted (correctly as far as the sensor is concerned) to the last time interval.

This is indeed a nuissance but nothing we can do for now. This issue for example is very prominent when using the Octopus (UK energy provider) (maybe even others) components. Octopus makes data available for the previous 30 mins, but at 12AM that data, which was meant to be 11:30PM to 12:00 it then logged badly onto the next day.

Maybe this will change in the future of Home Assistant and workarounds can be created.

In your case, if for example you get the last reading at 12 for 1000 units, and the next reading at 5 for 1100 units, the energy dashboard will show all 100 units difference plotted on the 4 to 5 time interval. Unit wise and costs etc will still be correct, just the time of the usage is incorrect. But it is doing the correct thing, unfortunately your data source is unstable

1 Like

Thanks for your helpful reply, I’ll keep my fingers crossed that one day the tool for adjusting long term statistics can do export and import. I see it’s been asked for in the WTH section:

WTH is there still no option to export/import long term statistics

So I’ve voted for that.

Thanks again.

1 Like

@robertalexa code has been running for a week now and it has been perfect. It would obviously need the offset adjusting per meter but that would be easy enough to adjust after the first night. Daily cost on the energy dashboard has matched that of the meter itself.

Thanks

1 Like

For ref, the simplest way to work around the UTC timestamp issue during BST (‘Today’/‘This Week’/‘This Month’ counters reset at 1am instead of at 12am) in Home Assistant is to configure a custom utility meter helper which is fed from the …meter/energy/import/cumulative entry and resets every day (or every week, or every month). The reset time is then defined by the HA environment which is under your full control, i.e. stays at 12am the whole year. Simple but very effective. Significant if you use e.g. a cheaper nightly tariff starting at 0:30am which would be otherwise added to the previous day.

I recently had my British Gas Landis Gyr E470 meter installed, however I have a weird situation where the Electricity Import figure is calculated in MWh rather than kWh and therefore it’s reported incorrectly on the MQTT topic. To fix the issue I have to add a multiplier in the template. Oddly the £ cost figures are correctly reported on the Glow CAD and Glow application. It’s like the meter has been incorrectly setup by the engineer with the energy wrong units. Has anyone else experienced this situation? I found this external thread with the same issue

Here is the modified template with the x 1000 multiplier to convert 1 megawatt (MW) which equals 1,000 kilowatts (kW).

state: >-
  {{ ((states('sensor.smart_meter_electricity_import_today') | float * 1000
  * states('sensor.smart_meter_electricity_import_unit_rate') | float) 
  + states('sensor.smart_meter_electricity_import_standing_charge') | float)
  | round(2) }}

there are a number of people, in this thread, reporting the same.

Thanks for the tip, I found this answer here! Glow / Hildebrand Display - Local MQTT Access - Template Help - #114 by JaneatGlow

@JaneatGlow can you share the release notes for the L&G firmware (38040202)?

Jane is not really that present on the HA forums, so you are better off sending an email to [email protected] where you can reach Jane via their official channels. Alternatively you could post on their forum.

However I wouldn’t bet too much money on Glow having detailed release notes for hardware that is not theirs :slight_smile:

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