Trigger bash
Jump to navigation
Jump to search
Purpose
This script will trigger a bash script every time device change state to on.
Dependencies - hardware / software / operating system
This script will work on all type of hardware / software / operating system
It could be use to trigger any bash script such :
- google_voice.sh
- Any other bash script
Domoticz Setup - switches, variables, version
- Create a virtual lightswitch. e.g. : "Talk - Garbage"
- Replace "Sensor" variable by your virtual lightswitch device name. e.g. : "Talk - Garbage"
- Replace google_voice.sh by the name of your bash script
- Make sure google_voice.sh is located in : /root/domoticz/domoticz/scripts/google_voice.sh
- Make sure google_voice.sh is executable : sudo chmod +x google_voice.sh
- Change the text you want to hear. e.g. : "Bring the garbage bag out"
Installation instructions
Copy this script in your domoticz\scripts\lua\ folder.
Script with comments
-- script name : script_device_garbage.lua -- This script will trigger a bash script every time the device "Sensor" change status -- Create a virtual lightswitch. e.g. : "Talk - Garbage" -- Replace "Sensor" variable by your virtual lightswitch device name. e.g. : "Talk - Garbage" -- Replace google_voice.sh by the name of your bash script -- Make sure google_voice.sh is located in : /root/domoticz/domoticz/scripts/google_voice.sh -- Make sure google_voice.sh is executable : sudo chmod +x google_voice.sh -- Change the text you want to hear. e.g. : "Bring the garbage bag out" local sensor = 'Talk - Garbage' commandArray = {} if (devicechanged[sensor] == 'On') then os.execute ("/root/domoticz/domoticz/scripts/google_voice.sh Bring the garbage bag out") end return commandArray
Example of use (if relevant) i.e. output files / screen displays
N/A