Giter Club home page Giter Club logo

price_calc's Introduction

Price calc

Home assistant custom component for calculating price of running a electric appliance with non-linear energy usage.

For getting the electricity prices the awesome Energi Data Service custom component from @MTrab is required.

Simulates the price using a rolling window: ![price_calc_principle] price_calc_principle

Blue: electricity price
Black: energy usage
Red: calculated price for running appliance

THIS IS ONLY TESTED USING A SHELLY PLUG S

Creates a single sensor with current price and following attributes:

Entities with home charger

Attribute Description
current_time Datetime matching the price_now sensor.
next_lowest Datetime of the lowest calculated price with available energy prices that has not yet parsed.
next_lowest price Lowest calculated price with available energy prices that has not yet parsed.
diff_now_and_next_lowest Difference in calculated price now compared to the next cheapest calculated price.
delay_hours Delay in whole hours to cheapest start hourly from now. Be aware that this is not necessarily the absolute cheapest time.
delay_hours_price Calculated price when delaying for delay_hours.
diff_now_and_delay Calculated price difference when starting appliance now versus delaying for delay_hours.
todays_highest The highest calculated price with available energy prices.
today_highest_time Datetime of the highest calculated price with available energy prices.
todays_lowest The lowest calculated price with available energy prices.
today_lowest_time Datetime of the lowest calculated price with available energy prices.
price_data All calculated prices and datetimes with available data. This is optional to add during setup. Be aware that this attribute can contain a lot of data!

Data

History

For best results a consistent energy usage of electric appliance is needed. I have tested it using af Shelly Plug S. When using default Shelly integration data was updated with inconsistency, ranging from update interval from 45-75 seconds.
When adding a REST sensor like this:

rest:
  resource: http://192.168.1.83/meter/0
  scan_interval: 1
  sensor:
    - name: "shelly_rest_energy"
      unique_id: "shelly_rest_energy"
      unit_of_measurement: "kWh"
      value_template: "{{ value_json.total / 60000 }}"

Update interval variance was less than 1 second. Make sure to delete this sensor after creating the price calc sensor to reduce network traffic.

File

If you already have downloaded a config file or added to the custom_components/price_calc/data you can select this file during setup. Be aware that you need to restart Home Assistant if file is added while Home Assistant is running.

URL

You can share and download config files from https://github.com/fars-fede-fire/price_calc_data

  1. Find the file you want to use in the repo and open it.
  2. Click 'Raw' in the upper right corner.
  3. Copy the URL and insert during setup when prompted.

price_calc's People

Contributors

fars-fede-fire avatar dependabot[bot] avatar

Stargazers

Bjarne Nielsen avatar  avatar  avatar

Watchers

 avatar Bjarne Nielsen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.