Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Bacaan Blok TNB
- - platform: template
- sensors:
- 1stbill_tnb_rm:
- friendly_name: "1st Jumlah Bill TNB"
- unit_of_measurement: 'MYR'
- icon_template: mdi:currency-usd
- value_template: >-
- {% if states('sensor.monthly_power_kw') | float < 201 %}
- {% set G = states('sensor.monthly_power_kw') | float %}
- {{ (G * 0.218) | round(2) }}
- {% elif states('sensor.monthly_power_kw') | float >= 201 %}
- 43.60
- {%- else %}
- Unknown
- {%- endif %}
- 2ndbill_tnb_rm:
- friendly_name: "2nd Jumlah Bill TNB"
- unit_of_measurement: 'MYR'
- icon_template: mdi:currency-usd
- value_template: >-
- {% if states('sensor.monthly_power_kw') | float <= 200 %}
- 0
- {% elif states('sensor.monthly_power_kw') | float >= 301 %}
- 33.40
- {% elif states('sensor.monthly_power_kw') | float >= 201 < 300 %}
- {% set H = states('sensor.monthly_power_kw') | float - 200 %}
- {{ (H * 0.334) | round(2) }}
- {%- else %}
- Unknown
- {%- endif %}
- - platform: template
- sensors:
- 3rdbill_tnb_rm:
- friendly_name: "3rd Jumlah Bill TNB"
- unit_of_measurement: 'MYR'
- icon_template: mdi:currency-usd
- value_template: >-
- {% if states('sensor.monthly_power_kw') | float <= 300 %}
- 0
- {% elif states('sensor.monthly_power_kw') | float >= 601 %}
- 154.80
- {% elif states('sensor.monthly_power_kw') | float >= 301 < 600 %}
- {% set I = states('sensor.monthly_power_kw') | float - 300 %}
- {{ (I * 0.516) | round(2) }}
- {%- else %}
- Unknown
- {%- endif %}
- - platform: template
- sensors:
- 4thbill_tnb_rm:
- friendly_name: "4th Jumlah Bill TNB"
- unit_of_measurement: 'MYR'
- icon_template: mdi:currency-usd
- value_template: >-
- {% if states('sensor.monthly_power_kw') | float <= 600 %}
- 0
- {% elif states('sensor.monthly_power_kw') | float >= 901 %}
- 163.80
- {% elif states('sensor.monthly_power_kw') | float >= 601 < 900 %}
- {% set J = states('sensor.monthly_power_kw') | float - 600 %}
- {{ (J * 0.546) | round(2) }}
- {%- else %}
- Unknown
- {%- endif %}
- - platform: template
- sensors:
- 5thbill_tnb_rm:
- friendly_name: "5th Jumlah Bill TNB"
- unit_of_measurement: 'MYR'
- icon_template: mdi:currency-usd
- value_template: >-
- {% if states('sensor.monthly_power_kw') | float <= 900 %}
- 0
- {% elif states('sensor.monthly_power_kw') | float >= 901 %}
- {% set K = states('sensor.monthly_power_kw') | float - 900 %}
- {{ (K * 0.571) | round(2) }}
- {%- else %}
- Unknown
- {%- endif %}
- # Jumlah Bill TNB
- - platform: template
- sensors:
- to_bill_tnb_rm:
- friendly_name: "Total Bill TNB"
- unit_of_measurement: 'MYR'
- icon_template: mdi:currency-usd
- value_template: >-
- {% set G = states('sensor.1stbill_tnb_rm') | float %}
- {% set H = states('sensor.2ndbill_tnb_rm') | float %}
- {% set I = states('sensor.3rdbill_tnb_rm') | float %}
- {% set J = states('sensor.4thbill_tnb_rm') | float %}
- {% set K = states('sensor.5thbill_tnb_rm') | float %}
- {{ (G + H + I + J + K) | round(2) }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement