# Flow notification is always giving me the time in UTC

**URL:** <https://community.homey.app/t/flow-notification-is-always-giving-me-the-time-in-utc/153792>\
**Category:** Questions & Help\
**Created:** [April 14, 2026, 9:26pm UTC](https://community.homey.app/t/flow-notification-is-always-giving-me-the-time-in-utc/153792 "2026-04-14T21:26:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carl](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/carl/32/124386_2.png) [@Carl](https://community.homey.app/u/Carl)\
**Post date:** [April 14, 2026, 9:26pm UTC](https://community.homey.app/t/flow-notification-is-always-giving-me-the-time-in-utc/153792/1 "2026-04-14T21:26:53Z")

</div>

Any help would be appreciated as this is making my shit itch tonight.

I have made a script that tells me the cheap window each day for my immersion heater.

It outputs in UK 24hr but when I use a notification homey sends it in UTC 12hr.

I have re made the variable multiple times, moved my location around and rebooted homey. But it always outputs the notification in UTC and I can not seem to solve it. Anyone any idea how to change it.

Screenshot of the script output and homey notification attached

 ![Screenshot 2026-04-14 at 22.23.22](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/7/6718928ddb7117957058737f649a8eb6beb35bad.png)

 ![IMG_5003](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/f/0f8519561c3d8fac0633b346d2023ab29407372a.jpeg)

 ![Screenshot 2026-04-14 at 22.23.07](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/a/aaf8407c40ed259e3a10cf5a01c102b1be40feb2.png)

The variable is a text variable and this is the script I’m using

```auto
// ================== CONFIG ==================

const productCode = ‘AGILE-24-10-01’;

const tariffCode = ‘E-1R-AGILE-24-10-01-A’;

const lookAheadHours = 24;

const immersionPowerKW = 3.0;

let windowHours = 2;

const DEVICE_NAME = ‘Immersion Heater’;

// ================== UK TIME FORMAT ==================

function formatUK24(date) {

return new Intl.DateTimeFormat(‘en-GB’, {

timeZone: 'Europe/London',

hour: '2-digit',

minute: '2-digit',

hour12: false

}).format(new Date(date));

}

async function run() {

try {

// ================= LOAD SETTINGS =================

try {

const v = await Homey.variables.get(‘Immersion_Window_Hours’);

  windowHours = parseFloat(v) || windowHours;

} catch (e) {}

const now = new Date();

const nowTime = now.getTime();

const url =

`https://api.octopus.energy/v1/products/${productCode}/electricity-tariffs/${tariffCode}/standard-unit-rates/\` +

`?period_from=${now.toISOString()}&period_to=${new Date(now.getTime() + lookAheadHours * 3600 * 1000).toISOString()}`;

// ================= FETCH DATA =================

const response = await fetch(url);

if (!response.ok) throw new Error(`API Error: ${response.status}`);

const data = await response.json();

if (!data.results?.length) {

  log('⚠️ No tariff data returned');

return;

}

let rates = data.results

  .map(r => ({

from: new Date(r.valid_from),

    to: new Date(r.valid_to),

    price: Number(r.value_inc_vat)

  }))

  .sort((a, b) => a.from - b.from);

const slotsNeeded = Math.round(windowHours / 0.5);

let cheapestTotal = Infinity;

let bestIndex = 0;

for (let i = 0; i <= rates.length - slotsNeeded; i++) {

let sum = 0;

for (let j = 0; j < slotsNeeded; j++) {

    sum += rates\[i + j\].price;

  }

if (sum < cheapestTotal) {

    cheapestTotal = sum;

    bestIndex = i;

  }

}

const start = rates[bestIndex].from;

const end = rates[bestIndex + slotsNeeded - 1].to;

const startTime = start.getTime();

const endTime = end.getTime();

// ================= CALCULATIONS =================

const avgRate = cheapestTotal / slotsNeeded; // p/kWh

const energyKWh = immersionPowerKW * windowHours;

const costGBP = (energyKWh * avgRate) / 100;

const shouldBeOn = nowTime >= startTime && nowTime < endTime;

// ================= LOG OUTPUT =================

log(\`🔥 CHEAP WINDOW FOUND\`);

log(\`Start: ${formatUK24(start)}\`);

log(\`End: ${formatUK24(end)}\`);

log(\`Avg price: ${avgRate.toFixed(2)} p/kWh\`);

log(\`Energy: ${energyKWh.toFixed(2)} kWh\`);

log(\`Cost: £${costGBP.toFixed(2)}\`);

log(\`State: ${shouldBeOn ? 'ON' : 'OFF'}\`);

// ================= SAFE NOTIFICATION (NO TIME PATTERN) =================

const variables = await Homey.logic.getVariables();

const notifyVar = Object.values(variables)

  .find(v => v.name === 'Immersion_Notify');

if (notifyVar) {

const message =

`🔥 Immersion Window\n` +

`Start time ${formatUK24(start)}\n` +

`End time ${formatUK24(end)}\n` +

`Avg rate ${avgRate.toFixed(2)} p/kWh\n` +

`Energy ${energyKWh.toFixed(2)} kWh\n` +

`Cost £${costGBP.toFixed(2)}`;

await Homey.logic.updateVariable({

    id: notifyVar.id,

    variable: {

      value: String(message)

    }

  });

}

// ================= DEVICE CONTROL =================

const devices = await Homey.devices.getDevices();

const heater = Object.values(devices).find(d => d.name === DEVICE_NAME);

if (!heater) {

  log('❌ Immersion heater not found');

return;

}

const currentState = heater.capabilitiesObj.onoff.value;

if (shouldBeOn && !currentState) {

await heater.setCapabilityValue(‘onoff’, true);

  log('🔥 IMMERSION ON');

}

if (!shouldBeOn && currentState) {

await heater.setCapabilityValue(‘onoff’, false);

  log('❄️ IMMERSION OFF');

}

} catch (err) {

log(\`❌ Error: ${err.message}\`);

}

}

await run();

```

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [April 15, 2026, 2:01am UTC](https://community.homey.app/t/flow-notification-is-always-giving-me-the-time-in-utc/153792/2 "2026-04-15T02:01:55Z")

</div>

Do you check on readability of your posted code? It’s a pretty messy now:

> [@\[Tip\] Please use Preformatted Text for Logs and Code Blocks for cleaner posts](https://community.homey.app/t/tip-please-use-preformatted-text-for-logs-and-code-blocks-for-cleaner-posts/149488):
>
> To ensure our community can provide the best help, please use Preformatted Text for all technical content. Why Use Preformatted Text? When you paste logs, configuration files, or code snippets as plain text, Discourse often alters the formatting. This makes it difficult to read and can strip away crucial characters needed to diagnose your issue. If you didn’t create it yourself, like logs or JSONs (interviews) paste it as Preformatted Text! For smaller Code, Logs etc. in context of a topic, b…

---

<div class="post-metadata">

**Author:** ![Carl](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/carl/32/124386_2.png) [@Carl](https://community.homey.app/u/Carl)\
**Post date:** [April 15, 2026, 6:29am UTC](https://community.homey.app/t/flow-notification-is-always-giving-me-the-time-in-utc/153792/3 "2026-04-15T06:29:17Z")

</div>

I’ve sorted that, thought I’d clicked the icon to wrap it properly
