-
Notifications
You must be signed in to change notification settings - Fork 2
/
zeversolar.yaml
43 lines (42 loc) · 1.63 KB
/
zeversolar.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
zeversolar:
sensor:
- platform: rest
name: Zeversolar full output
resource: http://<zeversolar inverter ip/hostname>/home.cgi
template:
- binary_sensor:
- name: "Zeversolar status"
state: "{{ states('sensor.zeversolar_full_output') not in ['unavailable', 'unknown'] and (states('sensor.zeversolar_full_output').split() | length) == 15 }}"
- sensor:
- name: "Zeversolar Pac"
unit_of_measurement: W
state: >
{% if (is_state('binary_sensor.zeversolar_status', 'on')) %}
{{ states('sensor.zeversolar_full_output').split()[11] | float }}
{% else %}
0
{% endif %}
- sensor:
- name: "Zeversolar E Today"
unit_of_measurement: kWh
state_class: "total_increasing"
state: >
{% if (is_state('binary_sensor.zeversolar_status', 'on')) %}
{% set e_today = states('sensor.zeversolar_full_output').split()[12].split('.') %}
{% if ((e_today[1] | length) < 2) %}
{% set e_val = (e_today[0] + '.0' + e_today[1]) | float %}
{% else %}
{% set e_val = '.'.join(e_today) | float %}
{% endif %}
{% if ((states('sensor.zeversolar_e_today') | float) > e_val) %}
{{ states('sensor.zeversolar_e_today') }}
{% else %}
{{ e_val }}
{% endif %}
{% else %}
{% if (is_state('sun.sun', 'above_horizon') or now() > today_at("12:00")) %}
{{ states('sensor.zeversolar_e_today') }}
{% else %}
0
{% endif %}
{% endif %}