Skip to content

Custom component to get usage data and prices from Greenely for Home Assistant

License

Notifications You must be signed in to change notification settings

vlumikero/sensor.greenely

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

sensor.greenely

GitHub last commit

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.

Installation

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called greenely.
  4. Download all the files from the custom_components/greenely/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. 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

Configuration

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

Example

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'

Lovelace

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

image

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

image

Data object structures

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 }]

About

Custom component to get usage data and prices from Greenely for Home Assistant

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%