'Cost today' to Home Assistant via local MQTT
HI,
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?
Thanks!
Comments
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.
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.
In homeassistant, go to the energy dashboard and edit it. You can use the instantaneous reading for power\gas from your CAD\MQTT to determine usage and take the cost of the energy from a completely different metric, in this case your current octopus rate (you'll obviously need the octopus energy integration to grab this).
HA will then combine the two figures together to give you an accurate cost per day on the energy tab. There's other ways to do this with a simple calculation to create new entities with templates etc... but the above is the easiest.
This website won't let me inset a screenshot but here's a link to the electricity config in my energy dashboard.
https://i.imgur.com/ifycaN9.png
Thanks - that one's accurate, but cannot be accessed from anywhere other than the Energy dashboard. Which I also find baffling; not sure of the value in me setting up an identical sensor when the HA team could just expose that one for use wherever anyone wanted it.
It is weird that this isn't available.
There is a hacky way around it here, but not ideal.
https://community.home-assistant.io/t/energy-dashboard-how-to-use-the-costs-as-entity/593262/2