Octopus Energy - Intelligent Tariff

Thanks @Dave888 , interesting idea, it certainly helps.

I’m also interested in how you created your tariff sensor, do you mind sharing that?

Thanks.

Hi @paulo.frings

This is the sensor I use for the elec price:

      # Intelligent Elec Price
      - name: "Current Electricity Price"
        unique_id: current_electricity_price
        unit_of_measurement: '£/kWh'
        device_class: monetary
        state: >-
          {% set tariff = { "Peak": 0.3984015, "Offpeak": 0.075 } %}
          {% if is_state('binary_sensor.octopus_intelligent_slot', 'on') %}
            {{ tariff.Offpeak }}
          {% else %}
            {{ tariff.Peak }}
          {% endif %}

Many thanks @Dave888 .

Hi Andy,

What integration are you using to invoke the charging on the Lux inverter please?

Cheers, Mick

Hi @duncansmart thanks for this and for introducing me to custom: template-entity-row - super useful!

When I have multiple slots, I can’t get them to display on separate rows - did you experience this too?

There’s some talk of multiline support here, but nothing I could make work with my numpty templating skills :confused:

Hi

Looking at the script I think Andy is using @guybw private integration. I found it here Luxpower ac inverter integration? - #9 by guybw .

I am new to home assistant but I would recommend it.

Kind regards,

Arun

Sorry @martin.dell I couldn’t work it out either :man_shrugging: which is why I used the clock emoji to delimit the items!

1 Like

Hum… the integration stopped working for me just now. Here are 2 screenshots taken from the HA mobile app:



Also, when I tried to check the Octopus app on my phone, the Devices tab was empty. I wonder if the problem is at Octopus’ end.

Mine went ‘unavailable’ at 20.39 this evening, same error.

I am seeing the times in the Octopus App however, it is being slow but is loading my timeslots…

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!!!