-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsensor.yaml
144 lines (143 loc) · 8.52 KB
/
sensor.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#SENSORES PRECIOS DE MI COMERCIALIZADORA
- platform: template
sensors:
precio_electricidad_p1:
friendly_name: "Consumo P1"
unit_of_measurement: "€/kWh"
value_template: >-
{{ (0.128383) }}
precio_electricidad_p2:
friendly_name: "Consumo P2"
unit_of_measurement: "€/kWh"
value_template: >-
{{ (0.109669) }}
precio_electricidad_p3:
friendly_name: "Consumo P3"
unit_of_measurement: "€/kWh"
value_template: >-
{{ (0.074910) }}
precio_potencia_p1:
friendly_name: "Potencia P1"
unit_of_measurement: "€/kW/dia"
value_template: >-
{{ (0.065072) }}
precio_potencia_p2:
friendly_name: "Potencia P2"
unit_of_measurement: "€/kW/dia"
value_template: >-
{{ (0.002683) }}
#SENSORES EXTRAIDOS DE DATOS DATADIS
- platform: template
sensors:
precio_electricidad_ahora:
friendly_name: "Precio ahora"
unit_of_measurement: "€/kWh"
value_template: >-
{% if is_state('binary_sensor.workday_electric', 'off') %}
{{ (states('sensor.precio_electricidad_p3')) | float }}
{% else %}
{% set current_hour = now().hour %}
{% if 0 <= current_hour < 8 %}
{{ (states('sensor.precio_electricidad_p3')) | float }}
{% elif 8 <= current_hour < 10 %}
{{ (states('sensor.precio_electricidad_p2')) | float }}
{% elif 10 <= current_hour < 14 %}
{{ (states('sensor.precio_electricidad_p1')) | float }}
{% elif 14 <= current_hour < 18 %}
{{ (states('sensor.precio_electricidad_p2')) | float }}
{% elif 18 <= current_hour < 22 %}
{{ (states('sensor.precio_electricidad_p1')) | float }}
{% else %}
{{ (states('sensor.precio_electricidad_p2')) | float }}
{% endif %}
{% endif %}
consumo_electricidad_mes_pasado_p1:
friendly_name: "Consumo P1 mes pasado"
unit_of_measurement: €
value_template: >-
{{ ((state_attr('sensor.edata_XXXX', 'last_month_p1_kWh')) | float * (states('sensor.precio_electricidad_p1')) | float ) | round(2) }}
consumo_electricidad_mes_pasado_p2:
friendly_name: "Consumo P2 mes pasado"
unit_of_measurement: €
value_template: >-
{{ ((state_attr('sensor.edata_XXXX', 'last_month_p2_kWh')) | float * (states('sensor.precio_electricidad_p2')) | float ) | round(2) }}
consumo_electricidad_mes_pasado_p3:
friendly_name: "Consumo P3 mes pasado"
unit_of_measurement: €
value_template: >-
{{ ((state_attr('sensor.edata_XXXX', 'last_month_p3_kWh')) | float * (states('sensor.precio_electricidad_p3')) | float ) | round(2) }}
potencia_mes_pasado_p1:
friendly_name: "Potencia P1 mes pasado"
unit_of_measurement: €
value_template: >-
{{ ((state_attr('sensor.edata_XXXX', 'contract_p1_kW')) | float * (state_attr('sensor.edata_XXXX', 'last_month_days')) | float * (states('sensor.precio_potencia_p1')) | float ) | round(2) }}
potencia_mes_pasado_p2:
friendly_name: "Potencia P2 mes pasado"
unit_of_measurement: €
value_template: >-
{{ ((state_attr('sensor.edata_XXXX', 'contract_p2_kW')) | float * (state_attr('sensor.edata_XXXX', 'last_month_days')) | float * (states('sensor.precio_potencia_p2')) | float ) | round(2) }}
impuesto_electrico_mes_pasado:
friendly_name: "Impuesto electrico mes pasado"
unit_of_measurement: €
value_template: >-
{{ ((0.001) * ((state_attr('sensor.edata_XXXX', 'last_month_p1_kWh')) | float + (state_attr('sensor.edata_XXXX', 'last_month_p2_kWh')) | float + (state_attr('sensor.edata_XXXX', 'last_month_p3_kWh')) | float )) | round(2) }}
alquiler_contador_mes_pasado:
friendly_name: "Alquiler contador mes pasado"
unit_of_measurement: €
value_template: >-
{{ ((0.02663) * ((state_attr('sensor.edata_XXXX', 'last_month_days')) | float )) | round(2) }}
iva_electricidad_mes_pasado:
friendly_name: "IVA mes pasado"
unit_of_measurement: €
value_template: >-
{{ ((0.10) * ((states('sensor.consumo_electricidad_mes_pasado_p1')) | float + (states('sensor.consumo_electricidad_mes_pasado_p2')) | float + (states('sensor.consumo_electricidad_mes_pasado_p3')) | float + (states('sensor.potencia_mes_pasado_p1')) | float + (states('sensor.potencia_mes_pasado_p2')) | float + (states('sensor.impuesto_electrico_mes_pasado')) | float + (states('sensor.alquiler_contador_mes_pasado')) | float )) | round(2) }}
total_factura_electricidad_mes_pasado:
friendly_name: "TOTAL mes pasado"
unit_of_measurement: €
value_template: >-
{{ ((states('sensor.consumo_electricidad_mes_pasado_p1')) | float + (states('sensor.consumo_electricidad_mes_pasado_p2')) | float + (states('sensor.consumo_electricidad_mes_pasado_p3')) | float + (states('sensor.potencia_mes_pasado_p1')) | float + (states('sensor.potencia_mes_pasado_p2')) | float + (states('sensor.impuesto_electrico_mes_pasado')) | float + (states('sensor.alquiler_contador_mes_pasado')) | float + (states('sensor.iva_electricidad_mes_pasado')) | float ) | round(2) }}
consumo_electricidad_mes_actual_p1:
friendly_name: "Consumo P1 mes actual"
unit_of_measurement: €
value_template: >-
{{ ((state_attr('sensor.edata_XXXX', 'month_p1_kWh')) | float * (states('sensor.precio_electricidad_p1')) | float ) | round(2) }}
consumo_electricidad_mes_actual_p2:
friendly_name: "Consumo P2 mes actual"
unit_of_measurement: €
value_template: >-
{{ ((state_attr('sensor.edata_XXXX', 'month_p2_kWh')) | float * (states('sensor.precio_electricidad_p2')) | float ) | round(2) }}
consumo_electricidad_mes_actual_p3:
friendly_name: "Consumo P3 mes actual"
unit_of_measurement: €
value_template: >-
{{ ((state_attr('sensor.edata_XXXX', 'month_p3_kWh')) | float * (states('sensor.precio_electricidad_p3')) | float ) | round(2) }}
potencia_mes_actual_p1:
friendly_name: "Potencia P1 mes actual"
unit_of_measurement: €
value_template: >-
{{ ((state_attr('sensor.edata_XXXX', 'contract_p1_kW')) | float * (state_attr('sensor.edata_XXXX', 'month_days')) | float * (states('sensor.precio_potencia_p1')) | float ) | round(2) }}
potencia_mes_actual_p2:
friendly_name: "Potencia P2 mes actual"
unit_of_measurement: €
value_template: >-
{{ ((state_attr('sensor.edata_XXXX', 'contract_p2_kW')) | float * (state_attr('sensor.edata_XXXX', 'month_days')) | float * (states('sensor.precio_potencia_p2')) | float ) | round(2) }}
impuesto_electrico_mes_actual:
friendly_name: "Impuesto electrico mes actual"
unit_of_measurement: €
value_template: >-
{{ ((0.001) * ((state_attr('sensor.edata_XXXX', 'month_p1_kWh')) | float + (state_attr('sensor.edata_XXXX', 'month_p2_kWh')) | float + (state_attr('sensor.edata_XXXX', 'month_p3_kWh')) | float )) | round(2) }}
alquiler_contador_mes_actual:
friendly_name: "Alquiler contador mes actual"
unit_of_measurement: €
value_template: >-
{{ ((0.02663) * ((state_attr('sensor.edata_XXXX', 'month_days')) | float )) | round(2) }}
iva_electricidad_mes_actual:
friendly_name: "IVA mes actual"
unit_of_measurement: €
value_template: >-
{{ ((0.10) * ((states('sensor.consumo_electricidad_mes_actual_p1')) | float + (states('sensor.consumo_electricidad_mes_actual_p2')) | float + (states('sensor.consumo_electricidad_mes_actual_p3')) | float + (states('sensor.potencia_mes_actual_p1')) | float + (states('sensor.potencia_mes_actual_p2')) | float + (states('sensor.impuesto_electrico_mes_actual')) | float + (states('sensor.alquiler_contador_mes_actual')) | float )) | round(2) }}
total_factura_electricidad_mes_actual:
friendly_name: "TOTAL mes actual"
unit_of_measurement: €
value_template: >-
{{ ((states('sensor.consumo_electricidad_mes_actual_p1')) | float + (states('sensor.consumo_electricidad_mes_actual_p2')) | float + (states('sensor.consumo_electricidad_mes_actual_p3')) | float + (states('sensor.potencia_mes_actual_p1')) | float + (states('sensor.potencia_mes_actual_p2')) | float + (states('sensor.impuesto_electrico_mes_actual')) | float + (states('sensor.alquiler_contador_mes_actual')) | float + (states('sensor.iva_electricidad_mes_actual')) | float ) | round(2) }}