@@ -106,6 +106,87 @@ Whether to create a utility meter for the energy and energy costs. If set to
106106
107107---
108108
109+ ### Using tariff
110+
111+ Tariff are like virtual counter associated to your meter. See the [ official
112+ documentation utility meters] [ um-conf ] to understand them. They are only used
113+ to increment a different index on the meter. ** They won't change price of
114+ energy.**
115+
116+ Tariffs are usually changed through automation based on time of state from
117+ another sensor. The following example shows how to set a different tariff:
118+
119+ ``` yaml
120+ # in configurations.yaml
121+ automation :
122+ - id : switch_peak_offpeak_tariff
123+ alias : " Switch peak/offpeak tariff"
124+ initial_state : true
125+ trigger :
126+ - platform : time
127+ at : " 05:00:00"
128+ variables :
129+ tariff : peak
130+ - platform : time
131+ at : " 20:00:00"
132+ variables :
133+ tariff : offpeak
134+ action :
135+ - service : select.select_option
136+ target :
137+ entity_id :
138+ - select.daily_energy
139+ - select.monthly_energy
140+ - select.yearly_energy
141+ data :
142+ option : " {{ tariff }}"
143+ ` ` `
144+
145+ The following example provides another way to set tariff with a more complex
146+ logic:
147+
148+ ` ` ` yaml
149+ # in configurations.yaml
150+ automation :
151+ - alias : Set Energy Meter Rate
152+ description : " Set Energy Meter Rate"
153+ trigger :
154+ - platform : time
155+ at : " 07:00:30"
156+ - platform : time
157+ at : " 09:00:30"
158+ - platform : time
159+ at : " 17:00:30"
160+ - platform : time
161+ at : " 20:00:30"
162+ - platform : time
163+ at : " 22:00:30"
164+ - platform : homeassistant
165+ event : start
166+ condition : []
167+ action :
168+ - service : select.select_option
169+ data :
170+ option : >-
171+ {% set t = now() %} {%- if (( t.hour >= 7 and t.hour < 9 ) or (
172+ t.hour >= 17 and t.hour < 20 )) and
173+ is_state('binary_sensor.workday_sensor', 'on') %}
174+ peak
175+ {%- elif (( t.hour >= 9 and t.hour < 17 ) or ( t.hour >= 20 and
176+ t.hour < 22 )) and is_state('binary_sensor.workday_sensor', 'on')
177+ %}
178+ shoulder
179+ {%- else -%}
180+ offpeak
181+ {%- endif -%}
182+ target :
183+ entity_id :
184+ - select.daily_energy
185+ - select.monthly_energy
186+ - select.yearly_energy
187+ mode : single
188+ ` ` `
189+
109190### Examples
110191
111192` ` ` yaml
@@ -210,3 +291,4 @@ target:
210291 https://github.com/zeronounours/HA-custom-component-energy-meter/releases
211292[license-shield] :
212293 https://img.shields.io/github/license/zeronounours/HA-custom-component-energy-meter.svg?style=for-the-badge
294+ [um-conf] : https://www.home-assistant.io/integrations/utility_meter/
0 commit comments