Help with Custom Energy Sensor

Currently, the only way I am able to obtain energy data from my provider is to download a csv with the hourly/daily/monthly values. I have automated that process and I want to feed in the daily values to my energy dashboard. I’m pretty sure I didn’t do something correctly because my custom sensors don’t show up anywhere (yes I rebooted HA) :slight_smile:

config:

- platform: mqtt
  sensor:
    device_class: "energy"
    state_topic: "energy_meter/total_consumption"
    name: "My Cass County Consumption"
    unit_of_measurement: "kWh"
- platform: mqtt
  sensor:
    name: "Daily Consumption"
    device_class: "energy"
    state_topic: "energy_meter/daily_consumption"
    unit_of_measurement: "kWh"

This is in the /sensors/energy.yaml file and my configuration.yaml references it like so: sensor: !include_dir_merge_list sensors/

Also, does it make sense to just publish yesterday’s energy to the daily consumption topic or to the total or both?

Any help would be greatly appreciated!

Home Assistant complained about my yaml and told me to remove the - platform: mqtt from the sensor. I did that, but I’m not sure that’s what I want and don’t see how I can communicate with the sensor if not through mqtt.

Okay. Made some headway by following this post. I now see my sensor.daily_consumption in the developer tools in HA. I can send it a value using MQTT and HA is definitely seeing it come through.

However, I can’t seem to find it in the Energy Dashboard configuration. It just doesn’t come up. I’m missing a step aren’t I?

Okay. Those of you that are following along, I now have my MQTT sensor setup in Home Assistant. I can change the state to an actual value using the correct topic.

sensor.daily_consumption

state_class: total
unit_of_measurement: kWh
device_class: energy
friendly_name: Daily Consumption

I can also find and see it on the energy dashboard.

My question now is, since this is a daily consumption total provided by my energy company, how do I tell HA Energy that it’s a daily value and not an hourly?

Hi @fischgeek,

I am on thin ice and others might be better in answering your question.

In my setup, I have a hand full of sensors, where I get energy data and one sensor, where I get the water consumption of our house.
All those sensors provide values every x minutes - or whenever there is a change.

I then user a helper sensor (-> utility meter), that gathers the data and periodically resets to zero. (daily or monthly)
There is a GUI version, so no need for yaml. Settings → Devices → Helpers

So, as far as I understand, your provider already gives you data, that basically resets to zero daily? As far as I know, you can just take your sensor and add it to your energy dashboard. I guess, it will take your data and show your daily consumption - well, only one value per day. If you look at weekly or monthly data, that shouldn’t be an issue.

Hope, this helps - and hope you get a confirmation from someone else… :slight_smile:

One recommendation: buy a Shelly 3EM or one of their newer versions. Mine is running for 1.5 years and never made any problems.

Energy Dashboard

my own dashboard

Chris

Argh! Utility Helper! Should’ve checked there first. Thank you!

Quick logistical question though…

I have an automation that goes out to my provider’s site and fetches a csv with any data I ask for (in this case yesterday’s usage). So, each morning this automation kicks off and will get the number for “yesterday”, then it’s just a matter of updating my MQTT sensor that the Utility Meter Helper looks at. I setup the meter helper to reset each month with a zero day offset.

Does that process sound like it will work to you? Also, how does the utility meter helper or the energy dashboard know that my data I’m giving it is for “yesterday”?

I cannot answer that question. Sorry.
In my experience, it is very difficult to put in data for any other point in time then now. Well, at least I don’t know how to do it.

It might be easier to buy a Shelly 3EM. :slight_smile:

Easier yes. Cheaper no. :laughing:

Hello all,
@fischgeek your last past question is about act in db directly (date focus).
I am on the same way before to buy a LIXEE module (electric comsumption)
A way to insert past data you probably already seen → How to import historical energy data (Toon and others)

Thanks for continuing to speak alone while thinking of helping others later.