Dear,
I’m doing an automation for triggering tank1000’s pump in situations:
When the Tank3000 runs out of water and the
“sensor up” on and
“sensor down” on
and
Tank1000 is with
action
Turn on the “tank1000 relay” to refill the tank.
case
tank1000 is with the “sensor down” on
action
turns off the “tank1000 relay”.
follows code:
alias: "Tank water pump - on"
id: tank001
trigger:
- platform: mqtt
topic: 'stat / tank3000 / POWER2'
payload: 'ON'
condition:
condition: and
conditions:
- condition: state
entity_id: switch.tank3000_sensor_up
state: 'ON'
- condition: state
entity_id: switch.tank1000_sensor_down
state: 'OFF'
action:
service: switch.turn_on
entity_id: switch.tank1000_relay
configuration of tanks:
tank1000
Toggle1 = relay
Toggle2 = sensor up
Toggle3 = sensor down
Sensors:
toggle2 e toggle3
off = tank with water
on = tank without water
tank3000
Toggle1 = sensor up
Toggle2 = sensor down
Sensors:
toggle1 e toggle2
off = tank with water
on = tank without water
lolouk44
(lolouk44)
June 6, 2018, 2:12pm
2
What exactly is your question? I’m not sure what it is that you’re after…
My automation is not working.
I wonder what’s wrong!
Thank you
keithh666
(Keith Hull)
June 6, 2018, 10:00pm
4
I don’t think you can have spaces in your topic.
Thank you,
was check in the code and does not have this space, it was a small typo.Thank you,
was check in the code and does not have this space, it was a small typo.
‘stat/tank3000/POWER2’
keithh666
(Keith Hull)
June 6, 2018, 10:48pm
6
check inthe state table that your state and topic payload are actually “ON” and not “on” etc.
“ctrl +c” and “ctrl +v”
alias: "Tank water pump - on"
id: tank001
trigger:
- platform: mqtt
topic: 'stat/tank3000/POWER2'
payload: 'ON'
condition:
condition: and
conditions:
- condition: state
entity_id: switch.tank3000_sensor_up
state: 'ON'
- condition: state
entity_id: switch.tank1000_sensor_down
state: 'OFF'
action:
service: switch.turn_on
entity_id: switch.tank1000_relay
keithh666
(Keith Hull)
June 6, 2018, 11:02pm
9
Are your sensors switches or sensors? and are the names correct as stated in the switches/sensors part of the state table?
Yes they are.
The sensors are reed switch.
All the names are declared correctly and I simulate the states.
keithh666
(Keith Hull)
June 7, 2018, 9:45am
13
- condition: state
entity_id: switch.tank3000_sensor_up
state: 'ON'
- condition: state
entity_id: switch.tank1000_sensor_down
state: 'OFF'
I suspect the reason it isn’t triggering is that the states need to be ‘on’ and ‘off’.
If you look in the states table, you will find the only things that are uppercase are any input_selects that you have defined as uppercase. At least that’s the case in mine
Keithh66,
I will describe my simulation scenario:
tank3000
###### Tank3000
- platform: mqtt
name: "tank3000 sensor up"
state_topic: "stat/tank3000/POWER1"
command_topic: "cmnd/tank3000/POWER1"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
- platform: mqtt
name: "tank3000 sensor down'"
state_topic: "stat/tank3000/POWER2"
command_topic: "cmnd/tank3000/POWER2"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
####################
tank1000
###### Tank1000
- platform: mqtt
name: "tank1000 relay"
state_topic: "stat/tank1000/POWER1"
command_topic: "cmnd/tank1000/POWER1"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
- platform: mqtt
name: "tank1000 sensor up"
state_topic: "stat/tank1000/POWER2"
command_topic: "cmnd/tank1000/POWER2"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
- platform: mqtt
name: "tank1000 sensor down"
state_topic: "stat/tank1000/POWER3"
command_topic: "cmnd/tank1000/POWER3"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
In this situation I would like automation to trigger relay tank1000:
In this situation I would like the automation to work!
As you can see, the relay was not activated.
What I would like automation to do would be:
but unfortunately it does not happen !:
here is the automation code:
alias: "Tank water pump - on"
id: tank001
trigger:
- platform: mqtt
topic: 'stat/tank3000/POWER2'
payload: 'ON'
condition:
condition: and
conditions:
- condition: state
entity_id: switch.tank3000_sensor_up
state: 'ON'
- condition: state
entity_id: switch.tank1000_sensor_down
state: 'OFF'
action:
service: switch.turn_on
data:
entity_id: switch.tank1000_relay
I found the error:
had a ’
in:
name: "tank3000 sensor down'"
for
name: "tank3000 sensor down"
Thank you for your help !!
keithh666
(Keith Hull)
June 7, 2018, 6:21pm
16
Glad you got it working , next time post all of the config not just what you think is not working