Energy page not calculating cost

Dear HA Community,

I am writing to seek your expertise and assistance with a perplexing issue I’m facing while using Home Assistant (HA) and its Energy integration.

Problem Description: I am currently using Home Assistant, and I have successfully set up energy monitoring for my ShellyEM-B14098 device. I have followed the Energy integration guide, and I can see the energy consumption data on the Energy page. However, I am encountering a problem with the energy cost calculation. Despite configuring the template sensors for energy cost, the displayed cost remains consistently at 0.

My Configuration: I am using the latest version of Home Assistant (HA) available, and below is my relevant configuration for the energy monitoring:

yaml

sensor:
  - platform: integration
    source: sensor.shellyem_b14098_channel_1_energy
    name: "Channel 1 Energy Consumption"
    unit_prefix: k
    unit_time: h
    round: 2
    state_class: total_increasing

  - platform: integration
    source: sensor.shellyem_b14098_channel_1_energy_returned
    name: "Channel 1 Energy Returned"
    unit_prefix: k
    unit_time: h
    round: 2
    state_class: total_increasing

  - platform: integration
    source: sensor.shellyem_b14098_channel_1_energy
    name: "Channel 1 Total Cost"
    unit_prefix: k
    unit_time: h
    round: 2
    unit_of_measurement: "₪"
    integration_method: left
    state_class: total_increasing

  - platform: history_stats
    name: "Channel 1 Energy Cost Today"
    entity_id: sensor.shellyem_b14098_channel_1_total_cost
    state: "on"
    type: sum
    start: "{{ now().replace(hour=0, minute=0, second=0) }}"

  - platform: template
    sensors:
      shellyem_b14098_channel_1_energy_weekly_cost:
        friendly_name: "Channel 1 Weekly Cost"
        unit_of_measurement: "₪"
        value_template: "{{ (states('sensor.shellyem_b14098_channel_1_energy') | float * 0.5134 / 1000 * 24 * 7) | round(2) }}"
      shellyem_b14098_channel_1_energy_monthly_cost:
        friendly_name: "Channel 1 Monthly Cost"
        unit_of_measurement: "₪"
        value_template: "{{ (states('sensor.shellyem_b14098_channel_1_energy') | float * 0.5134 / 1000 * 24 * 30.44) | round(2) }}"
      shellyem_b14098_channel_1_energy_yearly_cost:
        friendly_name: "Channel 1 Yearly Cost"
        unit_of_measurement: "₪"
        value_template: "{{ (states('sensor.shellyem_b14098_channel_1_energy') | float * 0.5134 / 1000 * 24 * 365) | round(2) }}"

Request for Assistance: I have carefully reviewed my configuration, and I can’t seem to find the cause of the problem. The Energy page is displaying energy consumption data correctly, but the energy cost remains at 0. I kindly request your help in identifying any possible misconfigurations or errors in the provided configuration.

Additional Information:

  • I am using the latest version of Home Assistant (HA) available at the time of writing this post.
  • The ShellyEM-B14098 device is reporting valid energy consumption data, as I can see it on the Energy page.
  • I have enabled the Home Assistant Recorder component to store historical data for the energy calculations.

If anyone has experienced a similar issue or has insights on how to troubleshoot and resolve this problem, I would greatly appreciate your guidance and suggestions.

Thank you in advance for your assistance, and I look forward to your valuable input.
David

Check Developer Tools → Statistics for issues. I’m guessing Home Assistant does not recognise the shekel icon as a currency. Try

device_class: monetary
unit_of_measurement: "₪"

or

device_class: monetary
unit_of_measurement: "ILS"

Screenshot 2023-07-24 at 19-16-21 Sensor

https://en.wikipedia.org/wiki/ISO_4217#Active_codes

I change it as you recommended, but unfortunately it’s still showing cost 0

Did you check The developer tools?

Errors in the log?

What are the states of your cost sensors?

Yes there are some shelly sensors that not available, but I am not using thus sensors and what is strange , thus sensors are not define in my configuration. yaml. the only sensor I use is shellyem-B14098 channel 1 energy.