Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sensor:
- - platform: template
- sensors:
- tiendien:
- friendly_name: "Tiền điện"
- unit_of_measurement: 'đ'
- value_template: >-
- {% set watt = states('sensor.monthly_energy')|float %}
- {%- if(watt >= 400) -%}
- {% set money = 83900 + 173400 + 201400 + 253600 + 283400 + (watt-400)*2927 %}
- {%- elif(watt >= 300) -%}
- {% set money = 83900 + 173400 + 201400 + 253600 + (watt-300)*2834 %}
- {%- elif(watt >= 200) -%}
- {% set money = 83900 + 173400 + 201400 + (watt-200)*2536 %}
- {%- elif(watt >= 100) -%}
- {% set money = 83900 + 173400 + (watt-100)*2014 %}
- {%- elif(watt >= 50) -%}
- {% set money = 83900 + (watt-50)*1734 %}
- {%- else -%}
- {% set money = watt*1678 %}
- {%- endif-%}
- {% set money = money*1.1 %}
- {{ "{0:,.0f}".format(money| int) }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement