Skip to content

Commit

Permalink
Merge pull request #98 from knudsvik/savings
Browse files Browse the repository at this point in the history
Savings and Cost
  • Loading branch information
knudsvik authored Feb 26, 2023
2 parents 02d990f + 00abc1c commit acee567
Show file tree
Hide file tree
Showing 9 changed files with 1,032 additions and 86 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ sensor:
name: My second energy score
energy_entity: sensor.total_energy_consumption
price_entity: sensor.electricity_price
unique_id: fknfkkkf
unique_id: fknfkkkf
- platform: demo
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
[![License][license-shield]](LICENSE)
[![BuyMeCoffee][buymecoffeebadge]][buymecoffee]

An EnergyScore integration provides three sensors; EnergyScore, Cost and Potential Savings.

EnergyScore is a metric that scores how well you are utilizing changing energy prices throughout the last 24 hours. The EnergyScore will be 0% if you use all of your energy in the most expensive hour, 100% in the cheapest hour, but most likely somewhere in between depending on how well you are able to match your energy use with cheap prices. This integration will not try to optimize your energy use, but is complementary to those like [PowerSaver](https://powersaver.no) or [PriceAnalyzer](https://github.com/erlendsellie/priceanalyzer).

<img src="https://raw.githubusercontent.com/knudsvik/EnergyScore/master/resources/energyScore_gauge.png" title="EnergyScore Gauge"/>

You can set up several EnergyScore sensors,e.g. one on your total energy usage, another for EV charging or maybe one for your boiler. Each sensor has a quality attribute with a score from 0 to 1 depending on the available data. If a sensor has price and energy data for 18 hours of the last 24, the quality will be 0.75. The higher the quality is, the more you can trust the EnergyScore.
The cost sensor provides the current day cost while the potential savings sensor compares actual current day cost with what the cost would be if all energy was consumed in the cheapes hour of the day. This is thus the potential savings that can be achieved if energy usage is optimised.

You can set up several EnergyScore integrations,e.g. one on your total energy usage, another for EV charging or maybe one for your boiler or dishwasher. EnergyScore and Potential Savings sensors both have a quality attribute with a score from 0 to 1 depending on the available data. If a sensor has price and energy data for 18 hours of the last 24, the quality will be 0.75. The higher the quality is, the more you can trust the sensors.

# Get started

Expand All @@ -30,8 +33,8 @@ EnergyScore sensors can be added directly from the user interface by using the M

Attribute | Description
--------- | -----------
Name | The name the sensor should have. You can change it again later.
Energy entity | A total (cumulative) energy entity, e.g. from Tibber or PowerCalc integrations or a state from a device. It can be both an entity that resets at given intervals or one that keeps increasing indefinetely.
Name | Name of the integration instance. This will provide name for the sensors to use in the frontend, but can be changed later. "Boiler" will give sensors: sensor.boiler_energyscore, sensor.boiler_cost and sensor.boiler_potential_savings (which can all be changed later).
Energy entity | A total (cumulative) energy entity, e.g. from Tibber or PowerCalc integrations or a state from a device. It can be both an entity that resets at given intervals or one that keeps increasing indefinetely. If several is available, it is recommended to choose one with high update frequency.
Price entity | A price entity which provides the current hourly energy price as the state, e.g. from Nordpool or Tibber integrations.

### Advanced configuration
Expand All @@ -50,7 +53,7 @@ Alternatively, this integration can be configured and set up manually via YAML i
```yaml
sensor:
- platform: energyscore
name: Heater Energy Score
name: Heater
energy_entity: sensor.heater_energy
price_entity: sensor.nordpool_electricity_price
```
Expand All @@ -59,8 +62,8 @@ sensor:
Attribute | Data type | Type | Description
--------- | --------- | ---- | -----------
name | string | Required | Name of the sensor to use in the frontend.
energy_entity | string | Required | A total (cumulative) energy entity, e.g. from Tibber or PowerCalc integrations or a state from a device. It can be both an entity that resets at given intervals or one that keeps increasing indefinetely.
name | string | Required | Name of the integration instance. This will provide name for the sensors to use in the frontend, but can be changed later if a unique_id is provided. "Boiler" will give sensors: sensor.boiler_energyscore, sensor.boiler_cost and sensor.boiler_potential_savings.
energy_entity | string | Required | A total (cumulative) energy entity, e.g. from Tibber or PowerCalc integrations or a state from a device. It can be both an entity that resets at given intervals or one that keeps increasing indefinetely. If several is available, it is recommended to choose one with high update frequency.
price_entity | string | Required | TA price entity which provides the current hourly energy price as the state, e.g. from Nordpool or Tibber integrations.
unique_id | string | Optional | Unique id to be able to configure the entity in the UI.
energy_treshold | float | Optional | Energy less than the treshold (during one hour) will not contribute to the EnergyScore (default = 0).
Expand Down
2 changes: 1 addition & 1 deletion custom_components/energyscore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant

from .const import DOMAIN, CONF_ROLLING_HOURS, CONF_TRESHOLD
from .const import CONF_ROLLING_HOURS, CONF_TRESHOLD, DOMAIN

PLATFORMS = [Platform.SENSOR]

Expand Down
7 changes: 7 additions & 0 deletions custom_components/energyscore/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

# Icons
ICON = "mdi:speedometer"
ICON_COST = "mdi:currency-eur"
ICON_SAVINGS = "mdi:piggy-bank"

# Configuration and options
CONF_PRICE_ENTITY = "price_entity"
Expand All @@ -12,7 +14,12 @@
CONF_TRESHOLD = "energy_treshold"

# Other
COST_AVG = "average_cost"
COST_MAX = "maximum_cost"
COST_MIN = "minimum_cost"
ENERGY = "total_energy"
ENERGY_TODAY = "energy_today"
LAST_ENERGY = "last_updated_energy"
LAST_UPDATED = "last_updated"
PRICES = "price"
QUALITY = "quality"
12 changes: 6 additions & 6 deletions custom_components/energyscore/manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"domain": "energyscore",
"name": "EnergyScore",
"integration_type": "device",
"codeowners": [
"@knudsvik"
],
"config_flow": true,
"documentation": "https://github.com/knudsvik/energyscore",
"integration_type": "device",
"iot_class": "calculated",
"issue_tracker": "https://github.com/knudsvik/energyscore/issues",
"version": "1.2.1",
"config_flow": true,
"codeowners": [
"@knudsvik"
]
"version": "1.3.0"
}
Loading

0 comments on commit acee567

Please sign in to comment.