Page 1 of 1

virtual sensor inputs

Posted: Tuesday 12 January 2021 12:11
by grumpy
where can i find what the required inputs are for virtual sensors
for example i create a temperature sensor
i know the idx is required but what other inputs
i eventually found that it wants the temperature in svalue
but where is the info for all the other sensors

Re: virtual sensor inputs

Posted: Tuesday 12 January 2021 13:40
by waaren
grumpy wrote: Tuesday 12 January 2021 12:11 where can i find what the required inputs are for virtual sensors
You can find most information on this wiki page

Re: virtual sensor inputs

Posted: Tuesday 12 January 2021 14:17
by grumpy
that what i needed
thanks

Re: virtual sensor inputs

Posted: Tuesday 12 January 2021 14:19
by FireWizard
HI,

Also this page might be of help:

https://piandmore.wordpress.com/2019/02 ... -domoticz/

Regards

Re: virtual sensor inputs

Posted: Tuesday 12 January 2021 14:49
by grumpy
very good reading
thanks

Re: virtual sensor inputs

Posted: Tuesday 12 January 2021 19:18
by grumpy
and where would i find specs for a switch of type smoke detector

Re: virtual sensor inputs

Posted: Tuesday 12 January 2021 20:07
by FireWizard
Hi,

Perhaps this is a nice description:

https://techestigate.com/how-to-add-433 ... -domoticz/

Regards

Re: virtual sensor inputs

Posted: Tuesday 12 January 2021 22:17
by grumpy
i appreciate that but what i am really interested in is finding where that and others are defined in domoticz

Re: virtual sensor inputs

Posted: Tuesday 12 January 2021 23:35
by waaren
grumpy wrote: Tuesday 12 January 2021 22:17 i appreciate that but what i am really interested in is finding where that and others are defined in domoticz
If it is not already documented in the Wiki you need to search in the source.

Code: Select all

git clone https://github.com/domoticz/domoticz.git domoticz-dev
cd domoticz-dev
grep -rin smoke
Will give you some information

Next you can define a virtual switch in domoticz and edit it on the switch tab from On/Off to Smokedetection
Check the database for the changed device and you will see something like

Code: Select all

sqlite> select id,switchtype,type,subtype,svalue,nvalue from devicestatus where id = 3456;
3456|5|244|73|0|1
Clicking the smokedetector on the device tab while opened the developer console on the network tab of your browser will show you the JSON for activating the detector

Code: Select all

http://<domoticz IP: domoticz port>/json.htm?type=command&param=switchlight&idx=<IDX>&switchcmd=On
And the same for reset

Code: Select all

http://<domoticz IP: domoticz port>/json.htm?type=command&param=resetsecuritystatus&idx=<IDX>&switchcmd=Normal

Re: virtual sensor inputs

Posted: Wednesday 13 January 2021 18:17
by grumpy
great
more than one way to skin a cat :)

Re: virtual sensor inputs

Posted: Wednesday 13 January 2021 20:19
by FireWizard
Hi all,

I see that @grumpy is rather happy with the solutions of @waaren, given in the previous post.

However, I still have some remarks, as I feel that it does not answer @grumpy 's goal, as I assume that he wants to control the Smoke Alarm (Smoke Detector) with a remote JSON command.

@waaren says in the first possibility:
If it is not already documented in the Wiki you need to search in the source.
I tested it and indeed it gives you a lot of information, not seen earlier, of (in this case) supported Smoke Detectors.
But I was unable to find to correct syntax to send a JSON command and control a Smoke Detector.
Perhaps I overlooked something, but with help of that solution, most Domoticz users are unable to control the specific switch.

The next possibility, that @waaren describes is:
Next you can define a virtual switch in domoticz and edit it on the switch tab from On/Off to Smokedetection
Check the database for the changed device and you will see something like
Indeed if you do that, you will see:

Code: Select all

[herman@asterix Domoticz]$ sqlite3 domoticz.db
SQLite version 3.34.0 2020-12-01 16:14:00
Enter ".help" for usage hints.
sqlite> select id,switchtype,type,subtype,svalue,nvalue from devicestatus where id = 11;
11|5|244|73|100|0
sqlite> 
But how many will understand what the sequence "11|5|244|73|100|0" means? And, if I understand, how can I correctly control this Smoke Detector?

Use of the DB Browser for SQlite gives the same result (see the last line):

Screenshot_DB_Browser.png
Screenshot_DB_Browser.png (66.34 KiB) Viewed 1455 times
The solution that comes closest to the goal is the third possibility, offered by @waaren.
Clicking the smokedetector on the device tab while opened the developer console on the network tab of your browser will show you the JSON for activating the detector
I have not been able to find the right command in the "network" tab. I have tested it with Google Chrome and Mozilla Firefox under Linux.
I finally found it under the "Console" tab and "Requests" tab.

Screenshot_commands.png
Screenshot_commands.png (21.97 KiB) Viewed 1455 times
In addition to what @waaren wrote you can also use the passcode (of that switch). I assume you need it, if the switch has been set to protected.
I think that is recommended for a Smoke Alarm.

You will also have noticed that there is a "level΅.

What does that level represent? I think that is one of the questions @grumpy wants to know, if you want to control this switch with a remote command.
Do they expect a value from 0-100? (I think they do, but I'm not sure.)

In the source code, you will find that for a detector the obscuration is expressed in %/feet, which is fine for the UK, but uncommon in the rest of Europe. For optical smoke detectors and smoke alarms the sensitivity and smoke density is expressed in dB/m
I think it is important to know what that "level" represents.

I focused specifically on the Smoke Detector, as I expect that many Domoticz users in the next 1.5 year want to connect their Smoke Alarms to Domoticz, as new building legislation will come into force in The Netherlands from July 1, 2022, and in all homes, also built before 2003, Smoke Alarms will become mandatory.

I know, Domoticz is open-source and we cannot expect that a few developers do everything. I expect also that other switches, sensors, etc have undocumented features. We should improve Domoticz together and perhaps we can get these undocumented features clear and add it to the Wiki.

Are their ideas to get these undocumented features clear? With some guidelines/ideas I'm happy to support, because I have to be at home as much as possible (according to our prime minister :( )

Regards

Re: virtual sensor inputs

Posted: Wednesday 13 January 2021 20:50
by waaren
FireWizard wrote: Wednesday 13 January 2021 20:19 I know, Domoticz is open-source and we cannot expect that a few developers do everything. I expect also that other switches, sensors, etc have undocumented features. We should improve Domoticz together and perhaps we can get these undocumented features clear and add it to the Wiki.

Are their ideas to get these undocumented features clear? With some guidelines/ideas I'm happy to support, because I have to be at home as much as possible (according to our prime minister :( )
Thx for the offer !

If you send me a PM with your Email address and preferred username, I will create a user-ID that you can use to access the wiki pages as maintainer.

btw. the level parameter is not used for the smoke detector.