cURL inputs

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
liderbug
Posts: 20
Joined: Monday 02 January 2017 17:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

cURL inputs

Post by liderbug »

When, from a external script (php/bash/etc) doing a:
curl ... 'http://sg53:8080/json.htm?type=command& ... tchcmd=Off'
allow idx to be replaced with name or hw or id.unit.

Would allow for the command to read param=switchlight&Name=Porch&....

tks
SweetPants

Re: cURL inputs

Post by SweetPants »

lost
Posts: 659
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: cURL inputs

Post by lost »

liderbug wrote: allow idx to be replaced with name
Usually, only IDX are allowed...
http://www.domoticz.com/forum/viewtopic ... 93#p117793
liderbug
Posts: 20
Joined: Monday 02 January 2017 17:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: cURL inputs

Post by liderbug »

OK, thanks for the response. From your responses I've worked out a soultion:

/domoticz $ MyOnOff Patio On

Code: Select all

[MyOnOff]
#!/bin/bash 

id=`echo "select id from DeviceStatus where name = '$1';" | sqlite3 domoticz.db `
/usr/bin/curl "http://sg53:8080/json.htm?type=command&param=switchlight&idx=$id&switchcmd=$2"

safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: cURL inputs

Post by safi78 »

Nice! I like this :)

Thanks for sharing!
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest