本帖最后由 flyice 于 2023-12-13 22:21 编辑
——————————实时电价——————————————————————————
sensor:
- platform: template
sensors:
shishidianjia:
unit_of_measurement: "/kWh"
friendly_name: '实时电价'
value_template: >
{% if now().strftime("%H")| int >= 8 and now().strftime("%H")|int < 22 and states("sensor.dang_qian_jie_ti")=="1" %}
0.5953 #1阶梯,峰电费 (实际使用需要删掉备注!!!)
{%elif now().strftime("%H")| int >= 8 and now().strftime("%H")|int < 22 and states("sensor.dang_qian_jie_ti")=="2" %}
0.6453 #2阶梯,峰电费
{%elif now().strftime("%H")| int >= 8 and now().strftime("%H")|int < 22 and states("sensor.dang_qian_jie_ti")=="3" %}
0.8953 #3阶梯,峰电费
{% elif states("sensor.dang_qian_jie_ti")=="1"%}
0.3583 #1阶梯,谷电费
{% elif states("sensor.dang_qian_jie_ti")=="2" %}
0.4083 #2阶梯,谷电费
{% elif states("sensor.dang_qian_jie_ti")=="3" %}
0.6583 #3阶梯,谷电费
{% endif %}
- platform: template
sensors:
dang_qian_jie_ti:
value_template: >
{% if states("sensor.tasmota_energy_total#改成自己的电量实体") | float <= 2300 %}
1 #1阶梯,2300度电以内
{% elif states("sensor.tasmota_energy_total#改成自己的电量实体") | float >2310 and states("sensor.tasmota_energy_total") | float <= 4000 %}
2 #2阶梯,2300度—4000度
{% elif states("sensor.tasmota_energy_total#改成自己的电量实体") | float > 4000 %}
3 #3阶梯,4000度以上
{% endif %}
friendly_name: '当前阶梯'
unit_of_measurement: "L"
——————————峰谷电量—————————————————————————
utility_meter:
daily_energy:
source: sensor.tasmota_energy_total
cycle: daily
tariffs:
- peak
- offpeak
monthly_energy:
source: sensor.tasmota_energy_total
cycle: monthly
tariffs:
- peak
- offpeak
——————————峰谷电量自动化—————————————————————————
alias: 峰谷电
description: ""
trigger:
- platform: time
at: "07:00:00"
variables:
tariff: peak
- platform: time
at: "21:00:00"
variables:
tariff: offpeak
condition: []
action:
- service: select.select_option
data:
option: "{{ tariff }}"
target:
entity_id: select.daily_energy
mode: single
视频教程在这里:
|