danielo515
(Daniel RodrĂguez Rivero)
October 4, 2021, 5:48pm
1
this automation seems to have all the required fields:
- id: '1633285214111'
alias: my kitchen motion
description: Kitchen motion done right
trigger:
- platform: state
entity_id: group.kitchen_motion
to: 'on'
- platform: numeric_state
entity_id: sensor.shelly_motion_luminosity
below: 40
condition:
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.shelly_motion_luminosity
below: 40
- condition: state
entity_id: group.kitchen_motion
state: 'on'
action:
- service: light.turn_on
target: group.kitchen_lights
- wait_for_trigger:
- platform: state
entity_id: group.kitchen_motion
from: 'on'
to: 'off'
- service: light.turn_off
target: group.kitchen_lights
I am constantly getting this error:
Invalid config for [automation]: expected a dictionary for dictionary value @ data['action'][0]['target']. Got None. (See ?, line ?).
I don’t know what it means. As far as I know, action[0].target has a value, so I can’t figure what it’s wrong with it.
Tinkerer
(aka DubhAd on GitHub)
October 4, 2021, 5:52pm
2
You should only use light.turn_
services on light
entities. Either use a light group for your lights, which creates a light
entity, or use homeassistant.turn_
service.
I’d also double check that group.kitchen_lights
actually exists…
GlennHA
(Glenn)
October 4, 2021, 5:52pm
3
Remove the illumination trigger since the motion is the real trigger here.
Remove the motion from you condition since light below is you only condition.
danielo515
(Daniel RodrĂguez Rivero)
October 4, 2021, 5:53pm
4
I just realised I have to provide an entity id to the target, it is not enough to just put the value there:
- service: light.turn_on
target:
entity_id: group.kitchen_lights
danielo515
(Daniel RodrĂguez Rivero)
October 4, 2021, 5:54pm
5
If I do that then it will not properly pick the lux updates, that are coming from the same motion sensor. HA is (shamesly) failing at getting both states updated at the same time, therefore many times the automation checks a stale value
danielo515
(Daniel RodrĂguez Rivero)
October 4, 2021, 5:55pm
6
What are the advantages of that? It looks totally redundant to normal groups, and I don’t see any benefit for it
francisp
(Francis)
October 4, 2021, 6:07pm
7
Groups for light only allow turn on/off. With light groups you can set all attributes that exist for a normal light.
1 Like
danielo515
(Daniel RodrĂguez Rivero)
October 4, 2021, 6:07pm
8
Just to put the final working solution (maybe can be improved, but this works) here it is:
- id: '1633285214111'
alias: Manual kitchen motion
description: Kitchen motion done right
trigger:
- platform: state
entity_id: group.kitchen_motion
to: 'on'
- platform: numeric_state
entity_id: sensor.shelly_motion_luminosity
below: '40'
condition:
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.shelly_motion_luminosity
below: '40'
- condition: state
entity_id: group.kitchen_motion
state: 'on'
action:
- service: homeassistant.turn_on
target:
entity_id: group.kitchen_lights
- wait_for_trigger:
- platform: state
entity_id: group.kitchen_motion
from: 'on'
to: 'off'
- service: homeassistant.turn_off
target:
entity_id: group.kitchen_lights
mode: restart
danielo515
(Daniel RodrĂguez Rivero)
October 4, 2021, 6:08pm
9
Can I put the different groups into a package all together rather than scattered all over the place?