Page 1 of 1

Device to store time

Posted: Wednesday 09 October 2019 12:34
by Andrex
Hi all,
I need to have a device where I can store/change a time that is in seconds or minutes.
I need this to manage the time some light stays on or the time some light should be turned off after the alarm system is engaged.
That value would be used in NodeRed.
Which virtual device should I use?
Thanks!

Re: Device to store time

Posted: Wednesday 09 October 2019 14:19
by waaren
Andrex wrote: Wednesday 09 October 2019 12:34 I need to have a device where I can store/change a time that is in seconds or minutes.
Would it not be easier to store it in a type time uservariable ?

Re: Device to store time

Posted: Wednesday 09 October 2019 14:38
by Andrex
Tha fact is that I would like to have those variables to be quickly editable by my colleague, so a device would be really nice.
It would be cool to be able to "enable" a user variable to become a device

Re: Device to store time

Posted: Wednesday 09 October 2019 18:21
by waaren
Andrex wrote:Tha fact is that I would like to have those variables to be quickly editable by my colleague, so a device would be really nice.
It would be cool to be able to "enable" a user variable to become a device
A dimmer can be set to a number between 1-100.
A selector has a limited number of steps but content can be set to any number.





Re: Device to store time

Posted: Wednesday 09 October 2019 19:22
by Andrex
waaren wrote: Wednesday 09 October 2019 18:21 A dimmer can be set to a number between 1-100.
A selector has a limited number of steps but content can be set to any number.
Right!!!
I'll try, thanks for the suggestion!
But still, a device of plain editable number would be great!

Re: Device to store time

Posted: Thursday 10 October 2019 20:05
by Andrex
waaren wrote: Wednesday 09 October 2019 18:21 A selector has a limited number of steps but content can be set to any number.
Is there a way to change the level of the selector? Because retrieving the value with the API only gives the level and not the level name.
Also it would be much easier for me to use the level directly with the numbers I need.
Thanks!

Re: Device to store time

Posted: Thursday 10 October 2019 20:38
by waaren
Andrex wrote: Thursday 10 October 2019 20:05
waaren wrote: Wednesday 09 October 2019 18:21 A selector has a limited number of steps but content can be set to any number.
Is there a way to change the level of the selector? Because retrieving the value with the API only gives the level and not the level name.
Also it would be much easier for me to use the level directly with the numbers I need.
Thanks!
I use dzvents for both setting and retrieving this information. .(attribute levelname(s) and method switchSelector)
Using the API the level of the selector can be set with

Code: Select all

https:/<domoticz ip>:domoticz port>/json.htm?type=command&param=switchlight&switchcmd=Set%20Level&level=<LEVEL>&idx=<ID> 
Using the API, the level names can be retrieved using

Code: Select all

https:/<domoticz ip>:domoticz port>/json.htm?type=devices&rid=<ID >
For one of my selector devices this returns
Spoiler: show

Code: Select all

{
"ActTime": 1570732049,
"AstrTwilightEnd": "20:52",
"AstrTwilightStart": "06:06",
"CivTwilightEnd": "19:34",
"CivTwilightStart": "07:24",
"DayLength": "11:03",
"NautTwilightEnd": "20:13",
"NautTwilightStart": "06:45",
"ServerTime": "2019-10-10 20:27:29",
"SunAtSouth": "13:29",
"Sunrise": "07:58",
"Sunset": "19:01",
"app_version": "4.11360",
"result": [
{
"AddjMulti": 1,
"AddjMulti2": 1,
"AddjValue": 0,
"AddjValue2": 0,
"BatteryLevel": 255,
"CustomImage": 159,
"Data": "Off",
"Description": "",
"DimmerType": "none",
"Favorite": 0,
"HardwareID": 14,
"HardwareName": "Sonos",
"HardwareType": "Sonos Players",
"HardwareTypeVal": 94,
"HaveDimmer": true,
"HaveGroupCmd": true,
"HaveTimeout": false,
"ID": "000E0004",
"Image": "Sonos",
"IsSubDevice": false,
"LastUpdate": "2019-10-08 22:10:37",
"Level": 0,
"LevelActions": "fHx8fHw=",
"LevelInt": 0,
"LevelNames": "T2ZmfE5QTyBSYWRpbyAxfE5QTyBSYWRpbyAyIDkyLjkgKFBvcCl8UmFkaW8gMTB8UmFkaW8gUmlqbm1vbmR8U3VibGltZSBTbW9vdGg=",
"LevelOffHidden": false,
"MaxDimLevel": 100,
"Name": "Sonos - Radio",
"Notifications": "false",
"PlanID": "0",
"PlanIDs": [
0
],
"Protected": false,
"SelectorStyle": 1,
"ShowNotifications": true,
"SignalLevel": "-",
"Status": "Off",
"StrParam1": "",
"StrParam2": "",
"SubType": "Selector Switch",
"SwitchType": "Selector",
"SwitchTypeVal": 18,
"Timers": "false",
"Type": "Light/Switch",
"TypeImg": "Light",
"Unit": 4,
"Used": 1,
"UsedByCamera": false,
"XOffset": "0",
"YOffset": "0",
"idx": "2593"
}
],
"status": "OK",
"title": "Devices"
}
If you decode the Base64 coded Levelnames you get
Off|NPO Radio 1|NPO Radio 2 92.9 (Pop)|Radio 10|Radio Rijnmond|Sublime Smooth

Re: Device to store time

Posted: Friday 11 October 2019 15:04
by Andrex
I wouldn't mark this as solved since it's still not possible to store a plain number into a device