Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 102472

Automation using two switches as input

$
0
0

@kayasaman wrote:

Hi,

I’ve been trying to figure this one out but hit a road block.

Basically I’d like to perform a logical AND operation on the state of two buttons, that when both are at logic 1 (on) will fire off a command.

What I’ve done so far is create two input boolean entities:

input_boolean:
  hdmi_matrix_out1:
    name: "HDMI Matrix Output 1"
    initial: off
  hdmi_matrix_in1:
    name: "HDMI Matrix Input 1"
    initial: off

Then a shell command running curl:

shell_command:
    matrix_out1_in1: "/usr/bin/curl -X POST http://<ip_address>/video.get -d '#video_d out1 matrix=1'"

in the configuration.yaml file.

In the automation.yaml file I created this entry:

  - alias: 'hdmi_matrix_out1_in1'  
    trigger:
      - platform: state
        entity_id: input_boolean.hdmi_matrix_out1
        from: "off"
        to: "on"
    condition:
      condition: and
      conditions:
        - condition: state
          entity_id: input_boolean.hdmi_matrix_out1
          state: "on"
        - condition: state
          entity_id: input_boolean.hdmi_matrix_in1 
          state: "on"
    action:
      service: shell_command.matrix_out1_in1

HASS doesn’t find anything wrong with the configuration and reloads just fine. No issues in the log file.

The problem is that upon setting state 1 for both in1 and out1 nothing is happening. I am not sure if the automation conditions are even being evaluated as under Devel -> State ; it shows the automation as ‘off’ while both ‘in1’ and ‘out1’ switches are at ‘on’.

I’ve been reading through many pages in the docs:



…among others but unfortunately haven’t figured out a solution yet. Perhaps the whole automation sequence is incorrect and I should be doing something different?
Originally I had thought about linking in a Bash shell script but I’m sure that this is easily doable within HASS.

Thanks for any suggestions!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 102472

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>