cancel
Showing results for 
Search instead for 
Did you mean: 

Google Home WebApp script editor - Sunset with NEGATIVE offset

Tom-H
Community Member

Dear all,

I am new to the community and would like to raise a question regarding Google-Home's new script editor.

I would like to light some lamps 15 minutes BEFORE sunset. I use a starter like this:

- type: time.schedule
      # Required. Time to schedule automation. Accepts either clock time (10:00:00 AM, with seconds optional, or in a 24 hour format), or 'sunrise' or 'sunset', with an optional offset ('sunrise+10m', for instance)
      at: sunset-15min # Adjust offset as needed. Supported units: sec, min, hour
      # Optional. Days of the week to run automation on.

In a first trial, this did NOT work at all (although I have to admit, that I have some more conditions, that might interfere and are responsible for not switching).

Just as a general question to the specialists: Can a NEGATIVE offset work for starters like sunset or sunrise.

Thanks for your support and any feedback!

Regards, Tom

1 Recommended Answer

Tom-H
Community Member

Good point, DWB1973! I will try this and give feedback.

Thanks, so far for your valuable input!

Edit:

A code like this works:

at: sunset-15min

You can even extend this to more than 400 Minutes. For testing reasons, I used

at: sunset-405min

which leads to a switching, as desired.

BTW: I had a condition, that was not working. Need to figure out, why

device.state.online

is not read for my PHL television - but that is not part of this thread, I think...

View Recommended Answer in original post

3 REPLIES 3

DWB1973
Community Member

I can see that they have provided two different examples for setting TimeScheduleEvent offsets in minutes - "m" and "min".

  1. ('sunrise+10m', for instance)
  2. Supported units: sec, min, hour (sunset+30min / sunset-1hour)

Assuming there aren't validation errors with the rest of your script, does sunset-15m also fail?

Tom-H
Community Member

Good point, DWB1973! I will try this and give feedback.

Thanks, so far for your valuable input!

Edit:

A code like this works:

at: sunset-15min

You can even extend this to more than 400 Minutes. For testing reasons, I used

at: sunset-405min

which leads to a switching, as desired.

BTW: I had a condition, that was not working. Need to figure out, why

device.state.online

is not read for my PHL television - but that is not part of this thread, I think...

Dennichio
Community Member