Coder Social home page Coder Social logo

bottlecapdave / homeassistant-carbonintensity Goto Github PK

View Code? Open in Web Editor NEW
5.0 4.0 0.0 840 KB

Unofficial Home Assistant integration based on data supplied by carbonintensity.org.uk

Home Page: https://bottlecapdave.github.io/HomeAssistant-CarbonIntensity

License: MIT License

JavaScript 1.86% Python 98.14%
energy-efficiency green home-assistant home-automation smart-home carbon-intensity-api carbon-intensity carbon-intensity-forecast

homeassistant-carbonintensity's People

Contributors

bottlecapdave avatar github-actions[bot] avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

homeassistant-carbonintensity's Issues

Carbon intensity for day rates and targets

Describe the bug

Mismatch in carbon intensity values between day rates and target times attribute of a target.

Reproduction steps

Plot current and next day rates on the same apex chart as targets, as follows:

type: custom:apexcharts-card
graph_span: 2d
now:
show: true
all_series_config:
stroke_width: 1
span:
start: day
apex_config:
dataLabels:
enabled: true
header:
show: true
title: Carbon Intensity
show_states: false
colorize_states: true
series:

  • entity: event.carbon_intensity_north_west_england_current_day_rates
    data_generator: |
    return entity.attributes.rates.map((entry) => {
    return [entry.from, entry.intensity_forecast];
    });
    extend_to: false
    curve: stepline
    name: Today
  • entity: event.carbon_intensity_north_west_england_next_day_rates
    data_generator: |
    return entity.attributes.rates.map((entry) => {
    return [entry.from, entry.intensity_forecast];
    });
    curve: stepline
    name: Tomorrow
  • entity: binary_sensor.carbon_intensity_target_dishwasher
    data_generator: |
    return entity.attributes.target_times.map((entry) => {
    return [entry.from, entry.intensity_forecast];
    });
    type: area
    name: Dishwasher
  • entity: binary_sensor.carbon_intensity_target_ev_charging
    data_generator: |
    return entity.attributes.target_times.map((entry) => {
    return [entry.from, entry.intensity_forecast];
    });
    type: area
    name: EV

Expected behaviour

Carbon intensity values match

Integration Version

2.0.2

Home Assistant Version

2024.4.3

Fresh Install?

Not specified

Home Assistant Logs

Screenshot 2024-04-21 205741

The dishwasher target is for 2 hours between 23:30 and 05:30. The EV target is for 6 hours between the same times.

Current carbon intensity

Hey - just found your repo. I had previously been using your Octopus Energy integration, and was pleased to see more of your work.

I'm not yet ready to use the target sensors, but I would like to use the regional Carbon Intensity figure rather than the national UK one from CO² Signal in my Energy dashboard. Is this possible through this integration?

No current_day_rates or next_day_rates

Describe the bug

Current rating and its attributes populate fine.

After installation, current_day_rates and next_day_rates are disabled by the integration. After enabling them manually, neither current_day_rates nor next_day_rates have any attributes. They have update events, but that is it.

Reproduction steps

Install and configure addin, manually enable current_day_rates and next_day_rates.

Expected behaviour

current_day_rates and next_day_rates have attributes that provide carbon intensity details for each 30 minute period.

Integration Version

v2.0.2

Home Assistant Version

2024.3.3

Fresh Install?

Fresh install

Home Assistant Logs

2024-03-24 20:08:01.669 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:08:01.670 INFO (MainThread) [custom_components.carbon_intensity.entities.current_rating] Updating CarbonIntensityCurrentRating
2024-03-24 20:08:04.976 WARNING (MainThread) [motioneye_client.client] Connection failed to motionEye: Cannot connect to host 192.168..:80 ssl:default [Connect call failed ('192.168..', 80)]
2024-03-24 20:08:13.798 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:08:13.799 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:08:13.805 DEBUG (MainThread) [custom_components.carbon_intensity.event] Setting up main sensors
2024-03-24 20:08:13.889 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:08:13.896 DEBUG (MainThread) [custom_components.carbon_intensity.entities.current_rating] Restored CarbonIntensityCurrentRating state: 143
2024-03-24 20:08:13.896 INFO (MainThread) [custom_components.carbon_intensity.entities.current_rating] Updating CarbonIntensityCurrentRating
2024-03-24 20:08:13.899 WARNING (MainThread) [homeassistant.components.automation.ev_charging] EV charging: Already running
2024-03-24 20:09:07.806 WARNING (MainThread) [plugp100.protocol.passthrough_protocol] Session timeout, invalidate it, retrying with new session
2024-03-24 20:09:13.559 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:09:13.559 INFO (MainThread) [custom_components.carbon_intensity.entities.current_rating] Updating CarbonIntensityCurrentRating
2024-03-24 20:09:28.176 WARNING (MainThread) [motioneye_client.client] Connection failed to motionEye: Cannot connect to host 192.168.
.
:80 ssl:default [Connect call failed ('192.168..', 80)]
2024-03-24 20:10:13.558 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:10:13.560 INFO (MainThread) [custom_components.carbon_intensity.entities.current_rating] Updating CarbonIntensityCurrentRating
2024-03-24 20:10:39.791 WARNING (MainThread) [custom_components.octopus_energy.api_client] Errors in request (https://api.octopus.energy/v1/graphql/): [{'message': 'Unable to find device for given account.', 'locations': [{'line': 2, 'column': 2}], 'path': ['plannedDispatches'], 'extensions': {'errorType': 'NOT_FOUND', 'errorCode': 'KT-CT-4301', 'errorDescription': 'We were unable to find a device for the given account. Please check that the account number (and property ID) is correct.'}}, {'message': 'Unable to find device for given account.', 'locations': [{'line': 11, 'column': 2}], 'path': ['completedDispatches'], 'extensions': {'errorType': 'NOT_FOUND', 'errorCode': 'KT-CT-4301', 'errorDescription': 'We were unable to find a device for the given account. Please check that the account number (and property ID) is correct.'}}]
2024-03-24 20:10:39.792 WARNING (MainThread) [custom_components.octopus_energy.coordinators.intelligent_dispatches] Failed to retrieve new dispatches - using cached dispatches. Next attempt at 2024-03-24 21:02:37.739992+00:00
2024-03-24 20:10:51.759 WARNING (MainThread) [motioneye_client.client] Connection failed to motionEye: Cannot connect to host 192.168.
.
:80 ssl:default [Connect call failed ('192.168..', 80)]
2024-03-24 20:11:13.559 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:11:13.560 INFO (MainThread) [custom_components.carbon_intensity.entities.current_rating] Updating CarbonIntensityCurrentRating
2024-03-24 20:12:13.558 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:12:13.560 INFO (MainThread) [custom_components.carbon_intensity.entities.current_rating] Updating CarbonIntensityCurrentRating
2024-03-24 20:12:15.216 WARNING (MainThread) [motioneye_client.client] Connection failed to motionEye: Cannot connect to host 192.168.
.
:80 ssl:default [Connect call failed ('192.168..', 80)]
2024-03-24 20:13:07.805 WARNING (MainThread) [plugp100.protocol.passthrough_protocol] Session timeout, invalidate it, retrying with new session
2024-03-24 20:13:38.672 WARNING (MainThread) [motioneye_client.client] Connection failed to motionEye: Cannot connect to host 192.168.
.
:80 ssl:default [Connect call failed ('192.168..', 80)]
2024-03-24 20:15:02.000 WARNING (MainThread) [motioneye_client.client] Connection failed to motionEye: Cannot connect to host 192.168.
.
:80 ssl:default [Connect call failed ('192.168..', 80)]
2024-03-24 20:16:25.328 WARNING (MainThread) [motioneye_client.client] Connection failed to motionEye: Cannot connect to host 192.168.
.
:80 ssl:default [Connect call failed ('192.168..', 80)]
2024-03-24 20:16:32.707 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:16:32.708 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:16:32.710 DEBUG (MainThread) [custom_components.carbon_intensity.event] Setting up main sensors
2024-03-24 20:16:32.729 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:16:32.733 DEBUG (MainThread) [custom_components.carbon_intensity.entities.current_rating] Restored CarbonIntensityCurrentRating state: 21
2024-03-24 20:16:32.734 INFO (MainThread) [custom_components.carbon_intensity.entities.current_rating] Updating CarbonIntensityCurrentRating
2024-03-24 20:16:32.746 INFO (MainThread) [custom_components.carbon_intensity.entities.current_rating] Updating CarbonIntensityCurrentRating
2024-03-24 20:17:07.803 WARNING (MainThread) [plugp100.protocol.passthrough_protocol] Session timeout, invalidate it, retrying with new session
2024-03-24 20:17:30.788 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:17:30.790 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:17:30.791 DEBUG (MainThread) [custom_components.carbon_intensity.event] Setting up main sensors
2024-03-24 20:17:30.806 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:17:30.824 DEBUG (MainThread) [custom_components.carbon_intensity.entities.current_rating] Restored CarbonIntensityCurrentRating state: 143
2024-03-24 20:17:30.824 INFO (MainThread) [custom_components.carbon_intensity.entities.current_rating] Updating CarbonIntensityCurrentRating
2024-03-24 20:17:48.912 WARNING (MainThread) [motioneye_client.client] Connection failed to motionEye: Cannot connect to host 192.168.
.
:80 ssl:default [Connect call failed ('192.168..', 80)]
2024-03-24 20:18:30.544 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:18:30.545 INFO (MainThread) [custom_components.carbon_intensity.entities.current_rating] Updating CarbonIntensityCurrentRating
2024-03-24 20:19:12.112 WARNING (MainThread) [motioneye_client.client] Connection failed to motionEye: Cannot connect to host 192.168.
.
:80 ssl:default [Connect call failed ('192.168..**', 80)]
2024-03-24 20:19:13.716 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:19:13.717 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:19:13.719 DEBUG (MainThread) [custom_components.carbon_intensity.event] Setting up main sensors
2024-03-24 20:19:13.797 DEBUG (MainThread) [custom_components.carbon_intensity.coordinators.rates] Finished fetching rates_3 data in 0.000 seconds (success: True)
2024-03-24 20:19:13.807 DEBUG (MainThread) [custom_components.carbon_intensity.entities.current_rating] Restored CarbonIntensityCurrentRating state: 143
2024-03-24 20:19:13.807 INFO (MainThread) [custom_components.carbon_intensity.entities.current_rating] Updating CarbonIntensityCurrentRating

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.