Binary entity action

I need some guidance, at least on what to search for. I have this wireless reed switch working well in HA. This card shows its status.
ScreenHunter 620
Below is the config. How do I have the state change of the reed switch fire a bash script on my raspberry pi ? Is it a tap_action and call service or an automation ? The script will just do a wget of a URL, do I use url instead of call service ? I find the docs to be comprehensive on the site, I just have trouble piecing it all together.
Thanks

 - entity: binary_sensor.wyzesense_6767672
    hold_action:
      action: more-info
    name: Reed3
    state:
      - color: Black
        icon: 'mdi:door'
        value: 'off'
      - color: Red
        icon: 'mdi:door-open'
        value: 'on'

It’s just an automation that you do not put in the Lovelace front end config.

trigger:
  platform: state
  entity_id: binary_sensor.wyzesense_6767672
  to: 'on' # or 'off' or both if you leave this line out
action:
  service: shell_command.whatever_you_call_it

Fantasmos, thanks

As always I struggle, there are no errors, but the touch doesn’t fire when the switch is opened, how do I troubleshoot ?


automation
  - alias: door3_state
    trigger:
      platform: state
      entity_id: binary_sensor.wyzesense_6767672
    action:
      service: shell_command.reed3_action

shell_command:
  reed3_action: touch /tmp/reed3

here is debug,

2020-04-26 02:06:27 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=door3_state, entity_id=automation.door3_state>
2020-04-26 02:06:27 INFO (MainThread) [homeassistant.components.automation] Executing door3_state
2020-04-26 02:06:27 INFO (MainThread) [homeassistant.helpers.script] Script door3_state: Running script
2020-04-26 02:06:27 INFO (MainThread) [homeassistant.helpers.script] Script door3_state: Executing step call service
2020-04-26 02:06:27 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=shell_command, service=reed3_action, service_data=>
2020-04-26 02:06:27 DE

I assume service data should show something ?

Thanks

I know one thing, shell_command has some super secret hidden syntax.
touch /tmp/foobar [doesn’t work]
touch foobar [works, writes to HAhome]
bash touch.sh [doesn’t work with touch.sh in HAhome or anywhere]
touch.sh [doesn’t work with touch.sh in HAhome or /usr/bin]
/usr/bin/touch.sh [doesn’t work]
using single quotes, double quotes, no quotes [doesn’t work]

so curl works, therefore I created automation.py in the cgi directory of my local lighttpd webserver and am using it to fork what I really need to run. It is a jiveazz way to do it, but I need to move on.

HA has some simple aspects and some infuriating logic defying aspects. Sadly I spends hours and hours on the latter.