How to use GMT in an automation?

The GMT bit is one part of the puzzle.

The scenario is this: every October to April, my clocks move forwards 1 hour for summer time. This includes clocks in the computers. Also, my electricity charges are based on the time of day - Time Of Use - TOU, with peak, shoulder and off peak costs.

However, the electricity company doesn’t change their times to match summer time.

So, off peak starts at 10pm normally, but at 11pm during summer.

Naturally, I’d like have as much electricity drawn during the cheapest times.

The question is: how do I set up an automation to start at those different times?

I have a couple of possibilities, and wonder what you guys think?

1/ Just make the automation start at 11pm, summer or standard time.
This is simple, but loses one hour of cheaper electricity.

2/ Set up automations in October to enable a summer time automation and disable the standard automation, and do the opposite in April.
This takes advantage of the extra hour, but is more complex, potentially requiring 3 extra automations: 1 to disable and enable, and 2 others to call the actual automation at different times.

Another possibility is to use GMT, which doesn’t change with summer time.
But how do you access it in a trigger?

Any thoughts?

Thanks in advance!

GMT is the same as UTC, and see here:

as far as I know, triggers set on time will be for the local timezone
if you wanted it based on UTC only (so don’t apply daylight saving) I would suggest a trigger on both times (daylight and not) and a condition that check the hour is correct. See below example set for 22 UTC (23 BST if you’re in the UK / GMT +1)

{{as_timestamp(now()) | timestamp_custom("%H", false) | int  == 22}}

false here is the keyword to not use local time

[EDIT]
Don’t do that, set a template trigger with the above template:

automation:
  trigger:
    platform: template
    value_template: "{{as_timestamp(now()) | timestamp_custom('%H', false) | int  == 22}}"

Thanks guys!

I am in a +10 hour timezone, so the following will trigger at (local) 9 am standard, 10am summer time:

{{as_timestamp(now()) | timestamp_custom(‘%H’, false) | int == 23}}

It would be nice to have be able to say 9 am somewhere, but I guess that’s what documentation is for!
:smirk:

Thanks again!

Well you have two clocks available (providing you did the full integration)

{{ states('sensor.time_utc') }}
{{ states('sensor.time') }}

the first gives utc and the second local time
Do your offsets from the utc to ignore dst

Alternatively you could use Taras’s DST binary sensor and do (or not do) a local offset based on it

binary_sensor:
  - platform: template
    sensors:
      is_dst:
        entity_id: sensor.date
        value_template: "{{ now().timetuple().tm_isdst > 0 }}"