Creates a new platform to track cost of individual sensors.
This integration will set up the following platforms.
Platform | Description |
---|---|
cost |
Tracks cost for a sensor based on a tariff. |
- Using the tool of choice open the directory (folder) for your HA configuration (where you find
configuration.yaml
). - If you do not have a
custom_components
directory (folder) there, you need to create it. - In the
custom_components
directory (folder) create a new folder calledcost
. - Download all the files from the
custom_components/cost/
directory (folder) in this repository. - Place the files you downloaded in the new directory (folder) you created.
- Restart Home Assistant
- Add a new sensor to your yaml config, see examples and schema below.
Name | Type | Default | Since | Description |
---|---|---|---|---|
name | string | required | v0.0.1 | Name of sensor |
source | entity | required | v0.0.1 | Increasing sensor, for example energy sensor |
tariff | entity | required | v0.0.1 | Sensor for cost per unit of source sensor |
unit_of_measurement | string | required | v0.0.1 | Output unit of measurement for this sensor |
cron | string | optional | v0.0.1 | How often sensor resets. Allowed values are hourly, daily, weekly, monthly or yearly. |
If cron
does not have any value, the sensor will never reset it's value, and can that way be used to keep
track of lifetime costs.
Example:
- platform: cost
source: sensor.your_energy_sensor_here_kwh
tariff: sensor.power_cost_usd_kwh
name: "Cost of something per hour"
unit_of_measurement: "USD"
cron: hourly
The above yaml will create a new sensor that will track cost for sensor given in source
.
Source sensor should be a sensor that increases it's value over time, for example an energy sensor(kWh, m^3 and so on).
The cost sensor is calculated based on delta values for the source
sensor multiplied with the tariff sensor.
Tariff sensor input is a sensor that tracks cost per unit of source sensor, for example electricity cost per kWh.
Caution The platform entity does no validation of sensor types and units, you are responsible for ensuring that the tariff sensors unit_of_measurement matches the delta values produced by the source sensor.
If you want to contribute to this please read the Contribution guidelines