first I used the choose action, then the triggered by and after that (to specify it more) an “and if” condition. do you mean that? Sorry it’s hard for me to understand what the posted code (and information from yours) does look like in the editor
it’s very frustrating.
pretty cool, that feature could help me a lot. I will try it out.
Will I have to recreate all automations with motion sensors after installing that integration?
Well the point is, this is a replacement for the automations you already have.
You can see this as a digital device that handles the motion based lights for you (aka a state machine).
I installed the integration from HACS, rebooted and all zigbee devices are not available. I didn’t even “activated” the integration. What is that problem? is that related to that?
That can not be related if you didn’t changed your config file yet.
strange. I did nothing else
sh… now I have another construction site…
trying to load my last backup from tonight. hope that helps.
Any errors in your logs?
Which zigbee integration do you use?
I’m using the Sonoff 3.0 Dongle with Z2M integration. No errors, the lights, sensors, all zigbee things are away…suddenly. In Z2M I can see them, all are online and last seen xxx secs or xxx min ago and I’m able to switch the lights and so on. Only in HA there are all grey and not able to handle.
Is your MQTT broker running?
Keep it simple. The more dependencies and integrations you load, the more complex your system gets to maintain. Two simple automations:
- alias: Lights - hall light on
description: Turns the hall room light on when motion detected.
id: a722fffd-0a06-4ab9-86cf-b9428942bc6b
trigger:
- platform: state
entity_id: binary_sensor.motion_hallway_downstairs_occupancy
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: binary_sensor.lights_active
state: 'on'
action:
- if:
- condition: state
entity_id: binary_sensor.nightmode
state: 'on'
- then:
- service: light.turn_on
data:
kelvin: 2500
brightness_pct: 20
target:
entity_id: light.hallway_downstairs
- else:
- service: light.turn_on
data:
kelvin: 4000
brightness_pct: 100
target:
entity_id: light.hallway_downstairs
- alias: Lights - hall light off
description: Turns the hall room light off 45 seconds after last motion detected.
id: 2157e1b4-91eb-433d-bdc9-962440dafbdf
trigger:
- platform: state
entity_id: binary_sensor.motion_hallway_downstairs_occupancy
from: 'on'
to: 'off'
for:
seconds: 45
action:
- service: light.turn_off
entity_id: light.hallway_downstairs
yes it’s running. A few minutes ago as I wrote to you all, all things worked normally.
The only error I can see in the log of MQTT broker is:
2023-02-22 12:28:26: Client disconnected, not authorised.
2023-02-22 12:28:27: New connection from 172.30.33.7:53252 on port 1883.
Here. Your “And” has only one condition, so there is nothing for it to compare to.
This doesn’t mean “motion detected” and “nigthtmode off”, although it does technically work that way because of the default way multiple conditions work. The “and” applies to everything within its own code block. Im not sure if I’m explaining this well, but what you’re effectively doing is “motion detected” and [result of and conditions]
This would do the same:
- conditions:
- condition: trigger
id: motion detected
- condition: state
entity_id: binary_sensor.nightmode
state: "off"
If this was an “or” condition, it wouldn’t work the way I think you’d expect:
- conditions:
- condition: trigger
id: motion detected
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.nightmode
state: "off"
Here, you’d be doing “motion detected” and [result of or conditions]
ok now I understand, it’s not the best way for coding, right? but it works
Now I solved the issue, it was because I forgot the setup the new password for my users in HA after changing it yesterday. sorry.