Utelys på ved bevegelse, gitt at det er natt / mørkt ute

Ønsker å lage en automasjon som skrur på utelysene i 5 min når det oppdages bevegelse i en av mine to bevegelsesensorer utendørs, eller når dørsensoren åpnes, men kun i tidsperioden mellom solnedgang og soloppgang, altså når det er mørkt ute. Lysene skal ikke skrus på dersom dersom det er dag / lyst.
Noen som har tips til hvordan sette opp dette?

Tror jeg løste det ved å lage en global variabel som settes til “natt” ved solnedgang og “dag” ved soloppgang. Variabelen kan da brukes i en if-switch til å kun skru på lysene ved “natt”.
Finner vel ut om det funket i kveld.

4 Likes

Hei,
jeg er helt newbe med thingsplex og samme problem med ein bevegelse sensor.
Har du kanskje anledning til å forklare hvordan du har lagt den globalt variabelt ( nattmodus) for bevegelse sensor.?

Hilsen Thomas

Hei,

Relativt fersk selv, så godt mulig det finnes bedre måter å løse dette på, men her er uansett min metode:

Har en egen trigger som setter en global variabel til “sunset” eller “sunrise” (samme som input) ved hhv. solnedgang eller -oppgang:

Denne globale variabelen kan da brukes som en IF-sjekk i automatiseringen til utelyset:

Dersom det er “sunrise”, og solen er oppe, slår ikke utelyset seg på. Etter solen har gått ned, slår utelyset seg på når det oppdages bevegelse.

3 Likes

Tusen takk👍
Så lenge det funker er det jo kjempe bra.
Man finner jo flere veier til Roma også😉

Etter litt testing på denne, så viser det seg at 5 minutter etter første bevegelse/trigger, så begynner lysene å slå seg av og på med jevne mellomrom dersom det fortsatt oppdages bevegelse. Dette selv om jeg har “keep new instances and abort already running…” i instillingene til flowen.
Prøvde å endre litt på oppsettet:


Men da er det kun “bevegelse ved garasje”-triggeren som slår på lyset. Skjønner ikke hvorfor de andre triggerene plutselig stoppet å fungere.
Noen som har peiling?

Hele nye koden her:

{
  "Id": "06c4db80-a3eb-11ed-981d-e10ce48adeb8",
  "ClassId": "06c4db80-a3eb-11ed-981d-e10ce48adeb8",
  "Author": "misvan",
  "Version": 0,
  "CreatedAt": "2023-02-03T17:48:54.457Z",
  "UpdatedAt": "2023-10-25T19:49:16.895706264+02:00",
  "Name": "Utelys på",
  "Group": "Bevegelse",
  "Description": "Skru på utelys 5 min ved bevegelse",
  "Nodes": [
    {
      "Id": "14",
      "Type": "trigger",
      "Label": "dør åpnet  i gang",
      "SuccessTransition": "24",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:evt/rt:dev/rn:zigbee/ad:1/sv:sensor_contact/ad:16_1",
      "Service": "sensor_contact",
      "ServiceInterface": "evt.open.report",
      "Config": {
        "InputVariableType": null,
        "IsValueFilterEnabled": true,
        "LookupServiceNameAndLocation": false,
        "PropFilterName": "",
        "PropFilterValue": "",
        "RegisterAsVirtualService": false,
        "Timeout": 0,
        "ValueFilter": {
          "Value": "",
          "ValueType": ""
        },
        "ValueJPath": null,
        "ValueJPathResultType": null,
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "16",
          "nodeName": "door",
          "nodeType": null
        },
        "x": 182,
        "y": 199
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "15",
      "Type": "action",
      "Label": "TRADFRIbulb1055lm 5 slås 240",
      "SuccessTransition": "16",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:10_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.lvl.set",
      "Config": {
        "DefaultValue": {
          "Value": 240,
          "ValueType": "int"
        },
        "IsVariableGlobal": false,
        "LookupServiceNameAndLocation": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": null,
        "VariableName": "",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "10",
          "nodeName": "device",
          "nodeType": "deviceAction"
        },
        "x": 391,
        "y": 560
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "16",
      "Type": "action",
      "Label": "TRADFRIbulb1055lm 2 slås 240",
      "SuccessTransition": "17",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:11_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.lvl.set",
      "Config": {
        "DefaultValue": {
          "Value": 240,
          "ValueType": "int"
        },
        "IsVariableGlobal": false,
        "LookupServiceNameAndLocation": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": null,
        "VariableName": "",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "11",
          "nodeName": "device",
          "nodeType": "deviceAction"
        },
        "x": 390,
        "y": 720
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "17",
      "Type": "action",
      "Label": "TRADFRIbulb1055lm 1 slås 240",
      "SuccessTransition": "18",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:12_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.lvl.set",
      "Config": {
        "DefaultValue": {
          "Value": 240,
          "ValueType": "int"
        },
        "IsVariableGlobal": false,
        "LookupServiceNameAndLocation": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": null,
        "VariableName": "",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "12",
          "nodeName": "device",
          "nodeType": "deviceAction"
        },
        "x": 385,
        "y": 880
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "18",
      "Type": "action",
      "Label": "TRADFRIbulb1055lm 3 slås 240",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:15_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.lvl.set",
      "Config": {
        "DefaultValue": {
          "Value": 240,
          "ValueType": "int"
        },
        "IsVariableGlobal": false,
        "LookupServiceNameAndLocation": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": null,
        "VariableName": "",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "15",
          "nodeName": "device",
          "nodeType": "deviceAction"
        },
        "x": 384,
        "y": 1035
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "19",
      "Type": "wait",
      "Label": "og etter 5 minutter",
      "SuccessTransition": "20",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": 300000,
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": null,
          "nodeName": "wait",
          "nodeType": "deviceTimeout"
        },
        "x": 990,
        "y": 384
      },
      "TypeAlias": "Delay"
    },
    {
      "Id": "20",
      "Type": "action",
      "Label": "TRADFRIbulb1055lm 5 slås av",
      "SuccessTransition": "21",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:10_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.binary.set",
      "Config": {
        "DefaultValue": {
          "Value": false,
          "ValueType": "bool"
        },
        "IsVariableGlobal": false,
        "LookupServiceNameAndLocation": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": null,
        "VariableName": "",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "10",
          "nodeName": "device",
          "nodeType": "deviceTimeoutAction"
        },
        "x": 998,
        "y": 565
      },
      "TypeAlias": "Action",
      "LastValue": false
    },
    {
      "Id": "21",
      "Type": "action",
      "Label": "TRADFRIbulb1055lm 2 slås av",
      "SuccessTransition": "22",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:11_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.binary.set",
      "Config": {
        "DefaultValue": {
          "Value": false,
          "ValueType": "bool"
        },
        "IsVariableGlobal": false,
        "LookupServiceNameAndLocation": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": null,
        "VariableName": "",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "11",
          "nodeName": "device",
          "nodeType": "deviceTimeoutAction"
        },
        "x": 996,
        "y": 720
      },
      "TypeAlias": "Action",
      "LastValue": false
    },
    {
      "Id": "22",
      "Type": "action",
      "Label": "TRADFRIbulb1055lm 1 slås av",
      "SuccessTransition": "23",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:12_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.binary.set",
      "Config": {
        "DefaultValue": {
          "Value": false,
          "ValueType": "bool"
        },
        "IsVariableGlobal": false,
        "LookupServiceNameAndLocation": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": null,
        "VariableName": "",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "12",
          "nodeName": "device",
          "nodeType": "deviceTimeoutAction"
        },
        "x": 994,
        "y": 892
      },
      "TypeAlias": "Action",
      "LastValue": false
    },
    {
      "Id": "23",
      "Type": "action",
      "Label": "TRADFRIbulb1055lm 3 slås av",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:15_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.binary.set",
      "Config": {
        "DefaultValue": {
          "Value": false,
          "ValueType": "bool"
        },
        "IsVariableGlobal": false,
        "LookupServiceNameAndLocation": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": null,
        "VariableName": "",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "15",
          "nodeName": "device",
          "nodeType": "deviceTimeoutAction"
        },
        "x": 994,
        "y": 1060
      },
      "TypeAlias": "Action",
      "LastValue": false
    },
    {
      "Id": "24",
      "Type": "if",
      "Label": "om det er natt",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": true,
            "LeftVariableName": "natt eller dag",
            "Operand": "eq",
            "RightVariable": {
              "Value": "sunset",
              "ValueType": "string"
            }
          }
        ],
        "FalseTransition": "",
        "TrueTransition": "15"
      },
      "Ui": {
        "nodeType": "",
        "x": 392,
        "y": 394
      },
      "TypeAlias": "If condition"
    },
    {
      "Id": "25",
      "Type": "trigger",
      "Label": "bevegelse ved garasje",
      "SuccessTransition": "24",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:evt/rt:dev/rn:zigbee/ad:1/sv:sensor_presence/ad:23_2",
      "Service": "sensor_presence",
      "ServiceInterface": "evt.presence.report",
      "Config": {
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "RegisterAsVirtualService": false,
        "Timeout": 0,
        "ValueFilter": {
          "Value": true,
          "ValueType": "bool"
        },
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 430,
        "y": 199
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "26",
      "Type": "trigger",
      "Label": "bevegelse ved ytterdør",
      "SuccessTransition": "24",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:evt/rt:dev/rn:zigbee/ad:1/sv:sensor_presence/ad:24_2",
      "Service": "sensor_presence",
      "ServiceInterface": "evt.presence.report",
      "Config": {
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "RegisterAsVirtualService": false,
        "Timeout": 0,
        "ValueFilter": {
          "Value": true,
          "ValueType": "bool"
        },
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 674,
        "y": 193
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "27",
      "Type": "trigger",
      "Label": "ingen bevegelse ved garasje",
      "SuccessTransition": "19",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:evt/rt:dev/rn:zigbee/ad:1/sv:sensor_presence/ad:23_2",
      "Service": "sensor_presence",
      "ServiceInterface": "evt.presence.report",
      "Config": {
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "RegisterAsVirtualService": false,
        "Timeout": 0,
        "ValueFilter": {
          "Value": false,
          "ValueType": "bool"
        },
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 996,
        "y": 191
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "28",
      "Type": "trigger",
      "Label": "ingen bevegelse ved ytterdør",
      "SuccessTransition": "29",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:evt/rt:dev/rn:zigbee/ad:1/sv:sensor_presence/ad:24_2",
      "Service": "sensor_presence",
      "ServiceInterface": "evt.presence.report",
      "Config": {
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "RegisterAsVirtualService": false,
        "Timeout": 0,
        "ValueFilter": {
          "Value": false,
          "ValueType": "bool"
        },
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 1260,
        "y": 187
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "29",
      "Type": "wait",
      "Label": "og etter 5 minutter",
      "SuccessTransition": "30",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": 300000,
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": null,
          "nodeName": "wait",
          "nodeType": "deviceTimeout"
        },
        "x": 1257,
        "y": 385
      },
      "TypeAlias": "Delay"
    },
    {
      "Id": "30",
      "Type": "action",
      "Label": "TRADFRIbulb1055lm 5 slås av",
      "SuccessTransition": "31",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:10_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.binary.set",
      "Config": {
        "DefaultValue": {
          "Value": false,
          "ValueType": "bool"
        },
        "IsVariableGlobal": false,
        "LookupServiceNameAndLocation": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": null,
        "VariableName": "",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "10",
          "nodeName": "device",
          "nodeType": "deviceTimeoutAction"
        },
        "x": 1257,
        "y": 565
      },
      "TypeAlias": "Action",
      "LastValue": false
    },
    {
      "Id": "31",
      "Type": "action",
      "Label": "TRADFRIbulb1055lm 2 slås av",
      "SuccessTransition": "32",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:11_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.binary.set",
      "Config": {
        "DefaultValue": {
          "Value": false,
          "ValueType": "bool"
        },
        "IsVariableGlobal": false,
        "LookupServiceNameAndLocation": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": null,
        "VariableName": "",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "11",
          "nodeName": "device",
          "nodeType": "deviceTimeoutAction"
        },
        "x": 1259,
        "y": 718
      },
      "TypeAlias": "Action",
      "LastValue": false
    },
    {
      "Id": "32",
      "Type": "action",
      "Label": "TRADFRIbulb1055lm 1 slås av",
      "SuccessTransition": "33",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:12_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.binary.set",
      "Config": {
        "DefaultValue": {
          "Value": false,
          "ValueType": "bool"
        },
        "IsVariableGlobal": false,
        "LookupServiceNameAndLocation": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": null,
        "VariableName": "",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "12",
          "nodeName": "device",
          "nodeType": "deviceTimeoutAction"
        },
        "x": 1260,
        "y": 886
      },
      "TypeAlias": "Action",
      "LastValue": false
    },
    {
      "Id": "33",
      "Type": "action",
      "Label": "TRADFRIbulb1055lm 3 slås av",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:15_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.binary.set",
      "Config": {
        "DefaultValue": {
          "Value": false,
          "ValueType": "bool"
        },
        "IsVariableGlobal": false,
        "LookupServiceNameAndLocation": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": null,
        "VariableName": "",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "15",
          "nodeName": "device",
          "nodeType": "deviceTimeoutAction"
        },
        "x": 1262,
        "y": 1054
      },
      "TypeAlias": "Action",
      "LastValue": false
    }
  ],
  "Settings": null,
  "IsDisabled": false,
  "IsDefault": false,
  "ParallelExecution": "keep_last"
}

Det er ikke rart at den første flowen din kan gå i feil. Heller ikke rart at nummer 2 kan tulle. Bevegelses sensorene dine trigger på forskjellige tidspunkt Aktiv/Inaktiv. Og hvis du har “Keep last instance”, så blir det krøll (blir krøll uansett egentlig). Den eneste løsningen jeg ser, er å sette globale variabler til når bevegelse er aktiv, ny flow for når bevegelse er inaktiv å sjekke variablene for de globale variablene. om de er true eller false for å starte timeren.

2 Likes