Hey, I am not a good programmer but is trying so after weeks on this I now ask for help and hope someone have the time.
I want a calculation on the kW the house is using in 24 hours on sensor.power meter.consumption.
My code :
day_kw:
unique_id: “day_kW”
friendly_name: “Day kW”
# This template calculates the used kW per day
trigger:
platform: time
at: “23:59:58”
unit_of_measurement: “kW”
device_class: power
state_class: measurement
state: “{{ (states(‘sensor.power_meter_consumption’)|float(0) / 24 )|round(2) }}”
availability: “{{ states(‘sensor.power_meter_consumption’)|is_number }}”
But it makes my sensor.difference_power_entities go dead which stands above this.
My problem is that I now have a extra sensor in configuration.yaml file which interrupt the sensor above …
I also cant find the Day kW in Entities card …
How do I solve this … ?
-----> I have restarted the home assistsant …
See picture “below” or this :
Loads default set of integrations. Do not remove.
default_config:
#themes
frontend:
themes: !include_dir_merge_named themes
utility_meter:
energy:
source: sensor.energy_in_kwh
cycle: monthly
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor:
-
platform: template
sensors:
syd_watt:
unique_id: “syd_watt”
friendly_name: “Syd Watt”
# This template calculates the power output in Watts of the PV1
unit_of_measurement: “Watt”
value_template: “{{ (float(states(‘sensor.inverter_pv_1_current’)) * float(states(‘sensor.inverter_pv_1_voltage’))) }}”nord_watt:
unique_id: “nord_watt”
friendly_name: “Nord Watt”
# This template calculates the power output in Watts of the PV2
unit_of_measurement: “Watt”
value_template: “{{ (float(states(‘sensor.inverter_pv_2_current’)) * float(states(‘sensor.inverter_pv_2_voltage’))) }}”difference_power_entities:
friendly_name: “Hus Forbrug Watt”
unit_of_measurement: “W”
value_template: “{{ (states(‘sensor.inverter_active_power’) | float - states(‘sensor.power_meter_active_power’) | float) | abs }}”day_kw:
unique_id: “day_kW”
friendly_name: “Day kW”
# This template calculates the used kW per day
trigger:
platform: time
at: “23:59:58”
unit_of_measurement: “kW”
device_class: power
state_class: measurement
state: “{{ (states(‘sensor.power_meter_consumption’)|float(0) / 24 )|round(2) }}”
availability: “{{ states(‘sensor.power_meter_consumption’)|is_number }}”