Octopus Energy - Intelligent Tariff

Same here, Octopus app slow but working.

All working again now.

I’ve new to HA but slowly muddling my way through.

First off Thank you @duncansmart for this code. It works prefectly.

One question, how would I update this code to use in a send notification automation? As my Octopus app doesn’t send me a notification with times anymore.

Thanks in advance

Hi @rpc, funny you should ask that as I created this the other day:

alias: Notify Octopus Slots
trigger:
  - platform: state
    entity_id:
      - binary_sensor.octopus_intelligent_slot
    attribute: plannedDispatches
action:
  - service: notify.pushover
    data:
      title: Octopus Intelligent Slots
      message: >-
        {% if state_attr('binary_sensor.octopus_intelligent_slot', 'plannedDispatches') | length > 0 %} 
          {% for dispatch in state_attr('binary_sensor.octopus_intelligent_slot', 'plannedDispatches') -%} 
            ⏰ {{ (dispatch.startDtUtc | as_datetime | as_local).strftime('%H:%M') }} 
            to {{ (dispatch.endDtUtc | as_datetime | as_local).strftime('%H:%M') }} 
          {%- endfor %} 
        {%- else -%} 
          ⏰ None
        {%- endif  %}
mode: single

I use Pushover to send the notification, but you could use the same message template to send a notification with the Home Assistant notification service (if you use the HA phone app). Something like this:

alias: Notify Octopus Slots
trigger:
  - platform: state
    entity_id:
      - binary_sensor.octopus_intelligent_slot
    attribute: plannedDispatches
action:
  - device_id: your-mobile-device-id-here
    domain: mobile_app
    type: notify
      title: Octopus Intelligent Slots
      message: >-
        {% if state_attr('binary_sensor.octopus_intelligent_slot', 'plannedDispatches') | length > 0 %} 
          {% for dispatch in state_attr('binary_sensor.octopus_intelligent_slot', 'plannedDispatches') -%} 
            ⏰ {{ (dispatch.startDtUtc | as_datetime | as_local).strftime('%H:%M') }} 
            to {{ (dispatch.endDtUtc | as_datetime | as_local).strftime('%H:%M') }} 
          {%- endfor %} 
        {%- else -%} 
          ⏰ None
        {%- endif  %}
mode: single
1 Like

Thank you @duncansmart I more a less this automation but didn’t have
attribute: plannedDispatches set within it and I think that is why it wasn’t triggering. I will see how this gets now next time I plug in.

Thank you again.

Hi,

Is anyone else getting an error on the slots?

AttributeError: 'OctopusIntelligentSlot' object has no attribute '_is_on'

Yes, it seems some of the sensors are no longer available? :pensive:

I’ve a good few automations that used the flag so missing them :-(. I can work around with the ones that still show.

Is this a change to the API Octopus are running, or an upgrade within Home Assistant that has knocked it out?

It’s been raised, looks like it’s a programming issue and the upgrade to a newer version of Python.

Fixed in 1.6.2

Thanks for flagging!

3 Likes

You are a star, thank you!!!

@joelblogs I went onto IO today and have added the IO integration (@megakid thank you for the hard work) however when I add the automation I get ‘0p/kWh’ in the notification. I believe it is due to this above sensor and not having it. Any pointers as to what the sensor is/how it was created? And what should be used instead?

Hi all. Shoutout to @megakid for this great software.
I admit it, I use node-red for everything, I tried HA but I prefer the pain which node-red provides in spades.
I’ve nicked ideas from this code and cobbled a working solution together in node-red. My plan is to switch my zappi into Eco+ mode outside the charging windows, to allow Solar based charging, and to avoid the few minutes of charging whenever you plug in.
Will I get shot by Octopus for this?
Do they remove the tariff if you are seen to be controlling things?

Has anyone had a problem with the initial set up? Entering the API key and account ID just results in the setup wizard restarting with empty fields?

Edit: Just to update, this is the error on the most recent version of HA. Also logged on Github

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()

Thanks for the template for the planned slots.

I saw a couple comments about no multi-line support and note your use of the clock emoji.

Unsure if this is a recent thing, but I’ve added your template as a markdown card within a vertical stack and do get the multi line for the planned slots. Might be useful for others, I also added “{{”\n"}}" having read that this is a new line notation.

I’ve also added the amount of charge expected in each slot (for my own curiosity).

4 Likes

I found that Octopus wouldn’t get my charging schedule if the Zappi was set to anything other than the “dumb” Fast mode.
I put a toggle to switch “solar charging” and then an automation to turn off Octopus Smart Charging, set the mode of the Zappi and then to toggle disable / enable scheduled charging on my Tesla.
With setting the scheduled charging on my car Octopus goes and gets the charging schedule without drawing any power from the Zappi and only starts charging after the scheduled charging time – I’d assume something like this is also available for non teslas.
Octopus won’t be mad as it’s “Smart Charging” is disabled before the Zappi mode is changed.
I’m still relatively new to all this and this is my first comment so others may have a much more eloquent solution.

guys, sorry if anyone has already mentioned this, but I have this question:

My setup is following (equipment wise):

  • Growatt Inverter
  • PodPoint home charger
  • Tesla vehicle
  • IO

Can anyone guide me toward the right direction how to create an automation (or maybe even have done themselves) that:

IF → IO slots allocated
THEN → set Growatt to “Battery first” setting for that slot.

THEN

IF → IO slots expired
THEN → Revert Growatt to “Load First”

Sorry for necroposting this thread @Dave888, what integration are you using to control the PW, I moved from the Tesla Energy Plan yesterday to Intelligent Octopus and would like to tinker with the PW, cheers Neil

`

{% if state_attr('binary_sensor.octopus_intelligent_slot', 'plannedDispatches') | length > 0 %}
{% for dispatch in state_attr('binary_sensor.octopus_intelligent_slot', 'plannedDispatches') -%}
⏰ {{ (dispatch.startDtUtc | as_datetime | as_local).strftime('%H:%M') }} to {{ (dispatch.endDtUtc | as_datetime | as_local).strftime('%H:%M') }}
{{ "\n" }}
{%- endfor %}
{%- else -%}
⏰ None
{%- endif %}

1 Like

do you mean you get cheap tariff outside of the 2330-530 for the house consumption even if the car doesnt charge?