Skip to content

Commit 0d79c85

Browse files
committed
feat: Updated underlying intelligent bump charge API due to deprecation warning (30 minutes dev time)
1 parent 0fa274e commit 0d79c85

File tree

5 files changed

+23
-29
lines changed

5 files changed

+23
-29
lines changed

.husky/prepare-commit-msg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
exec < /dev/tty && npx cz --hook || true
1+
# exec < /dev/tty && npx cz --hook || true

custom_components/octopus_energy/api_client/__init__.py

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -223,27 +223,21 @@
223223
}}'''
224224

225225
intelligent_turn_on_bump_charge_mutation = '''mutation {{
226-
triggerBoostCharge(
227-
input: {{
228-
accountNumber: "{account_id}"
229-
}}
230-
) {{
231-
krakenflexDevice {{
232-
krakenflexDeviceId
233-
}}
234-
}}
226+
updateBoostCharge(input: {{
227+
deviceId: "{device_id}"
228+
action: BOOST
229+
}}) {{
230+
id
231+
}}
235232
}}'''
236233

237234
intelligent_turn_off_bump_charge_mutation = '''mutation {{
238-
deleteBoostCharge(
239-
input: {{
240-
accountNumber: "{account_id}"
241-
}}
242-
) {{
243-
krakenflexDevice {{
244-
krakenflexDeviceId
245-
}}
246-
}}
235+
updateBoostCharge(input: {{
236+
deviceId: "{device_id}"
237+
action: CANCEL
238+
}}) {{
239+
id
240+
}}
247241
}}'''
248242

249243
intelligent_turn_on_smart_charge_mutation = '''mutation {{
@@ -1593,7 +1587,7 @@ async def async_update_intelligent_car_target_time(
15931587
raise TimeoutException()
15941588

15951589
async def async_turn_on_intelligent_bump_charge(
1596-
self, account_id: str,
1590+
self, device_id: str,
15971591
):
15981592
"""Turn on an intelligent bump charge"""
15991593
await self.async_refresh_token()
@@ -1603,7 +1597,7 @@ async def async_turn_on_intelligent_bump_charge(
16031597
client = self._create_client_session()
16041598
url = f'{self._base_url}/v1/graphql/'
16051599
payload = { "query": intelligent_turn_on_bump_charge_mutation.format(
1606-
account_id=account_id,
1600+
device_id=device_id,
16071601
) }
16081602

16091603
headers = { "Authorization": f"JWT {self._graphql_token}", integration_context_header: request_context }
@@ -1615,7 +1609,7 @@ async def async_turn_on_intelligent_bump_charge(
16151609
raise TimeoutException()
16161610

16171611
async def async_turn_off_intelligent_bump_charge(
1618-
self, account_id: str,
1612+
self, device_id: str,
16191613
):
16201614
"""Turn off an intelligent bump charge"""
16211615
await self.async_refresh_token()
@@ -1625,7 +1619,7 @@ async def async_turn_off_intelligent_bump_charge(
16251619
client = self._create_client_session()
16261620
url = f'{self._base_url}/v1/graphql/'
16271621
payload = { "query": intelligent_turn_off_bump_charge_mutation.format(
1628-
account_id=account_id,
1622+
device_id=device_id,
16291623
) }
16301624

16311625
headers = { "Authorization": f"JWT {self._graphql_token}", integration_context_header: request_context }

custom_components/octopus_energy/electricity/previous_accumulative_cost_override.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ async def async_update(self):
130130
self._standing_charge is None or
131131
self._rates[0]["start"] != period_from or
132132
self._rates[-1]["end"] != period_to or
133-
self._standing_charge[0]["start"] != period_from or
134-
self._standing_charge[-1]["end"] != period_to):
133+
self._standing_charge["start"] != period_from or
134+
self._standing_charge["end"] != period_to):
135135

136136
_LOGGER.debug(f"Retrieving rates and standing charge overrides for '{self._mpan}/{self._serial_number}' ({period_from} - {period_to})...")
137137
[rate_data, standing_charge] = await asyncio.gather(

custom_components/octopus_energy/gas/previous_accumulative_cost_override.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ async def async_update(self):
131131
self._standing_charge is None or
132132
self._rates[0]["start"] != period_from or
133133
self._rates[-1]["end"] != period_to or
134-
self._standing_charge[0]["start"] != period_from or
135-
self._standing_charge[-1]["end"] != period_to):
134+
self._standing_charge["start"] != period_from or
135+
self._standing_charge["end"] != period_to):
136136

137137
_LOGGER.debug(f"Retrieving rates and standing charge overrides for '{self._mprn}/{self._serial_number}' ({period_from} - {period_to})...")
138138
[rate_data, standing_charge] = await asyncio.gather(

custom_components/octopus_energy/intelligent/bump_charge.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async def async_turn_on(self):
8080
"""Turn on the switch."""
8181
try:
8282
await self._client.async_turn_on_intelligent_bump_charge(
83-
self._account_id
83+
self._device.id
8484
)
8585
except Exception as e:
8686
if self._is_mocked:
@@ -96,7 +96,7 @@ async def async_turn_off(self):
9696
"""Turn off the switch."""
9797
try:
9898
await self._client.async_turn_off_intelligent_bump_charge(
99-
self._account_id
99+
self._device.id
100100
)
101101
except Exception as e:
102102
if self._is_mocked:

0 commit comments

Comments
 (0)