Sunset coordinates specific to another location

Hi,
I have a strange question. I would like to control a light in another timezone/location, therefore, I was wondering if it is possible to set the longitude & latitude within an automation rather than at the HA global configuration.yaml level.

I have included some semi-pseudo code below to illustrate how I think it could work.

- alias: Turn on light 
  initial_state: true
  trigger:
  - entity_id: person.my_name
    from: not_home
    platform: state
    to: home
  condition:
  - condition: state
    entity_id: sun.sun
    state: below_horizon **( latitude: -31.452280, longitude: 134.654700 )**
  action:
  - data: {}
    entity_id: switch.outside_light
    service: switch.turn_on
  - entity_id: switch.garage_light
    service: switch.turn_on
  - entity_id: light.hue_white_lamp_1_2
    service: light.turn_off
  - delay: 00:05:00
  - entity_id: switch.outside_light
    service: switch.turn_off
  - entity_id: switch.garage_light
    service: switch.turn_off

you can’t add that kind of variable in that spot.

what i would do is create a sensor that finds the sunset/sunrise information for where you need to control the light then use that sensor value in your automation.

You can make a DarkSky sensor with the latitude/longitude you wish and it will report back the sunrise and sunset times for that locale.

2 Likes