Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- "id": "33aa5b84cbda1288",
- "type": "api-current-state",
- "z": "cd7aed7c57ddb35c",
- "name": "",
- "server": "7d73562f276de96f",
- "version": 3,
- "outputs": 1,
- "halt_if": "",
- "halt_if_type": "str",
- "halt_if_compare": "is",
- "entity_id": "calendar.work",
- "state_type": "str",
- "blockInputOverrides": false,
- "outputProperties": [
- {
- "property": "payload",
- "propertyType": "msg",
- "value": "",
- "valueType": "entityState"
- },
- {
- "property": "data",
- "propertyType": "msg",
- "value": "",
- "valueType": "entity"
- }
- ],
- "for": "0",
- "forType": "num",
- "forUnits": "minutes",
- "override_topic": false,
- "state_location": "payload",
- "override_payload": "msg",
- "entity_location": "data",
- "override_data": "msg",
- "x": 880,
- "y": 1460,
- "wires": [
- [
- "d593f55b22b33252"
- ]
- ]
- },
- {
- "id": "d593f55b22b33252",
- "type": "function",
- "z": "cd7aed7c57ddb35c",
- "name": "check if working and @home",
- "func": "// Check if msg.data (the calendar event data) is available and contains the required information.\nif (msg.data && msg.data.attributes && msg.data.attributes.message && msg.data.attributes.location && msg.payload === 'on') {\n const summary = msg.data.attributes.message;\n const location = msg.data.attributes.location;\n\n msg.payload = (summary === 'Work' && location.includes('Home'));\n\n} else {\n // Handle the case where msg.data or its attributes are missing. Important for robustness!\n msg.payload = false; // Or perhaps undefined, depending on how you want to handle it.\n}\n\nreturn msg;",
- "outputs": 1,
- "timeout": 0,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 1140,
- "y": 1460,
- "wires": [
- []
- ]
- },
- {
- "id": "e5fbbd6d00aacbde",
- "type": "api-call-service",
- "z": "cd7aed7c57ddb35c",
- "name": "perform standing desk script",
- "server": "5",
- "version": 7,
- "debugenabled": false,
- "action": "script.standing_desk",
- "floorId": [],
- "areaId": [],
- "deviceId": [],
- "entityId": [],
- "labelId": [],
- "data": "",
- "dataType": "jsonata",
- "mergeContext": "",
- "mustacheAltTags": false,
- "outputProperties": [],
- "queue": "none",
- "blockInputOverrides": true,
- "domain": "script",
- "service": "standing_desk",
- "x": 1560,
- "y": 1460,
- "wires": [
- []
- ]
- },
- {
- "id": "af6968802093856e",
- "type": "switch",
- "z": "cd7aed7c57ddb35c",
- "name": "true or false?",
- "property": "payload",
- "propertyType": "msg",
- "rules": [
- {
- "t": "true"
- },
- {
- "t": "false"
- }
- ],
- "checkall": "true",
- "repair": false,
- "outputs": 2,
- "x": 1350,
- "y": 1460,
- "wires": [
- [
- "e5fbbd6d00aacbde"
- ],
- []
- ]
- },
- {
- "id": "inject_desk_check",
- "type": "inject",
- "z": "cd7aed7c57ddb35c",
- "name": "Check desk Status",
- "props": [],
- "repeat": "60",
- "crontab": "",
- "once": false,
- "onceDelay": 0.1,
- "topic": "",
- "x": 180,
- "y": 1460,
- "wires": [
- [
- "trigger_desk_delay"
- ]
- ]
- },
- {
- "id": "b57624e07c316a32",
- "type": "api-current-state",
- "z": "cd7aed7c57ddb35c",
- "name": "desk Off for 40 Minutes",
- "server": "5",
- "version": 3,
- "outputs": 2,
- "halt_if": "",
- "halt_if_type": "str",
- "halt_if_compare": "is",
- "entity_id": "binary_sensor.desk",
- "state_type": "str",
- "blockInputOverrides": true,
- "outputProperties": [
- {
- "property": "payload",
- "propertyType": "msg",
- "value": "",
- "valueType": "entityState"
- },
- {
- "property": "data",
- "propertyType": "msg",
- "value": "",
- "valueType": "entity"
- }
- ],
- "for": "40",
- "forType": "num",
- "forUnits": "minutes",
- "override_topic": false,
- "state_location": "payload",
- "override_payload": "msg",
- "entity_location": "data",
- "override_data": "msg",
- "x": 630,
- "y": 1460,
- "wires": [
- [
- "33aa5b84cbda1288"
- ],
- []
- ]
- },
- {
- "id": "trigger_desk_delay",
- "type": "trigger",
- "z": "cd7aed7c57ddb35c",
- "name": "40 Minute desk Delay",
- "op1": "40",
- "op2": "0",
- "op1type": "num",
- "op2type": "payl",
- "duration": "250",
- "extend": true,
- "overrideDelay": false,
- "units": "min",
- "reset": "off",
- "bytopic": "all",
- "topic": "topic",
- "outputs": 1,
- "x": 400,
- "y": 1460,
- "wires": [
- [
- "b57624e07c316a32"
- ]
- ]
- },
- {
- "id": "7d73562f276de96f",
- "type": "server",
- "name": "Home Assistant",
- "version": 5,
- "addon": true,
- "rejectUnauthorizedCerts": true,
- "ha_boolean": "y|yes|true|on|home|open",
- "connectionDelay": true,
- "cacheJson": true,
- "heartbeat": false,
- "heartbeatInterval": "30",
- "areaSelector": "friendlyName",
- "deviceSelector": "friendlyName",
- "entitySelector": "friendlyName",
- "statusSeparator": ": ",
- "statusYear": "hidden",
- "statusMonth": "short",
- "statusDay": "numeric",
- "statusHourCycle": "h23",
- "statusTimeFormat": "h:m",
- "enableGlobalContextStore": false
- },
- {
- "id": "5",
- "type": "server",
- "name": "Home Assistant",
- "version": 1,
- "addon": true,
- "rejectUnauthorizedCerts": true,
- "ha_boolean": "y|yes|true|on|home|open",
- "connectionDelay": true,
- "cacheJson": true
- }
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement