i'm trying to use curl on bash, as a mean to send to Domoticz via customerevents a JSON data string. I having problems with [] in bash.
The following code is sent to Domoticz, fires up the related custom event and is recognized as a valid JSON data structure
Code: Select all
data='\{"sensor":\{"port":2,"output":1,"power":1.13619548\},"status":"success"\}'
url=$DOMOTICZSERVER:$DOMOTICZPORT'/json.htm?type=command¶m=customevent&event=mFI&data='$data
curl --silent $url > /dev/null
Code: Select all
data='\{"sensors":[\{"port":2,"output":1,"power":1.13619548\}],"status":"success"\}'dzvents 3.04