Closed Ataraxiall closed 2 years ago
Hi @Ataraxiall,
the disabledDevices array stores all the devices that are currently disabled. Therefore, when you activate a device it is no longer a disabledDevice and is removed from the array. 0: "0" in the case above means that the first element in the array that is disabled has the index zero. 0: "1"means that the second device is currently disabled.
If you want to keep track about a device status the simplest way would be to set a flow/global variable directly after the device output, for example like this:
[ { "id": "a9184512.6d0338", "type": "file", "z": "578568e428e989a8", "name": "WriteFile", "filename": "/home/ubuntu/Documents/time-schedule0.txt", "appendNewline": true, "createDir": true, "overwriteFile": "true", "encoding": "none", "x": 720, "y": 100, "wires": [ [] ] }, { "id": "4d5aed99.b82234", "type": "inject", "z": "578568e428e989a8", "name": "FireAfterReboot", "props": [ { "p": "payload", "v": "", "vt": "date" }, { "p": "topic", "v": "", "vt": "string" } ], "repeat": "", "crontab": "", "once": true, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 160, "y": 120, "wires": [ [ "efd15a17.372ff8" ] ] }, { "id": "efd15a17.372ff8", "type": "file in", "z": "578568e428e989a8", "name": "ReadFile", "filename": "/home/ubuntu/Documents/time-schedule0.txt", "format": "utf8", "chunk": false, "sendError": false, "encoding": "none", "allProps": false, "x": 340, "y": 120, "wires": [ [ "dec834a4.768678" ] ] }, { "id": "63338f84.0d9f5", "type": "ui_switch", "z": "578568e428e989a8", "name": "", "label": "MyDevice", "tooltip": "", "group": "bfe48a3e.1b0f4", "order": 1, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "x": 960, "y": 140, "wires": [ [] ] }, { "id": "dec834a4.768678", "type": "ui_time_scheduler", "z": "578568e428e989a8", "group": "bfe48a3e.1b0f4", "name": "", "startDay": "0", "refresh": 60, "devices": [ "Device 1" ], "singleOff": false, "onlySendChange": false, "customPayload": false, "eventMode": false, "eventOptions": [], "sendTopic": false, "lat": "", "lon": "", "customContextStore": "", "outputs": 2, "order": 1, "width": 0, "height": 0, "x": 510, "y": 120, "wires": [ [ "a9184512.6d0338" ], [ "04b9358fb706a9b7" ] ] }, { "id": "04b9358fb706a9b7", "type": "change", "z": "578568e428e989a8", "name": "", "rules": [ { "t": "set", "p": "myValue", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 750, "y": 140, "wires": [ [ "63338f84.0d9f5" ] ] }, { "id": "a5f52ae61399bb01", "type": "inject", "z": "578568e428e989a8", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 150, "y": 320, "wires": [ [ "c6f5b46b4be642f7" ] ] }, { "id": "be6ef3b4ab56b0d8", "type": "debug", "z": "578568e428e989a8", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 580, "y": 320, "wires": [] }, { "id": "c6f5b46b4be642f7", "type": "change", "z": "578568e428e989a8", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "myValue", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 350, "y": 320, "wires": [ [ "be6ef3b4ab56b0d8" ] ] }, { "id": "b14a44f6fbd5c8b3", "type": "comment", "z": "578568e428e989a8", "name": "set variable \"myValue\"", "info": "", "x": 160, "y": 60, "wires": [] }, { "id": "b82b8c4f7f8fa7ec", "type": "comment", "z": "578568e428e989a8", "name": "request variable \"myValue\"", "info": "", "x": 170, "y": 260, "wires": [] }, { "id": "bfe48a3e.1b0f4", "type": "ui_group", "name": "Scheduler", "tab": "2936b813.6cde68", "order": 1, "disp": true, "width": "6", "collapse": false }, { "id": "2936b813.6cde68", "type": "ui_tab", "name": "Scheduler Demo", "icon": "dashboard", "order": 1, "disabled": false, "hidden": false } ]
Please let me know if this helps!
I am going to close this for now, please let me know if there are any other questions!
Hello,
First of all, thank you very much for the node, it is very useful.
I have a question, I would like to be able to save the state of the timer in a variable, if it is activated or not. When I give the clock to deactivate it, it does take me out for the payload payload.settings.disabledDevices = "0"
but when I activate it, the array comes out empty
Can you edit the code so that in this second case I get a "1" or something similar?
Thanks