Skip to content

Power Consumption Chip

Description

example-image

This chip shows you the electric consumption from a sensor. Configurable to show power (kWh) or price (currency).

Variables

Variable Default Required Notes
ulm_chip_electric_consumption Variable / Entry Example Required ulm_chip_electric_consumption sensor.my_electric_power_consumption true. This is your consumed energy. This is the sensor, that shows how many kWhs are consumed.
ulm_chip_electric_price This is the price for your consumed energy, if you have such a sensor. This should be a sensor that shows a price in your defined currency. If this variable is not set, the chip shows only the kWhs! If this variable is set the chip shows the price for the consumed energy!

Usage

- type: 'custom:button-card'
  template: chip_power_consumption
  variables:
    ulm_chip_electric_consumption: sensor.my_electric_power_consumption
    ulm_chip_electric_price: sensor.my_electric_power_price
Template Code
chip_power_consumption.yaml
---
### Chip Power Consumption ###
chip_power_consumption:
  template:
    - "chips"
    - "ulm_translation_engine"
  triggers_update:
    - "[[[ return variables.ulm_chip_electric_price ]]]"
    - "[[[ return variables.ulm_chip_electric_consumption ]]]"
  label: |
    [[[
      var amount = variables.ulm_chip_electric_price != "" ? true : false
      if (amount){
        return "⚡ " +  states[variables.ulm_chip_electric_price].state + variables.ulm_translation_currency;
      } else {
        return "⚡ " +  helpers.localize(states[variables.ulm_chip_electric_consumption]);
      }
    ]]]