diff --git a/sensors/energy.yaml b/sensors/energy.yaml index d84d83c..ee2a6f8 100644 --- a/sensors/energy.yaml +++ b/sensors/energy.yaml @@ -25,7 +25,14 @@ unit_prefix: k unit_time: h round: 4 - + +- platform: integration + source: sensor.computer_energi + name: computer_power_used + unit_prefix: k + unit_time: h + round: 4 + - platform: statistics name: Average energy price last 30d mean entity_id: sensor.energi_data_service diff --git a/sensors/igrill.yaml b/sensors/igrill.yaml index 312a5d4..f8c603c 100644 --- a/sensors/igrill.yaml +++ b/sensors/igrill.yaml @@ -10,16 +10,4 @@ Cooking {% endif %}' friendly_name: iGrill Target Alert - -- platform: mqtt - state_topic: "bbq/grill/grill/probe1" - name: "iGrill_Temperature" - qos: 0 - unit_of_measurement: "°C" - -- platform: mqtt - state_topic: "bbq/grill/grill/battery" - name: "iGrill_Battery" - qos: 0 - unit_of_measurement: '%' - device_class: battery \ No newline at end of file + \ No newline at end of file diff --git a/template/aircondition.yaml b/template/aircondition.yaml index eb70f0b..49a505b 100644 --- a/template/aircondition.yaml +++ b/template/aircondition.yaml @@ -12,4 +12,18 @@ - name: AirCondition Strøm state: '{{ (states.switch.aircondition_switch.attributes.current) | default(0) | float * 0.001 }}' unit_of_measurement: "A" - device_class: current \ No newline at end of file + device_class: current + + - name: AirCondition Power Factor + state: | + {# Calculate power factor #} + {% set v = states.sensor.aircondition_spaending.state | float %} + {% set a = states.sensor.aircondition_strom.state | float %} + {% set wp = states.sensor.aircondition_energi.state | float %} + {% set ap = v * a %} + {% set pf = wp / ap * 100 %} + + {{ pf | round(2) }} + unit_of_measurement: "%" + device_class: power_factor + \ No newline at end of file diff --git a/template/computer-plug.yaml b/template/computer-plug.yaml new file mode 100644 index 0000000..d56a4d8 --- /dev/null +++ b/template/computer-plug.yaml @@ -0,0 +1,28 @@ +- sensor: + - name: Computer Spænding + state: '{{ (states.switch.computer_switch.attributes.voltage) | default(0)| float }}' + unit_of_measurement: "V" + device_class: voltage + + - name: Computer Strøm + state: '{{ (states.switch.computer_switch.attributes.current) | default(0)| float * 0.001 }}' + unit_of_measurement: "A" + device_class: current + + - name: Computer Energi + state: '{{ (states.switch.computer_switch.attributes.current_consumption) | default(0)| float }}' + unit_of_measurement: "W" + device_class: power + + - name: Computer Power Factor + state: | + {# Calculate power factor #} + {% set v = states.sensor.computer_spaending.state | float %} + {% set a = states.sensor.computer_strom.state | float %} + {% set wp = states.sensor.computer_energi.state | float %} + {% set ap = v * a %} + {% set pf = wp / ap * 100 %} + + {{ pf | round(2) }} + unit_of_measurement: "%" + device_class: power_factor diff --git a/template/opvaskemaskine.yaml b/template/opvaskemaskine.yaml index 1b9b11e..21bc8fb 100644 --- a/template/opvaskemaskine.yaml +++ b/template/opvaskemaskine.yaml @@ -13,3 +13,17 @@ state: '{{ (states.switch.opvaskemaskine_switch.attributes.current_consumption) | default(0)| float }}' unit_of_measurement: "W" device_class: power + + - name: Opvaskemaskine Power Factor + state: | + {# Calculate power factor #} + {% set v = states.sensor.opvaskemaskine_spaending.state | float %} + {% set a = states.sensor.opvaskemaskine_strom.state | float %} + {% set wp = states.sensor.opvaskemaskine_energi.state | float %} + {% set ap = v * a %} + {% set pf = wp / ap * 100 %} + + {{ pf | round(2) }} + unit_of_measurement: "%" + device_class: power_factor + \ No newline at end of file diff --git a/template/tv_baenk.yaml b/template/tv_baenk.yaml index 1324dce..bc888a4 100644 --- a/template/tv_baenk.yaml +++ b/template/tv_baenk.yaml @@ -13,3 +13,17 @@ state: '{{ (states.switch.tv_baenk.attributes.current_consumption) | default(0) | float }}' unit_of_measurement: "W" device_class: power + + - name: TV Bænk Power Factor + state: | + {# Calculate power factor #} + {% set v = states.sensor.tv_baenk_spaending.state | float %} + {% set a = states.sensor.tv_baenk_strom.state | float %} + {% set wp = states.sensor.tv_baenk_energi.state | float %} + {% set ap = v * a %} + {% set pf = wp / ap * 100 %} + + {{ pf | round(2) }} + unit_of_measurement: "%" + device_class: power_factor + \ No newline at end of file