Dimming lights due to weather conditions

Hello everyone,
Im trying to figure out how to solve a automation with attention to control lights at daytime due to weather conditions.
my criteria is:

  • tracking device must be “home”
  • use sunrise as i only need this automation on daytime. (another automation trigger when sunset).
  • and, of course, use weather condition as a trigger/condition.

i have tried a mixes with a test automation-setup with out any luck so far. it seems that it goes on even when im “not_home” and after daytime…

  • Do I need to implement “tracking device” since I have a another automation for turn off all lights when leaving home and on when i get home?

  • Also, i want to have more than “cloudy” in weather trigger. how do solve that ?

take a look at config for this automation:

  alias: test
  description: ''
  trigger:
  - entity_id: weather.hjemme
    platform: state
    to: cloudy
  condition:
  - condition: and
    conditions:
    - after: sunrise
      before: sunset
      condition: sun
    - condition: state
      entity_id: device_tracker.mm
      state: home
  action:
  - entity_id: light.dimmable_light_1
    service: light.turn_on

Hello, remove “-” in front of “condition: and”… For more triggers just add more “triggers”… “triggers” are considered using the OR condition (see example below, it will trigger if it is cloudy OR sunny) but you can mix anytype of triggers/platform (state, template,…), the automation will be triggered if one of the triggers is met and if the conditions are satisfied… Not sure about the implementation of “tracking device”… Could you clarify ?

  alias: test
  description: ''
  trigger:
    - entity_id: weather.hjemme
      platform: state
      to: cloudy
    - entity_id: weather.hjemme
      platform: state
      to: sunny
  condition:
    condition: and
    conditions:
    - after: sunrise
      before: sunset
      condition: sun
    - condition: state
      entity_id: device_tracker.mm
      state: home
  action:
    - entity_id: light.dimmable_light_1
      service: light.turn_on

Hello, browetd.

The meaning with tracking device, basically i track my cellphone when i leaving or coming home to turn on/off lights. I use Nmap for this and setup tracking device mm for IP on my local network.
I got a another automation that is turning off all lights when i leave

I have played around a bit earlier today with the automation, and came with a setup like this.

  alias: Lys værforhold dagtid dim opp
  description: ''
  trigger:
  - entity_id: weather.hjemme
    platform: state
    to: cloudy
  - entity_id: weather.hjemme
    platform: state
    to: rainy
  - entity_id: weather.hjemme
    platform: state
    to: partlycloudy
  - entity_id: weather.hjemme
    platform: state
    to: snowy
  condition:
    condition: and
    conditions:
    - after: sunrise
      after_offset: -00:30:00
      before: sunset
      condition: sun
    - condition: state
      entity_id: device_tracker.mm
      state: home
  action: .... 

and this for sunny days…

  alias: Lys værforhold dagtid dim ned
  description: ''
  trigger:
  - entity_id: weather.hjemme
    platform: state
    to: sunny
  condition:
    condition: and
    conditions:
    - after: sunrise
      after_offset: -00:30:00
      before: sunset
      condition: sun
    - condition: state
      entity_id: device_tracker.mm
      state: home
1 Like