I’m staring at my code for quiet some time now, but I can’t find the error.
I want to receive a notification when my washing machine has started and when finished. This is triggered by a Tasmota power sensor via MQTT.
To prevent false notifications I build in a state for the washing machine which I am using as a condition is both automations.
Since I build in the conditions for the washing machine state I get the following error:
Invalid config for [automation]: expected a dictionary @ data['condition'][0]. Got None extra keys not allowed @ data['conditions']. Got None. (See /config/configuration.yaml, line 13)
I got this code for my washing machine:
automation:
- alias: Wasmachine aan
trigger:
- above: '100'
entity_id: sensor.wasmachine_power
platform: numeric_state
condition:
- condition: state
entity_id: sensor.wasmachine_state
state: 'off'
action:
- service: mqtt.publish
data:
topic: home-assistant/wasmachine/state
payload: on
- data:
message: De wasmachine is gestart
title: Wasmachine
service: notify.pushbullet
- alias: Wasmachine klaar
trigger:
- below: '2'
entity_id: sensor.wasmachine_power
platform: numeric_state
condition: and
conditions:
- condition: state
entity_id: sensor.wasmachine_state
state: 'on'
- above: '5'
condition: numeric_state
entity_id: sensor.time_online
action:
- service: mqtt.publish
data:
topic: home-assistant/wasmachine/state
payload: off
- data:
message: De wasmachine is klaar
title: Wasmachine
service: notify.pushbullet
As I say to my kids. Less talking and more listening and reading will serve you far better in the long run and then maybe you’ll understand what you’re talking about.
Thanks, I didn’t know about the input boolean. I now see that’s an easier way to solve this one.
I just come from domoticz where I got used to lovely chains
Yes as I said in the pm to the OP, the bit about input booleans was incidental.
It was more about the nature of syntax for the ‘and’ conditions I was aiming at.
I realise now that it would have been confusing (my ‘and’ conditions) to anyone only familiar with output from the AE
Summary : I endorse finity’s statement (unless you are going to use these booleans in multiple locations and it’s iffy even then)
I know Mutt was aiming at the conditions. I had this because of some copy/pasting and first I want the code to work. Later I will clean up.
The input booleans seem to be easier than the mqtt thing for me.
You mean the input booleans are making it complicated? I indeed don’t use them anywhere else. How can I make it easier then?
Yes, because you will still have to program something to turn the boolean on/off. That’s still going to need to be the MQTT topic information. So in effect you are just moving the MQTT interaction up one more level to a boolean. So it’s more complicated.
I don’t see how you can.
you already have a working automation so you had to have figured out MQTT at least a bit to get there.