Hi,
I have a 3 phase modbus meter which gives me these values:
sensor.sdm530_1_ph1_power
sensor.sdm530_1_ph2_power
sensor.sdm530_1_ph3_power
I want to know the maximum (and also minimum) power values. I tried to use the template below in my configuration.yaml, but these values won’t hold the max power value. The value of sensor.max_power1 is the current power and keep changing all the time. Please help me solve this. Thanks in advance.
Best regards,
Erik
- trigger:
- platform: state
entity_id: sensor.sdm530_1_ph1_power
id: 'change'
sensor:
- name: Max Power Ph1
state: >
{% set maxpwr1 = states('sensor.sdm530_1_ph1_power')|float(None) %}
{% set maxph1 = states('sensor.max_power1')|float(None) %}
{% if maxpwr1 != None and (maxph1 == None
or maxpwr1 > maxph1) %} {{ maxpwr1 }}
{% else %} {{ maxph1 }} {% endif %}
unit_of_measurement: W
device_class: power
- trigger:
- platform: state
entity_id: sensor.sdm530_1_ph2_power
id: 'change'
sensor:
- name: Max Power Ph2
state: >
{% set maxpwr2 = states('sensor.sdm530_1_ph2_power')|float(None) %}
{% set maxph2 = states('sensor.max_power2')|float(None) %}
{% if maxpwr2 != None and (maxph2 == None
or maxpwr2 > maxph2) %} {{ maxpwr2 }}
{% else %} {{ maxph2 }} {% endif %}
unit_of_measurement: W
device_class: power
- trigger:
- platform: state
entity_id: sensor.sdm530_1_ph3_power
id: 'change'
sensor:
- name: Max Power Ph3
state: >
{% set maxpwr3 = states('sensor.sdm530_1_ph3_power')|float(None) %}
{% set maxph3 = states('sensor.max_power3')|float(None) %}
{% if maxpwr3 != None and (maxph3 == None
or maxpwr3 > maxph3) %} {{ maxpwr3 }}
{% else %} {{ maxph3 }} {% endif %}
unit_of_measurement: W
device_class: power