writing to user varianble

All kinds of 'OS' scripts

Moderator: leecollings

Post Reply
desertdog
Posts: 84
Joined: Sunday 14 August 2016 13:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Netherlands
Contact:

writing to user varianble

Post by desertdog »

I have some bash scripts which are time-triggered to launch some scenes on Hue or Nanoleaf via their API's
example script:

Code: Select all

#!/bin/bash
curl -v -X PUT \
    --url  http://192.168.X.xx:16021/api/v1/***apikey***/effects/\
    --header 'content-type: application/json' \
    --data '{"select":"'"$1"'"}';
    
The trigger for the script is: script:///home/pi/domoticz/scripts/bash/nanoscene.sh "scene 1", where "scene 1" is the name of the scene in the Nanoleaf. By changing the name in the API call I can call different scenes.

This is working perfectly, but I would also like to write the name of the scene to a user variable, so I can use this in another scripting to see which scene is running. How can I do this?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: writing to user varianble

Post by waaren »

desertdog wrote: Monday 21 October 2019 9:08 Wow to write the name of the scene to a user variable, so I can use this in another scripting to see which scene is running.
If you want to set a value in a domoticz uservariable from a bash script:

Code: Select all

curl 'http://<domo ip>:<domo port>/json.htm?type=command&param=updateuservariable&vname=<variable name&vtype=2&vvalue=<your string>'

Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest