# Live Octopus Cosy price

**URL:** <https://community.openenergymonitor.org/t/live-octopus-cosy-price/25217>\
**Category:** Emoncms\
**Tags:** octopus\
**Created:** [27 December 2023 14:35 UTC](https://community.openenergymonitor.org/t/live-octopus-cosy-price/25217 "2023-12-27T14:35:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![thedawnbefore](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/thedawnbefore/32/18445_2.png) [@thedawnbefore](https://community.openenergymonitor.org/u/thedawnbefore)\
**Post date:** [27 December 2023 14:35 UTC](https://community.openenergymonitor.org/t/live-octopus-cosy-price/25217/1 "2023-12-27T14:35:31Z")

</div>

Hi all,

I’m trying to get a live Octopus Cosy rate into emoncms using the octopus api, nodered and lots of nice examples from this community.

For anybody not familiar, this is not a fully agile tariff, but one that changes several times throughout the day for the benefit of heat pump owners (see image below).

However whatever i do i’m only able to return the offpeak rate (16.9p) vs. the current rate for that time of day. Am i doing something wrong here or is this a limitation in the API? I had expected it to behave in the same way as the Agile tarrif and replicate data available from [energy-stats.uk](http://energy-stats.uk) below, but perhaps i’m mistaken…

Pasting a debug screen from Node Red below, is this where one would expect to see the live price?

Many thanks indeed

 ![image](https://community.openenergymonitor.org/uploads/default/original/3X/5/2/52bbeea03b674dcfe415066e61f81bab2bd9c03d.png)

 ![image](https://community.openenergymonitor.org/uploads/default/original/3X/9/4/940bca02fc34f98ede5d972a4f7b9ceb7b9eafb6.png)

 ![image](https://community.openenergymonitor.org/uploads/default/original/3X/5/8/58faefb97ebc4a416b35d12b1d4e234e23da2e02.png)

---

<div class="post-metadata">

**Author:** ![Timbones](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/timbones/32/20308_2.png) [@Timbones](https://community.openenergymonitor.org/u/Timbones)\
**Post date:** [27 December 2023 15:07 UTC](https://community.openenergymonitor.org/t/live-octopus-cosy-price/25217/2 "2023-12-27T15:07:42Z")

</div>

Which endpoint are you querying? It looks like the one for tariff info.

You’ll want to be query the Agile unit rates, but for a Cosy tariff to get the price for every half-hour:

```bash
BASE_URL="https://api.octopus.energy"
PRODUCT_CODE="COSY-22-12-08"
TARIFF_CODE="E-1R-$PRODUCT_CODE-J"
TARIFF_URL="$BASE_URL/v1/products/$PRODUCT_CODE/electricity-tariffs/$TARIFF_CODE/standard-unit-rates/"

```

- [Octopus Energy APIs — Octopus Energy API 1.0 documentation](https://developer.octopus.energy/docs/api/#agile-octopus)

---

<div class="post-metadata">

**Author:** ![thedawnbefore](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/thedawnbefore/32/18445_2.png) [@thedawnbefore](https://community.openenergymonitor.org/u/thedawnbefore)\
**Post date:** [28 December 2023 08:31 UTC](https://community.openenergymonitor.org/t/live-octopus-cosy-price/25217/3 "2023-12-28T08:31:12Z")

</div>

Thanks very much, i was obviously using the wrong approach previously as i was simply calling the tariff details rather than agile unit rates as you suggest. Are you calling Agile rates yourself, @Timbones? Very interested in how you’re achieving this if so e.g. nodered etc.

---

<div class="post-metadata">

**Author:** ![Timbones](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/timbones/32/20308_2.png) [@Timbones](https://community.openenergymonitor.org/u/Timbones)\
**Post date:** [28 December 2023 10:24 UTC](https://community.openenergymonitor.org/t/live-octopus-cosy-price/25217/4 "2023-12-28T10:24:25Z")

</div>

I’ve written a script to import the data into my own instance.

I don’t know how to do it with NodeRed. @borpin might.

---

<div class="post-metadata">

**Author:** ![thedawnbefore](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/thedawnbefore/32/18445_2.png) [@thedawnbefore](https://community.openenergymonitor.org/u/thedawnbefore)\
**Post date:** [28 December 2023 12:43 UTC](https://community.openenergymonitor.org/t/live-octopus-cosy-price/25217/5 "2023-12-28T12:43:45Z")

</div>

thanks again, this was a great help - the new URL you provided is now getting me rates over time. my next task will be to twiddle with NR to get this down to a current rate from the wealth of info it retrieves.

---

<div class="post-metadata">

**Author:** ![thedawnbefore](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/thedawnbefore/32/18445_2.png) [@thedawnbefore](https://community.openenergymonitor.org/u/thedawnbefore)\
**Post date:** [29 December 2023 10:40 UTC](https://community.openenergymonitor.org/t/live-octopus-cosy-price/25217/6 "2023-12-29T10:40:36Z")

</div>

I just discovered @borpin 's very nice existing [Node contribution](https://github.com/borpin/node-red-contrib-octopus) which works a treat. Now to see whether it’s possible to modify it’s Product Code to Cosy. I will ask on the related thread.

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [29 December 2023 12:50 UTC](https://community.openenergymonitor.org/t/live-octopus-cosy-price/25217/7 "2023-12-29T12:50:38Z")

</div>

> [@thedawnbefore](#):
>
> which works a treat

Just a warning, the tariff is hardcoded so is the original rate currently. Need to remember how to do the front end and provide the ability to select the rate required!

Do you use HA? If so the Octopus Component is very good.
