'Cost today' to Home Assistant via local MQTT


I have Home Assistant pulling in info from our Glow IHD/CAD on a SMETS2 meter. This all works nicely - I can see our daily, weekly, monthly and total import values (kWh), along with daily standing charge and unit rate. However, I've never been able to pull today's actual financial cost across. When on a fixed tariff this would just be a simple calculation, but we are on Octopus Agile so I'm foxed as to how to calculate daily cost across each half-hourly tariff. It appears the simplest option would be to import 'Cost so far today' from the Glow, but it doesn't seem to be exposed as a sensor on MQTT/Home Assistant.

Is there some clever way to do this, that I'm just not familiar with, or does it all boil down to half-hourly calculations in Home Assistant every day?



  • I have a daily gas and electricity cost today sensor but I have the energy dashboard setup and use the import rate entity and view everything on there.

  • Did your daily cost today sensors set themselves up via MQTT? Or are they Template sensors you've set up yourself?

  • The CAD reports meter information via MQTT, which at the moment doesn't have this information. Instead it just has a fixed value (mine is set to 0.1575).

    I've got this implemented via node-red on my Unraid server however; I'm sure Home Assistant has some way to do it too.

    • Call Octopus API and grab the 30min p/KWh rates
    • Subscribe to the MQTT topic on the MQTT broker
    • Run a calculation to work out cost p/KWh now
    • Publish this as a new MQTT topic for other devices to pickup

    If, of course, you want this rolled up daily then you can either store those 30min values somewhere and add them up, or work out the average p/KWh rate across the course of the day and times this by your daily usage.

Sign In or Register to comment.