Git Product home page Git Product logo

flexmeasures-ha-integration's Introduction

FlexMeasures

The flexmeasures integration offers an integration with FlexMeasures instances to schedule flexible energy assets.

FlexMeasures can be used to schedule batteries, EV's, heat storage, and other assets. The integration offers:

  • A sensor for flexible asset schedules
  • A service to retrieve a schedule
  • A service to post measurements to a FlexMeasures instance
  • A service to change an S2 control type

To add this integration the following configuration input is needed:

# Example configuration.yaml entry
flexmeasures:
  host: "FLEXMEASURES_INSTANCE"
  username: "USERNAME"
  password: "PASSWORD"
  power_sensor: "POWER_SENSOR_ID"
  consumption_price_sensor: "CONSUMPTION_PRICE_SENSOR_ID"
  production_price_sensor: "PRODUCTION_PRICE_SENSOR_ID"
  soc_sensor: "STATE_OF_CHARGE_SENSOR_ID"
  rm_discharge_sensor: "RESOURCE_MANAGER_DISCHARGE_SENSOR_ID"
  schedule_duration: "SCHEDULE_DURATION"
  soc_unit: "STATE_OF_CHARGE_UNIT"
  soc_min: "STATE_OF_CHARGE_MINIMUM"
  soc_max: "STATE_OF_CHARGE_MAXIMUM"

{% configuration %} host: description: URI of the FlexMeasures instance, for instance (flexmeasures.io) required: true type: string username: description: The username associated with the FlexMeasures instance account. required: true type: string password: description: The password with the FlexMeasures instance account. required: true type: string power_sensor: description: The power sensor that will be scheduled to draw or supply power. required: true type: integer consumption_price_sensor: description: The price sensor for the consumption of power to use for the optimization. required: true type: integer production_price_sensor: description: The price sensor for the production of power to use for the optimization (this can be the same as the consumption price sensor). required: true type: integer soc_sensor: description: The state of charge sensor of the flexible energy asset. required: true type: integer rm_discharge_sensor: description: The resource manager discharge sensor. required: true type: integer schedule_duration: description: The duration for which the schedules should be calculated in hours. required: true default: 24 type: integer soc_unit: description: The state of charge unit of energy. required: true default: kWh type: string soc_min: description: The minimal state of charge that the flexible energy asset is allowed to reach. required: true type: float soc_max: description: The maximum state of charge that the flexible energy asset is allowed to reach. required: true type: float {% endconfiguration %}

{% include integrations/config_flow.md %}

Schedule Sensor

The Flexmeasures Schedule sensor shows the values of the power draw or supply at the start of each interval. It contains a startdatetime, unit of measurement, and a device class as well. The schedule is automatically shifted up to be in line with the sensor resolution.

schedule:
  - start: '2023-09-04T17:45:00+02:00'
    value: -0.5
  - start: '2023-09-04T18:00:00+02:00'
    value: -0.5
start: '2023-09-04T17:45:00+02:00'
unit_of_measurement: MWh
device_class: energy
friendly_name: FlexMeasures Schedule

The scheduling service

For a schedule to be calculated a soc_at_start is required. All other variables needed to calculate a new schedule were provided in the configuration. The following yaml file will trigger a schedule and update the sensor:

service: flexmeasures.trigger_and_get_schedule
data:
  soc_at_start: "FLOAT_SOC_AT_START"

Automate scheduling

The intended usage of FlexMeasures is letting the schedules and Home Assistant optimize the flexible energy assets without user interaction. Automations can be used to trigger new schedules when new information is available that would impact the schedule. Some examples of events that should trigger the request of new schedules are when the battery/asset is connected, when new prices are available, and periodically to match the executed schedule to the calculated schedule. The user will need to provide a Home Assistant entity as a soc_at_start to be used for triggering a schedule. This is an example yaml for the action set in the automations:

service: flexmeasures.trigger_and_get_schedule
data:
  soc_at_start: "\{\{ state_attr\('SENSOR_TYPE.SENSOR', 'SENSOR_ATTRIBUTES'\) \}\}"

flexmeasures-ha-integration's People

Contributors

gustaafl avatar flix6x avatar victorgarcia98 avatar

Stargazers

Charith Madhuranga avatar  avatar

Watchers

 avatar  avatar

Forkers

flix6x

flexmeasures-ha-integration's Issues

Cannot run Config Flow

Added the HACS add-on.
When I try to create a new integration in "Devices & services" I get the error:

Config flow could not be loaded: { "message":  "Invalid handler specified" }

Config flow error

When filling in seita.energy as a host, I got an uninformative error in the UI. The HA logs showed more, though:

Traceback (most recent call last):
  File "/config/custom_components/flexmeasures_hacs/config_flow.py", line 98, in async_step_user
    info = await validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/flexmeasures_hacs/config_flow.py", line 54, in validate_input
    host, ssl = get_host_and_ssl_from_url(data["url"])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/flexmeasures_hacs/config_flow.py", line 239, in get_host_and_ssl_from_url
    return host, ssl
           ^^^^
UnboundLocalError: cannot access local variable 'host' where it is not associated with a value

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.