Sonoff S31 Tasmota Plug -- how to get power usage on energy screen

Hi,

The subject says it all. The Tasmota includes power usage. It includes the following sensor which I think would show on the energy screen, but it is not. What am I missing?

Screenshot 2023-08-16 10.02.55 PM

Thank you!

in the config/.storage there is a file called energy.

EDIT AT YOUR OWN RISK!

Below is my file:

{
    "version": 1,
    "minor_version": 1,
    "key": "energy",
    "data": {
        "energy_sources": [
            {
                "type": "grid",
                "flow_from": [
                    {
                        "stat_energy_from": "sensor.yearly_kwh_from_grid",
                        "stat_cost": null,
                        "entity_energy_from": "sensor.yearly_kwh_from_grid",
                        "entity_energy_price": null,
                        "number_energy_price": 0.13057
                    }
                ],
                "flow_to": [
                    {
                        "stat_energy_to": "sensor.yearly_kwh_to_grid",
                        "stat_compensation": null,
                        "entity_energy_to": "sensor.yearly_kwh_to_grid",
                        "entity_energy_price": null,
                        "number_energy_price": 0.04829
                    }
                ],
                "cost_adjustment_day": 0.667
            },
            {
                "type": "solar",
                "stat_energy_from": "sensor.solar_energy_produced",
                "config_entry_solar_forecast": null
            },
            {
                "type": "battery",
                "stat_energy_from": "sensor.yearly_kwh_from_battery",
                "stat_energy_to": "sensor.yearly_kwh_to_battery"
            }
        ],
        "device_consumption": [
            {
                "stat_consumption": "sensor.phase_1_a_c_down_energy"
            },
            {
                "stat_consumption": "sensor.phase_1_a_c_upstairs_energy"
            },
            {
                "stat_consumption": "sensor.coffee_bar_energy" <--- A sonoff S31 plug
            },
            {
                "stat_consumption": "sensor.bar_fridge_energy"
            },
            {
                "stat_consumption": "sensor.washing_machine_energy"
            },
            {
                "stat_consumption": "sensor.study_monitor_energy"
            },
            { 
                "stat_consumption": "sensor.shelly_em_a_c_down_stairs_channel_2_energy"
            },
            {
                "stat_consumption": "sensor.shelly_em_a_c_upstairs_channel_2_energy"
            },
            {
                "stat_consumption": "sensor.storage_frige_energy"
            }
        ]
    }
}
1 Like

Thank you for this reply! I can confirm that this solution and works perfectly.

Hello! The above solution partially worked for me - I now see the individual monitor in my energy dashboard, but it has the following errors:

statistics_not_defined

  • sensor.none_ac_1_energy_total

Unexpected device class
The following entities do not have the expected device class:

  • sensor.none_ac_1_energy_total (power)

Unexpected state class
The following entities do not have the expected state class:

  • sensor.none_ac_1_energy_total

I’ve tried to figure out how to manually edit the yaml to reclassify the device and state class without success… and I’m not even sure I could do that since this device was detected and added automatically. Can this be fixed by me, or is it a Tasmota Admin issue, or a firmware issue with the plug?

TIA.

I set up the Riemann Integrals in my sensors.yaml. My configuration.yaml has the following include in it.

sensor: !include sensors.yaml
# ------------------------------------------------------------------------------------
# Riemann Sum Integrals for specific equipment
# ------------------------------------------------------------------------------------

- platform: integration
  source: sensor.wash_power
  name: washing_machine_energy
  unique_id: "Washing Machine Energy"
  round: 3
  unit_prefix: k
  unit_time: h

- platform: integration
  source: sensor.bar_fridge_power
  name: bar_fridge_energy
  unique_id: "Bar Refrigerator Energy"
  round: 3
  unit_prefix: k
  unit_time: h

- platform: integration
  source: sensor.coffee_bar_power
  name: coffee_bar_energy
  unique_id: "Coffee Bar Energy"
  round: 3
  unit_prefix: k
  unit_time: h

- platform: integration
  source: sensor.storage_fridge_power
  name: storage_frige_energy
  unique_id: "Storage Refrigerator Energy"
  round: 3
  unit_prefix: k
  unit_time: h

- platform: integration
  source: sensor.study_monitor_power
  name: study_monitor_energy
  unique_id: "Study Monitor Energy"
  round: 3
  unit_prefix: k
  unit_time: h
1 Like