Hi All,
I just moved house and thought I’d get infrastructure done first thing AND I’d bite the bullet and move to Lovelace. I got all the devices and entities populated, solved my DuckDNS issues and thought I was well on myway. My computer then complained about lack of disc space and so (stupidly) I deleted some images and config backups. ZAP all my best examples of how to do stuff disappeared ! >:- <<<<<
So, I thought I’d bite another bullet and move over to packages, a nice way of picking an aspect of home automation and keep ALL relevant items in the one spot/file (input_boolean, input_number, binary_sensor, automations, scripts) well apart from the lovelace config (still monolythic on that).
Anyway, my first task was Home Occupancy and that went pretty smoothly, so next task : - Patio light timer.
Generally we just want to switch the light on so the dog can go for a pee and then let it switch itself off. I’m happy to disable it for other uses.
So I wanted a boolean to say if I want the off timer and a number to say how long and then stick it together. It all looks fine but it just doesn’t work. The Check Config says it’s clean … but …
Please have a look and see what I’ve done wrong this time. (I definately had this working pre-lovelace, but now I’m only working from memory ; - ((( )
input_boolean:
ib_light_patio_link2kdoor:
name: Link To Door
initial: off
icon: mdi:door
ib_light_patio_timer_enable:
name: Timer Enable
initial: on
icon: mdi:timer
input_number:
in_light_patio_timer:
name: On Timer (mins)
initial: 2
min: 1
max: 300
step: 1
mode: box
icon: mdi:alarm
automation:
#name: Light Patio Off Delay - goto customise
- alias: au_light_patio_offdelay
trigger:
- platform: state
entity_id: light.fib_fgd212dim2_ptio_level
to: 'on'
condition:
- condition: state
entity_id: input_boolean.ib_light_patio_timer_enable
state: 'on'
- condition: state
entity_id: input_boolean.ib_light_patio_link2kdoor
state: 'off'
action:
- service: script.cancel
entity_id: script.sc_light_patio_timer
- service: script.sc_light_patio_timer
script:
sc_light_patio_timer:
alias: Light Patio Timer Script
sequence:
- delay: '00:{{state.input_number.in_light_patio_timer | int}}:00'
- service: light.turn_off
entity_id: light.fib_fgd212dim2_ptio_level
After this is working I’ll build on it (read: break it by fiddling with it - (if it works, it probably isn’t ‘feature rich’ enough yet) ) I’ll add the door switch to turn the light on and start the timer once the door closes, but only if the sun is below the horizon etc.
The UI bit to go with this looks like this : -
- type: entities
title: Patio Light
show_header_toggle: false
entities:
- entity: light.fib_fgd212dim2_ptio_level
- entity: input_boolean.ib_light_patio_link2kdoor
- entity: input_boolean.ib_light_patio_timer_enable
- entity: input_number.in_light_patio_timer
Thanks in advance, I know it’ll be something stuid