I have a Teckin SP22 which is monitoring 1 of my appliances (a kitchen boiler). This SP22 is running on Esphome and is configured the following:
power:
name: "${plug_name}_power"
unit_of_measurement: W
id: "${plug_name}_wattage"
accuracy_decimals: 0
filters:
# Map from sensor -> measured value
- calibrate_linear:
- 0.0 -> 1.14
- 279.17188 -> 40
- 13879 -> 2061
# Make everything below 2W appear as just 0W.
# Furthermore it corrects 1.14W for the power usage of the plug.
- lambda: if (x < (2 + 1.14)) return 0; else return (x - 1.14);
# Transform all values to positive ones
- lambda: return fabs(x);
- median:
window_size: 5
send_every: 5
send_first_at: 1
change_mode_every: 8
update_interval: 2s
- platform: total_daily_energy
name: "${plug_name}_total_daily_energy"
power_id: "${plug_name}_wattage"
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
In my previous setup I used the following method to output the total daily power in kWh: sensorwatts -> Integration sensor -> utility meter (reset daily) -> MQTT sensors which is updated every night at 0.00
I would expect that both daily sensors would output more or less the same value, but when I look at the total_daily_energy is reads 1.2 kWh (at midnight) whereas the MQTT sensor reads 17.165 kWh. I certainly hope that 1.2 kWh is the right value, but I cannot understand why the MQTT sensor is so off.
Anyone an idea what is going wrong?
Find all relevant yaml for the MQTT stuff below:
configuration.yaml:
utility_meter:
daily_energy_boiler:
source: sensor.sensor_energy_boiler_integral
cycle: daily
sensor:
- platform: integration
source: sensor.energy_boiler
unit_prefix: k
- platform: mqtt
name: mqtt.dailykwh.boiler
state_topic: "homeassistant/dailykwh/boiler"
unit_of_measurement: "kWh"
automations.yaml
- id: daily_kwh_boiler
alias: Daily KwH boiler
trigger:
- at: 00:00:01
platform: time
action:
- data:
payload_template: '{{ states.sensor.daily_energy_boiler.attributes.last_period
| float }}'
topic: homeassistant/dailykwh/boiler
retain: true
service: mqtt.publish