The sequence below will turn on a light when a contact sensor is open between 9PM-6AM and turn it off when the contact sensor is closed. You can import it and change it as needed.
Code to import
[
{
"id": "8de037e.53a12c8",
"type": "hubitat device",
"z": "cf3bcc81.2331d",
"name": "Contact - Back Door",
"server": "a22e0ea9.276dc8",
"deviceId": "419",
"attribute": "",
"sendEvent": true,
"x": 330,
"y": 460,
"wires": [
[
"b8b088d0.e9e328"
]
]
},
{
"id": "b8b088d0.e9e328",
"type": "switch",
"z": "cf3bcc81.2331d",
"name": "open/closed",
"property": "payload.value",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "open",
"vt": "str"
},
{
"t": "eq",
"v": "closed",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 550,
"y": 460,
"wires": [
[
"40f3e0ac.2b5e7"
],
[
"507e7281.566004"
]
]
},
{
"id": "40f3e0ac.2b5e7",
"type": "time-range-switch",
"z": "cf3bcc81.2331d",
"name": "21:00-06:00",
"lat": "",
"lon": "",
"startTime": "21:00",
"endTime": "06:00",
"startOffset": 0,
"endOffset": 0,
"x": 750,
"y": 460,
"wires": [
[
"22630376.b40ae4"
],
[]
]
},
{
"id": "507e7281.566004",
"type": "hubitat command",
"z": "cf3bcc81.2331d",
"name": "Garage Tube OFF",
"server": "662851c4.3ccad",
"deviceId": "4200",
"command": "off",
"commandArgs": "",
"x": 770,
"y": 501,
"wires": [
[]
]
},
{
"id": "22630376.b40ae4",
"type": "hubitat command",
"z": "cf3bcc81.2331d",
"name": "Garage Tube ON",
"server": "662851c4.3ccad",
"deviceId": "4200",
"command": "on",
"commandArgs": "",
"x": 990,
"y": 460,
"wires": [
[]
]
},
{
"id": "a22e0ea9.276dc8",
"type": "hubitat config",
"z": "",
"name": "HubitatM",
"usetls": false,
"host": "192.168.1.46",
"port": "80",
"token": "496f7f11-256d-44c9-99c6-4ed460d3efb0",
"appId": "1522",
"nodeRedServer": "http://192.168.1.4:1880",
"webhookPath": "/hubitat/webhook"
},
{
"id": "662851c4.3ccad",
"type": "hubitat config",
"z": "",
"name": "HubitatS",
"usetls": false,
"host": "192.168.1.36",
"port": "80",
"token": "5dee560c-c42c-4e4b-bdf7-6bed1bb77371",
"appId": "4489",
"nodeRedServer": "http://192.168.1.4:1880",
"webhookPath": "/hubitat/webhook2"
}
]