Help creating entity for energy dashboard

Hi everybody,

I have a bitShake SmartMeterReader. This is an ESP32 device running tasmota that attaches to your power meter (I guess similar to EDL21?).

It will provide these entities:

(off topic, but I thought this was weird/funny, so I’ll mention it: those values that are currently all at 0.0 are not available yet, because I needed to ask a PIN from my power supplier; once I receive this PIN, I will have to enter it into my power meter via torch/flashlight in order to access those values!!! Not a joke. This seems to be standard practice with German power suppliers and their digital energy meters :smiley: ).

Anyway: I need the SM 1_8_0 and SM 2_8_0 to be available here:

If I click on VERBRAUCH HINZUFÜGEN / RÜCKGABE HINZUFÜGEN (add consumption / add return, or similar), they are not available. It says “After setting up new devices, it can take up to 2 hours until they will appear in your energy dashboard”, but it has been almost 24 hours by now, and they are not there.

Well, these don’t have a unit_of_measurement set:

So I created these entities, hoping they would allow me to use them in my energy dashboard (example only for sm_1_8_0, same for the other one though)

template:
  - sensor:
      name: "00/Unten/Eingangsbereich/Zaehler" # ¹
      unique_id: 2023271350000
      device_class: energy
      state: '{{ states("sensor.bitshake_smartmeterreader_sm_1_8_0") | float }}'
      unit_of_measurement: "kWh"

### and also tested whether this kind of sensor would work: it would not

sensor:
  - platform: integration
    source: sensor.00_unten_eingangsbereich_zaehler
    name: "Unten/Eingangsbereich/Stromverbrauch"

### or

sensor:
  - platform: integration
    source: sensor.bitshake_smartmeterreader_sm_1_8_0
    name: "Unten/Eingangsbereich/Stromverbrauch"

Neither of these sensors work. What’s wrong with them?

The smart meter itself is connected to Home Assistant via tasmota integration. However, it communicates through MQTT, so I would be able to create an MQTT sensor for it. But if all it takes is the kWh measurement, why doesn’t my template sensor work?

Thank you in advance for your help :slight_smile:


¹ I did this because of this issue.

Use customize to add the required attributes to your energy sensors.

e.g. in configuration.yaml:

homeassistant:
  customize:
    sensor.bitshake_smartmeterreader_sm_1_8_0:
      name: "Whatever you want here"
      device_class: energy
      state_class: total_increasing
      unit_of_measurement: "kWh"
    sensor.bitshake_smartmeterreader_sm_2_8_0:
      name: "Whatever you want here"
      device_class: energy
      state_class: total_increasing
      unit_of_measurement: "kWh"
1 Like

Thank you @tom_l

I did this, restarted Home Assistant, and waited 2+ hours to be sure the entities would be shown in the energy dashboard. They are still not there.

The sensor has applied the changes

But that’s it. I cannot use it. Is there any way to configure the energy dashboard via yaml? This issue makes it hard setting it up to begin with, but makes it even harder to determine whether or not some entity is actually available to it, if you cannot reliably search for it.

No there is no yaml configuration for the energy dashboard.

If you go to Developer Tools → Statistics are there any FIX ISSSUE buttons for you to press?

Can you add the entities to a statistics card in your main dashboard?

2 Likes

Yes, there are FIX ISSUE buttons:

It says something like these entities' units have been changed to 'kWh'. I clicked the button (unfortunately didn’t copy the message, but it was asking me to either “do nothing” or “change history data without converting it”; I chose to change it).

The card itself is currently empty.

Even though the sensor itself is on 27 now and was on 25 earlier today:

Hopefully this will change after the entity has been updated again… I’ll report back.

Try adding your sensors to the energy dashboard now. Should be fixed. The unit was the issue.

Yes! I can add them now. Currently, there aren’t any measurements…

I assume that is because it just now starts counting this sensor? So by midnight it will start with the correct values?

Thank you so much for your help.

1 Like

Woohoo!

It will take some time to accumulate the hourly statistics. They are published to the energy dashboard at 12 minutes past each hour.

1 Like

Hey there, i have the bitshake smartmeterreader as well and i have issues with the configuration…unfortunately the solution posted here seems not to work for me. So i would suggest anyone could help me if i posted my configuration.yaml code here. I tried to do it like this thread proposed it:


# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Text-to-speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
template:
  - sensor:
      name: "Gesamtenergie"
      unit_of_measurement: kWh
      state_class: total_increasing
      device_class: energy
      state: '{{states("sensor.bitshake_smartmeterreader_mt681_total_in") | float }}'
        
homeassistant:
  customize:
    sensor.bitshake_smartmeterreader_mt681_total_in:
      name: "Energie Summe"
      device_class: energy
      state_class: total_increasing
      unit_of_measurement: kWh

I really hope you can help me out with this… :slight_smile:

Edit:
I could now correct the units in measurement in the developer tools for the sensor _total_in… now i have a value in the statistics and i am waiting for this value to show up in the dashboard… so i will wait until 12:12 :wink: I hope to get it then…

Edit 2:
So now i can see the energy consuumption from the grid. With this configuration above it kinda works… i do not really know why, but this is the case many times so i kinda get used to it.:smiley: