megakid / ha_octopus_intelligent Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Hi - excellent integration BTW - I'm using the beta Ohme EVSE / Intelligent set up rather than a car API set up. Is there any way of displaying the plannedDispatches in a user friendly format (table/list?) on a LoveLace card in HA?
I am getting this error when the integration tries to start:
Retrying setup: Error communicating with Octopus GraphQL API: {'message': 'An internal error occurred', 'locations': [{'line': 2, 'column': 3}], 'path': ['vehicleChargingPreferences']}
Also I am unsure what I should put for the account_id. Is it my login email, or the account number?
I am currently using my account login email.
I have been successfully communication with the Octopus API from Node Red for some time so I know my API Key is correct.
Regards
Bill
I've downloaded via hacs and the logs state
(SyncWorker_0) [homeassistant.loader] We found a custom integration octopus_intelligent which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
However I do not see it in the add integration option
After upgrading to Home Assistant 2023.06 the Octopus Intelligent Slot entities (Slot, Slot 1hr, 2hrs, 3hrs and Planned Dispatch are not available. It was all good before the upgrade.
I am using Home Assistant OS, on a Raspberry Pi 4.
Home Assistant 2023.6.0
Supervisor 2023.06.1
Operating System 10.2
Frontend 20230607.0 - latest
I have the following errors in the log:
Logger: py.warnings
Source: runner.py:179
First occurred: 21:48:42 (1 occurrences)
Last logged: 21:48:42
/usr/local/lib/python3.11/asyncio/base_events.py:1907: RuntimeWarning: coroutine 'OctopusIntelligentSystem.start' was never awaited handle = self._ready.popleft()
and
Logger: homeassistant.components.binary_sensor
Source: custom_components/octopus_intelligent/binary_sensor.py:100
Integration: Binary Sensor (documentation, issues)
First occurred: 21:48:56 (1 occurrences)
Last logged: 21:48:56
Error while setting up octopus_intelligent platform for binary_sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 320, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/octopus_intelligent/binary_sensor.py", line 19, in async_setup_entry
OctopusIntelligentSlot(
File "/config/custom_components/octopus_intelligent/binary_sensor.py", line 59, in __init__
self._timer = async_track_utc_time_change(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1628, in async_track_utc_time_change
f"time change listener {hour}:{minute}:{second} {action}",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1026, in __repr__
return f"<entity {self.entity_id}={self._stringify_state(self.available)}>"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 596, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 211, in state
if (is_on := self.is_on) is None:
^^^^^^^^^^
File "/config/custom_components/octopus_intelligent/binary_sensor.py", line 100, in is_on
return self._is_on
^^^^^^^^^^^
AttributeError: 'OctopusIntelligentSlot' object has no attribute '_is_on'
Not sure if it is just a matter of time, and waiting would mean the slot would be updated, or if there is a bug here in the move to Python 3.11.
Hi, just double checking that this is by design rather than a bug:
When changing Target Ready Time, Target % or Boost/immediate charge button, it will not work with OHME chargers as point of OE control as the stream is one way from Ohme to OE?????
Thanks
I run the automation which changes solar inverter work mode based on the IO off-peak on or off. but last few days I noticed that while automation segment which uses the "IO Tariff ON "works as it should, the segment with "IO Tariff OFF" is not working.
From the logs:
December 5, 2023
Octopus Bump Charge turned off
9:14:26 AM - 2 hours ago
Octopus Target Ready By Time changed to 06:30
9:14:26 AM - 2 hours ago
Octopus Intelligent Offpeak End became unknown
9:14:25 AM - 2 hours ago
Octopus Intelligent Next Offpeak Start changed to December 5, 2023 at 11:30 PM
9:14:25 AM - 2 hours ago
Can it be some changes in the api/entities? can you please check on it/update?
Hi, been using this for a long time now but has stopped working sometime in the last week or so. Anyone else found the same? My charging slot, regardless of my intelligent slot, has reverted to the standard 23:30-05:30.
When running the integration, I see the following error in the logs.
Logger: py.warnings
Source: runner.py:188
First occurred: 09:36:56 (1 occurrences)
Last logged: 09:36:56
/usr/local/lib/python3.11/asyncio/base_events.py:1910: RuntimeWarning: coroutine 'OctopusIntelligentSystem.start' was never awaited handle = self._ready.popleft()
It all seems to work fine, but a sign that the logic is not quite right.
Attempting to register the integration, wizard just reloads with blank API and ID fields when submitted, the following is in the log on the most recent version of HA
Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/octopus_intelligent/config_flow.py", line 61, in async_step_user
await self.hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 587, in async_add_executor_job
task = self.loop.run_in_executor(None, target, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 818, in run_in_executor
self._check_callback(func, 'run_in_executor')
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 773, in _check_callback
raise TypeError(
TypeError: coroutines cannot be used with run_in_executor()
Updated to the latest version today, Since rebooting HA I get this error.
Logger: homeassistant.setup
Source: setup.py:251
First occurred: 15:31:29 (1 occurrences)
Last logged: 15:31:29
Setup failed for custom integration 'octopus_intelligent': Unable to import component: cannot import name 'override' from 'typing' (/usr/local/lib/python3.11/typing.py)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 251, in _async_setup_component
component = integration.get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 822, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/config/custom_components/octopus_intelligent/init.py", line 3, in
from .octopus_intelligent_system import OctopusIntelligentSystem
File "/config/custom_components/octopus_intelligent/octopus_intelligent_system.py", line 3, in
from typing import Any, override
ImportError: cannot import name 'override' from 'typing' (/usr/local/lib/python3.11/typing.py)
Would it be possible to get a binary sensor that is active when a smart charge schedule has been created for that day? I've had issues where it has failed to create one but I didn't know until next day when the car wasn't charged
HI, hope someone can help, Integration is working with switch on @ 23:31:01s but does not turn off until 05:31:21s is there something I can do to get the turn off nearer the correct time of 05:30:00?
Hi,
I'm just raising awareness, as some users who use this will have the smart Charger, OHME etc control the car, Octopus controlling the charger rather than the car, this can and has caused issues for some due to the "smart charging" toggle being selected, which has then in turn triggered the Api to turn the charging off, yet that is not actually a thing for the smart charger side of IOG, would it be possible to add some further checks if octopus is controlling the car charging, or if octopus controlling a smart charger as more and more ppl starting to use Intergrations with home assistant and it's breaking there chargers
Since updating from HA 2023.5 to 2023.6 I'm unable to restart the octopus intelligent integration. In the new integration page layout, I click on the settings cog for octopus intelligent, then click on the 3 dots, but reload is not an option, unlike when I do the same for other integrations.
This is a problem for me, as I've noticed that after a HA restart, I need to restart the OI integration for the values to refresh from "unavailable"
I've noticed recently that enabling or disabling Smart Charging in the integration is not updating the status in the Octopus app.
I just restarted HA (new version) and the IO binary sensors are not working, error log says:
Error while setting up octopus_intelligent platform for binary_sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/octopus_intelligent/binary_sensor.py", line 19, in async_setup_entry
OctopusIntelligentSlot(
File "/config/custom_components/octopus_intelligent/binary_sensor.py", line 59, in init
self._timer = async_track_utc_time_change(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1687, in async_track_utc_time_change
f"time change listener {hour}:{minute}:{second} {action}",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1245, in repr
return f"<entity {self.entity_id}={self._stringify_state(self.available)}>"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 785, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/binary_sensor/init.py", line 218, in state
if (is_on := self.is_on) is None:
^^^^^^^^^^
File "/config/custom_components/octopus_intelligent/binary_sensor.py", line 100, in is_on
return self._is_on
^^^^^^^^^^^
AttributeError: 'OctopusIntelligentSlot' object has no attribute '_is_on'
May be related to previous error:
Logger: py.warnings
Source: runner.py:186
First occurred: 9:15:17 AM (1 occurrences)
Last logged: 9:15:17 AM
/usr/local/lib/python3.11/asyncio/base_events.py:1907: RuntimeWarning: coroutine 'OctopusIntelligentSystem.start' was never awaited handle = self._ready.popleft()
i installed the plug in pre signing up to Intelligent Octopus.
Now that I've switched to IO, the plug in will not pull any data.
So I've selected delete from the menu, removed the plug in, restarted HA, stopped HA, re-added the plug in and now it wont reinstall
Whats the proper method for removing this plug in??
Executing the select_option service to set the target ready time does not work for half past the hour settings.
My test code looks like this...
service: select.select_option
data:
option: "08:30"
target:
entity_id: select.octopus_target_ready_by_time
Automation runs but the time is set to 08:00 instead.
Exactly the same code works if setting "09:00" for example. Feels like it is ignoring the :30 part.
Trying to add this via HACS I get this
GitHub - megakid/ha_octopus_intelligent is not a valid add-on repository
I'm attempting to set this up, but I get a failed message with the following tool-tip:
Any ideas?
Error communicating with Octopus GraphQL API: {'message': 'An internal error occurred', 'locations': [{'line': 2, 'column': 3}], 'path': ['vehicleChargingPreferences'], 'extensions': {'errorType': 'APPLICATION', 'errorCode': 'KT-CT-7899', 'errorDescription': ''}}
Octopus shows that my charging window is 11pm to 11am tonight.
However it didn't switch to On until 11.30pm, and tells me that the 'Octopus Intelligent Offpeak End' is in 6 hours, at 5.30am.
I'm using the Intelligent Slot On to trigger charging house batteries, so right now my battery stops charging at 5.30am but my car continues charging and draining my battery before I'm even awake.
Before I upgraded to the latest version last week (I was fairly out of date) it was working perfectly.
Right now it only seems to operate between 11.30pm and 5.30am.
Just tried to install this integration and setup fails with following message. Have tried re-install a couple of times without success. Note that I have another integration for Octopus for Utility Meter data which is working fine.
2023-06-11 12:34:39.486 WARNING (MainThread) [homeassistant.config_entries] Config entry '' for octopus_intelligent integration not ready yet: Error communicating with Octopus GraphQL API: {'message': 'An internal error occurred', 'locations': [{'line': 2, 'column': 3}], 'path': ['vehicleChargingPreferences']}; Retrying in background
Hi.
This is probably a dumb question but I’ve spent some time trying to work it out. I’ve deleted the integration and reinstalled it.
The documentation says there are dispatch slots that I presume are populated when the charge schedule is
set up. However I can’t see any of these, the sensors are missing. My list is as per the attached screenshot
Is there a way we can get half hour prices for the slots scheduled, can then overlay on this actual consumption
I've had this integration installed since 13th Jan '24, and I've noticed that the Intelligent Planned Dispatch Slot
binary sensor has never changed to an "on" state:
While the other sensors are correctly working from my "cheap energy" window of 23:30 - 05:30, I am unable to see when Octopus actually wants to charge my car.
📓 This could be a duplicate of #31, it's not entirely clear from the description of that issue.
After upgrading to HA 2023.11.1 and installing the Intelligent Octopus integration through the dashboard, there appear to only be two sensors available, "Octopus Intelligent Next Offpeak Start" and "Octopus Intelligent Next Offpeak End".
Any ideas how to get back binary_sensor.octopus_intelligent_slot
?
Octopus tweeted me that all energy use during off peak periods is billed at off peak rates regardless of if the EV charged or not
https://twitter.com/OctopusEnergy/status/1757466242313495021?s=19
Hi @megakid!
Thanks for making a really useful integration for Home Assistant.
Do you think it might be possible to add the 'completedDispatches' as an attribute to the binary sensor?
completedDispatches(accountNumber: $accountNumber) {
startDtUtc: startDt
endDtUtc: endDt
chargeKwh: delta
meta {
source
location
}
}
Many thanks in advance :)
Joel
Hello,
I’ve been monitoring the Intelligent sots and comparing them with my bill and they don’t seem to be reliable enough to use for triggering battery charges. Is this something with my setup? An example would be the 26th Feb, see attached photos.
My bill shows an off peak slot 06:30-07:30 however homeassistant has it at 07:20-08:00
I have two different properties / accounts. They seem to have the same API key but can be differentiated by the Account number.
Both are on IO.
When I try to set up the second account, it doesn't work and I find the following in the log:
[ loads of very long lines... ! then ]
2023-07-11 18:32:04.785 DEBUG (MainThread) [custom_components.octopus_intelligent.octopus_intelligent_system] Finished fetching Octopus Intelligent data in 7.671 seconds (success: True)
2023-07-11 18:32:04.785 DEBUG (MainThread) [custom_components.octopus_intelligent] Octopus Intelligent System component setup finished
2023-07-11 18:32:04.786 INFO (MainThread) [homeassistant.components.switch] Setting up switch.octopus_intelligent
2023-07-11 18:32:04.787 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.octopus_intelligent
2023-07-11 18:32:04.787 INFO (MainThread) [homeassistant.components.select] Setting up select.octopus_intelligent
2023-07-11 18:32:04.787 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.octopus_intelligent
2023-07-11 18:32:04.789 ERROR (MainThread) [homeassistant.components.switch] Platform octopus_intelligent does not generate unique IDs. ID octopus_intelligent_smart_charging already exists - ignoring switch.octopus_smart_charging
2023-07-11 18:32:04.790 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform octopus_intelligent does not generate unique IDs. ID octopus_intelligent_slot already exists - ignoring binary_sensor.octopus_intelligent_slot
2023-07-11 18:32:04.790 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform octopus_intelligent does not generate unique IDs. ID octopus_intelligent_slot_next_1_hour already exists - ignoring binary_sensor.octopus_intelligent_slot_next_1_hour
2023-07-11 18:32:04.790 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform octopus_intelligent does not generate unique IDs. ID octopus_intelligent_slot_next_2_hours already exists - ignoring binary_sensor.octopus_intelligent_slot_next_2_hours
2023-07-11 18:32:04.791 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform octopus_intelligent does not generate unique IDs. ID octopus_intelligent_slot_next_3_hours already exists - ignoring binary_sensor.octopus_intelligent_slot_next_3_hours
2023-07-11 18:32:04.791 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform octopus_intelligent does not generate unique IDs. ID octopus_intelligent_planned_dispatch_slot already exists - ignoring binary_sensor.octopus_intelligent_planned_dispatch_slot
2023-07-11 18:32:04.791 ERROR (MainThread) [homeassistant.components.select] Platform octopus_intelligent does not generate unique IDs. ID octopus_intelligent_target_soc already exists - ignoring select.octopus_target_state_of_charge
2023-07-11 18:32:04.792 ERROR (MainThread) [homeassistant.components.select] Platform octopus_intelligent does not generate unique IDs. ID octopus_intelligent_target_time already exists - ignoring select.octopus_target_ready_by_time
2023-07-11 18:32:04.792 ERROR (MainThread) [homeassistant.components.sensor] Platform octopus_intelligent does not generate unique IDs. ID octopus_intelligent_next_offpeak_start already exists - ignoring sensor.octopus_intelligent_next_offpeak_start
2023-07-11 18:32:04.792 ERROR (MainThread) [homeassistant.components.sensor] Platform octopus_intelligent does not generate unique IDs. ID octopus_intelligent_offpeak_end already exists - ignoring sensor.octopus_intelligent_offpeak_end
2023-07-11 18:32:05.625 DEBUG (MainThread) [custom_components.octopus_intelligent.octopus_intelligent_system] Finished fetching Octopus Intelligent data in 0.832 seconds (success: True)
2023-07-11 18:32:05.625 ERROR (MainThread) [homeassistant.components.switch] Platform octopus_intelligent does not generate unique IDs. ID octopus_intelligent_bump_charge already exists - ignoring switch.octopus_bump_charge
I renamed the original integration but that made no difference. Is there a way to add a second account?
Thanks!
I utilise the planned dispatch slot to trigger automations and stop my house batteries from draining. Recently, I've noticed that the slot is never turning on, instead it goes from off to unknown and then unknown to off. This means that my battery automations aren't correctly firing and updating the discharge settings. I can't use the 'any state' option either because unknown doesn't necessarily mean it's in a dispatch slot. The only time any state is useful is when turning off the automation, however this then fires at random times in the day when the service becomes unavailable. You can see the last few days examples in the screenshot. The car was charging between 23:00 - 07:30 with a few 30 slots of stopping.
Hey James,
Is there a way for you to get the charging times that octopus set for the car and have it setup as a binary_sensor?
Reason being, this would allow me to set my Zappi charger to allow fast charging during those time slots rather than just a blanket 11:30pm - 5:30am?
Not a big deal if not as having this integration is 100x better than without it, huge appreciation for you creating it.
Logger: homeassistant.setup
Source: setup.py:192
First occurred: 14:42:53 (3 occurrences)
Last logged: 14:42:55
Setup failed for custom integration octopus_intelligent: Unable to import component: cannot import name 'Client' from 'gql' (/usr/local/lib/python3.10/site-packages/gql/init.py)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.