#Code

1 messages · Page 1 of 1 (latest)

sick glacier
#
alias: Porch Lights
description: ""
trigger:
  - platform: sun
    event: sunrise
    offset: 0
  - platform: sun
    event: sunset
    offset: 0
condition: []
action:
  - choose:
      - conditions: "{{ trigger.event == 'sunrise' }}"
        sequence:
          - service: light.turn_off
            target:
              entity_id:
                - light.front_porch
                - light.back_porch
            data: {}
      - conditions: "{{ trigger.event == 'sunset' }}"
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 100
            target:
              entity_id:
                - light.front_porch
                - light.back_porch
mode: single
tame raft
#
alias: Porch Light Controls - Sun Triggers
description: ""
trigger:
  - platform: sun
    event: sunset
    offset: 0
    id: sunset
  - platform: sun
    event: sunrise
    offset: 0
    id: sunrise
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: sunset
        sequence:
          - service: light.turn_on
            data: {}
            target:
              entity_id:
                - light.back_porch_status
                - light.front_porch_status
      - conditions:
          - condition: trigger
            id: sunrise
        sequence:
          - service: light.turn_off
            data: {}
            target:
              entity_id:
                - light.back_porch_status
                - light.front_porch_status
mode: single
#

This is my automation for the same thing, and haven't had an issue yet..

sick glacier
#

i've since refactored everything and that automation now lives on the devices themselves through esphome

#

here's that code

tame raft
#

Yeah, I wouldn't use ESPHome (or WiFi) lights.. wouldn't want all that crap cluttering my WiFi network.

sick glacier
#

my wireless access point is rated for a hell of a lot more clients than i have including lights and other wifi iot devices

#

plus i'm planning on adding another access point to the other side of the house rated for just as many

#

and with esphome, the network traffic is minimal

tame raft
#

Yeah I get that. I have all Unifi hardware here, with Enterprise Access Points.. broken down into multiple segregated vlans.. but still wouldn't put any unnecessary crap on it

sick glacier
#

i mean i wouldn't describe lighting and other smart home utility as unnecessary

#

that's not to say it's necessary either but it's useful

tame raft
#

except I didn't describe them as such 😉

sick glacier
#

and my network performance, also on unifi, hasn't suffered any with 25-30ish shelly wifi products

tame raft
#

Running them via WiFi is unnecessary when there is are much better alternative.

sick glacier
#

there are better alternatives sure, but why would i need something better when what i have now works perfectly

tame raft
#

No one is suggesting an alternative to you

sick glacier
#

i'm just stating my case, same as you lol

tame raft
#

"I wouldn't use ESPHome (or WiFi) lights." believe that statement says I wouldn't

#

not "you shouldn't"

#

I was just correcting your Automation coding

sick glacier
#

oh the automation i posted works fine now that there isn't another one messing with it

tame raft
#

the Choose action acts like a if/then ... it the first one is true it doesn't execute the 2nd

#

So to avoid this using a Trigger ID

#

based on the Triggers given in the automation

#

to trigger the Choose Option

sick glacier
#

yeah i know