Page 1 of 1

Create Custom Sensor with Axis Label in JSON call

Posted: Wednesday 04 September 2019 20:29
by ElPhilou
Hello,

I'm looking to create (and why not delete), one (and of course more) custom sensor with specific axis, by one call in JSON :roll:

The target is create it in one script.

I did a lot of research, on this forum and of course with our friend Google ;) but I didn't find the good call in JSON.

The excellent WIKI page Domoticz API/JSON URL's speak about createvirtualsensor ( Create a virtual sensor ) with one Dummy Hardware, but I can't find how call to have one new Custom Sensor without ERROR :cry: :oops:

I think, is look like something like that :

Code: Select all

http://IPADRESS:8080/json.htm?type=createvirtualsensor&idx=DUMMY_HARDWARE_ID&sensorname=NAME&sensortype=CustomSensor&axislabel=NAMELABEL
But all my tests failed :?

So, if somebody have the good call ( in JSON or other ) to create ( and delete ) one customsensor, you are welcome :D

Re: Create Custom Sensor with Axis Label in JSON call

Posted: Thursday 05 September 2019 0:38
by waaren
ElPhilou wrote: Wednesday 04 September 2019 20:29 I'm looking to create (and why not delete), one (and of course more) custom sensor with specific axis, by one call in JSON :roll:
So, if somebody have the good call ( in JSON or other ) to create ( and delete ) one customsensor, you are welcome :D
Can you try this to create ? (XX) is hardware idx

Code: Select all

http://IPADRESS:8080/json.htm?type=createdevice&idx=XX&sensorname=myCustomSensor&sensormappedtype=0xF31F&sensoroptions=1;Label
and this to delete (XXXX) is device idx

Code: Select all

http://IPADRESS:8080/json.htm?idx=XXXX&type=deletedevice
[code]

Re: Create Custom Sensor with Axis Label in JSON call

Posted: Thursday 05 September 2019 17:05
by ElPhilou
Thanks a lot :D

And last question, during create, it is possible to define the icon ? :roll:

Re: Create Custom Sensor with Axis Label in JSON call

Posted: Thursday 05 September 2019 18:46
by waaren
ElPhilou wrote: Thursday 05 September 2019 17:05 And last question, during create, it is possible to define the icon ? :roll:
No that is a different JSON

Code: Select all

http://<domoticzIP>:<domotczPort>/json.htm?type=setused&used=true&name=<devicename>&description=<description>&idx=<idx>&switchtype=<switchTypeValue>&customimage=<iconNumber> 
(or use the setIcon method in dzVents)

Re: Create Custom Sensor with Axis Label in JSON call

Posted: Thursday 05 September 2019 18:51
by ElPhilou
setIcon method in dzVents :lol: Of course, Thanks again