# Home Assistant - Octopus Energy Event

**URL:** https://discourse.nodered.org/t/home-assistant-octopus-energy-event/83347
**Category:** General
**Tags:** home-assistant
**Created:** [1 December 2023 13:02 UTC](https://discourse.nodered.org/t/home-assistant-octopus-energy-event/83347 "2023-12-01T13:02:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![leacho73](https://avatars.discourse-cdn.com/v4/letter/l/2bfe46/32.png) [@leacho73](https://discourse.nodered.org/u/leacho73)
#### Post date: [1 December 2023 13:02 UTC](https://discourse.nodered.org/t/home-assistant-octopus-energy-event/83347/1 "2023-12-01T13:02:58Z")

</div>

Hi All,

I'm looking to create a flow based on some event data which I get out of my Octopus Energy integration. Every so often, we get cheap electric for a period of time - and I see this information in home assistant - for example, we have one today:

> event.octopus\_energy\_octoplus\_saving\_session\_events

```auto
event_types: octopus_energy_all_octoplus_saving_sessions
event_type: octopus_energy_all_octoplus_saving_sessions
available_events: 
joined_events: 
- id: 1165
  start: '2023-11-29T17:00:00+00:00'
  end: '2023-11-29T18:30:00+00:00'
  rewarded_octopoints: null
- id: 1166
  start: '2023-12-01T16:30:00+00:00'
  end: '2023-12-01T18:00:00+00:00'
  rewarded_octopoints: null

```

If we have a 'saving session' on a given day - I want to charge my home battery up 4 hours before - so for example, I would want to start my charge at 12:30 today, as there is a saving session at 16:30 - but I'm struggling with a flow that can pick out the latest date and time out of that dynamic attribute list from the event entity.

I already have the charging flow working - I just need a node that can fire at the right time, dependent on the above - can anyone help with how I go about doing that? I imagine that I'd have to write a function to do this, as I can't see a built-in node to do it with.

Thanks  
Leacho

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [30 January 2024 13:03 UTC](https://discourse.nodered.org/t/home-assistant-octopus-energy-event/83347/2 "2024-01-30T13:03:16Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
