Automation + curl

Hello, I try to catch my signal from the camera and send a curl is there any change.

my code:

automation:

  • alias: Haustuer
    trigger:
    platform: state
    entity_id: binary_sensor.terrasse_line_crossing
    from: ‘off’
    to: ‘on’
    action:
    shell_command.trigger_alarm

shell_command:
trigger_alarm: ‘curl --header “Content-Type: text/plain” --request POST --data “ON” http://192.168.4.6:8080/rest/items/Alarm_Haustuer

hass --script check_config:
17-03-16 22:19:11 INFO (MainThread) [homeassistant.setup] Setting up mqtt
17-03-16 22:19:11 INFO (MainThread) [homeassistant.setup] Setting up updater
17-03-16 22:19:11 INFO (MainThread) [homeassistant.setup] Setting up sensor
17-03-16 22:19:11 INFO (MainThread) [homeassistant.setup] Setting up discovery
17-03-16 22:19:11 INFO (MainThread) [homeassistant.setup] Setting up shell_command
17-03-16 22:19:11 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: expected a dictionary @ data[‘action’][0]. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 103). Please check the docs at https://home-assistant.io/components/automation/
17-03-16 22:19:11 INFO (MainThread) [homeassistant.setup] Setting up automation
17-03-16 22:19:11 INFO (MainThread) [homeassistant.setup] Setting up http
17-03-16 22:19:11 INFO (MainThread) [homeassistant.setup] Setting up sun
17-03-16 22:19:11 INFO (MainThread) [homeassistant.setup] Setting up knx
17-03-16 22:19:11 INFO (MainThread) [homeassistant.setup] Setting up binary_sensor
17-03-16 22:19:12 INFO (MainThread) [homeassistant.setup] Setting up switch
17-03-16 22:19:12 INFO (MainThread) [homeassistant.setup] Setting up conversation
17-03-16 22:19:12 INFO (MainThread) [homeassistant.setup] Setting up recorder
17-03-16 22:19:12 INFO (MainThread) [homeassistant.setup] Setting up media_player
17-03-16 22:19:12 INFO (MainThread) [homeassistant.setup] Setting up websocket_api
17-03-16 22:19:12 INFO (MainThread) [homeassistant.setup] Setting up api
17-03-16 22:19:12 INFO (MainThread) [homeassistant.setup] Setting up history
17-03-16 22:19:12 INFO (MainThread) [homeassistant.setup] Setting up frontend
17-03-16 22:19:12 INFO (MainThread) [homeassistant.setup] Setting up logbook
Failed config
automation:
- action: shell_command.trigger_alarm
alias: Haustuer
trigger: [source /home/homeassistant/.homeassistant/configuration.yaml:105]
platform: state
entity_id: binary_sensor.terrasse_line_crossing
from: off
to: on

Successful config (partial)
automation:
(homeassistant_venv) homeassistant@RasHA:~$

Thanks in advance!

The error is telling you that your automation needs an “action:” block. Every automation requires one.

Also, use preformatted text when posting YAML.

1 Like

“action:” block - could you give me an example?

Use preformatted text so we can read it

Looks like you need service: shell_command.trigger_alarm in your action though

automation:
  trigger: ...
  condition ...
  _action:_ ... 

thanks, no error any more. Only my curle is not yet working. My homework for tomorrow.

When debugging, make sure that the cURL statement works from a command line when logged in as the user that your HA install runs as. And in the virtual environment if you use one.

it works! Thanks to all.

Curl: I had authentication topic!