Open q-bhatti opened 1 year ago
Here are my template variables to do just that. Change the sensor names to match yours.
- trigger:
- platform: state
entity_id: sensor.solis_status_lastupdate
sensor:
- name: PV1 DC Power
unit_of_measurement: kW
device_class: power
state: >-
{% set v = states('sensor.solis_pv1_voltage') %}
{% set a = states('sensor.solis_pv1_current') %}
{% if is_number(v) and is_number(a) %}
{{ (v|float * a|float / 1000) | round(3) }}
{% endif %}
- trigger:
- platform: state
entity_id: sensor.solis_status_lastupdate
sensor:
- name: PV2 DC Power
unit_of_measurement: kW
device_class: power
state: >-
{% set v = states('sensor.solis_pv2_voltage') %}
{% set a = states('sensor.solis_pv2_current') %}
{% if is_number(v) and is_number(a) %}
{{ (v|float * a|float / 1000) | round(3) }}
{% endif %}
The minimum polling is 30 seconds, not sure why though. Can change the code if you want to try something shorter, look in solarman.py for the line below but you're on you own if it goes horribly wrong....
@Throttle (MIN_TIME_BETWEEN_UPDATES)
- trigger:
- platform: state entity_id: sensor.solis_status_lastupdate sensor:
- name: PV1 DC Power unit_of_measurement: kW device_class: power state: >- {% set v = states('sensor.solis_pv1_voltage') %} {% set a = states('sensor.solis_pv1_current') %} {% if is_number(v) and is_number(a) %} {{ (v|float * a|float / 1000) | round(3) }} {% endif %}
Sorry for the dumb question, but where do I put this?
it's called a template sensor and goes into your configuration.yaml file or a file that included into it.
Hi.
I'm maybe being a bit stupid here but I need to know how to do the following: