Automation - Sunset with Device Tracker

I ended up splitting up the code to get this to work. I am not sure if the first automation will work because to get the “Turn on living room lamp at arrival” to work, I had to remove the offsets. So I will have to figure that out.

For now:

###################################################
#                                                 #
#         TURN ON LIVING ROOM LAMP AT SUNSET      #
#                                                 #
###################################################
- alias: Living Room Lamp - Sunset
  trigger:
    - platform: sun
      event: sunset
      offset: "-00:45:00"
  condition:
    - condition: state
      entity_id: group.family_devices
      state: 'home'
  action:
    service: homeassistant.turn_on
    entity_id: switch.plugin_1

###################################################
#                                                 #
#        TURN ON LIVING ROOM LAMP AT ARRIVAL      #
#                                                 #
###################################################
- alias: Living Room Lamp - Arrive Home
  trigger:
    - platform: state
      entity_id: group.family_devices
      to: 'home'
  condition:
    condition: or
    conditions:
    - condition: sun
      after: sunset
    - condition: sun
      before: sunrise
  action:
    service: homeassistant.turn_on
    entity_id: switch.plugin_1