Custom component to get usage data and prices from Greenely for Home Assistant.
Because Greenely doesn't have an open api yet, we are using the Android user-agent to access data. Data is fetched every hour.
- 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 calledgreenely
. - Download all the files from the
custom_components/greenely/
directory (folder) in this repository. - Place the files you downloaded in the new directory (folder) you created.
- Add a sensor
- platform: greenely
to your HA configuration.
Using your HA configuration directory (folder) as a starting point you should now also have this:
custom_components/greenely/__init__.py
custom_components/greenely/sensor.py
custom_components/greenely/manifest.json
key | type | description |
---|---|---|
platform (Required) | string | greenely |
email (Required) | string | Your Greenely username. |
password (Required) | string | Your Greenely password. |
usage (Optional) | boolean | Creates a sensor showing usage data. The state of this sensor is yesterday's total usage. Default true . |
sold (Optional) | boolean | Creates a sensor showing sold electricity data. The state of this sensor is the total value. Default false . |
prices (Optional) | boolean | Creates a sensor showing price data. Default true . |
show_hourly (Optional) | boolean | Show yesterday's hourly data. Default false . |
usage_days (Optional) | number | How many days of usage data you want. Default 10 . |
sold_measure (Optional) | number | How many months or days of sold data you want to see. Default 2 . |
sold_daily (Optional) | boolean | Show daily sold data instead of monthly. Default false . |
date_format (Optional) | string | Default %b %d %Y , shows up as Jan 18 2020 . References |
time_format (Optional) | string | Default %H:%M , shows up as 10:00 . References |
Configuration with default settings:
sensor:
- platform: greenely
email: [email protected]
password: 1234
Configuration with custom settings:
sensor:
- platform: greenely
email: [email protected]
password: 1234
usage: true
prices: false
sold: true
show_hourly: true
sold_daily: true
usage_days: 4
sold_measure: 6
time_format: '%H'
date_format: '%d/%m/%Y'
Example usage with flex-table-card:
- type: 'custom:flex-table-card'
title: Greenely Usage
sort_by: date
entities:
include: sensor.greenely_usage
columns:
- name: date
attr_as_list: days
modify: x.date
icon: mdi:calendar
- name: kWh
attr_as_list: days
modify: x.usage
icon: mdi:flash
Example prices with flex-table-card:
- type: custom:vertical-stack-in-card
cards:
- type: horizontal-stack
cards:
- type: 'custom:flex-table-card'
title: Today
sort_by: date
entities:
include: sensor.greenely_prices
columns:
- name: time
attr_as_list: current_day
modify: x.time
icon: mdi:clock
- name: price(öre/kWh)
attr_as_list: current_day
modify: Math.round(x.price * 10) / 10
icon: mdi:cash
- type: 'custom:flex-table-card'
title: Tomorrow
sort_by: date
entities:
include: sensor.greenely_prices
columns:
- name: time
attr_as_list: next_day
modify: x.time
icon: mdi:clock
- name: price(öre/kWh)
attr_as_list: next_day
modify: Math.round(x.price * 10) / 10
icon: mdi:cash
current_day, next_day & current_month
[{ "date": "Jan 18 2020", "time": "13:00", "price": "24.75" }]
days
[{ "date": "Jan 12 2020", "usage": "11.0" }]
hourly
[{ "time": "10:00", "usage": "1.0" }]
sold_data
[{ "date": "Jan 12 2020", "usage": "11.0", "is_complete": true }]