I’ve tried to re-create the window blinds automation from HA and develop it further. I think I’ve managed to do it, though I notice I’m having a couple of stumbling blocks on the following topics:
- sun.sun just has above/below_horizon as states which don’t change often, the elevation is an attribute of it. So it seems like to keep track of the elevation attribute, the node has to keep sending updates instead of updating only on state changes. The switch node then routes according to elevation, and the within time node is just a filter. The issue I have is that the state changed node keeps updating every 5 minutes, which if conditions are met also sends an service call to the roller blinds every 5 minutes. They audibly click when that happens, I’m pretty sure they don’t like to be activated that often and if I decided to e.g. raise them then that decision would be overwritten every 5 minutes. Ideally, the flow would just listen to attribute changes and trigger the blinds ONCE to open in the morning once the appropriate elevation of =>-1 has been reached AND it’s 6:30 or later. Any way to do that?
- for “Kinderzimmer”, I’d like the blinds to close on the earlier of: it’s either 19:15 OR elevation hit <=-1, to have them down already when I bring the kid to bed even during summer when the sun is still high. Is that the best approach to do it?
Below the pasted flow
[
{
"id": "39b5fb135d663385",
"type": "tab",
"label": "Rolladen nochmal Steuerung",
"disabled": true,
"info": "",
"env": []
},
{
"id": "818a10db685a8a5f",
"type": "server-state-changed",
"z": "39b5fb135d663385",
"name": "",
"server": "%%ID%%",
"version": 4,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "sun.sun",
"entityidfiltertype": "exact",
"outputinitially": true,
"state_type": "str",
"haltifstate": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 1,
"output_only_on_state_change": false,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 140,
"y": 100,
"wires": [
[
"3b3d5727ef343925",
"ba2a9506dae14cbe"
]
]
},
{
"id": "3b3d5727ef343925",
"type": "change",
"z": "39b5fb135d663385",
"name": "set payload=elevation, global elevation&azimuth",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "data.new_state.attributes.elevation",
"tot": "msg"
},
{
"t": "set",
"p": "sun_elevation",
"pt": "global",
"to": "data.new_state.attributes.elevation",
"tot": "msg"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "sun_elevation",
"tot": "str"
},
{
"t": "set",
"p": "sun_azimuth",
"pt": "global",
"to": "data.new_state.attributes.azimuth",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 280,
"y": 160,
"wires": [
[
"2639a616310575ac",
"9dfe6030616e6252",
"8d38f49e3b1b0f1b"
]
]
},
{
"id": "2639a616310575ac",
"type": "switch",
"z": "39b5fb135d663385",
"name": "Switch Elevation uber -1/unter -1",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "gt",
"v": "-1",
"vt": "str"
},
{
"t": "lte",
"v": "-1",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 610,
"y": 160,
"wires": [
[
"9748c1a095bcded9"
],
[
"d736ccbd0b4b7682"
]
]
},
{
"id": "5d4df436eafec07f",
"type": "api-call-service",
"z": "39b5fb135d663385",
"name": "Rolladen Arbeitszimmer 50%",
"server": "%%ID%%",
"version": 5,
"debugenabled": true,
"domain": "cover",
"service": "set_cover_position",
"areaId": [
"arbeitszimmer"
],
"deviceId": [],
"entityId": [],
"data": "{\t \"position\": 50\t}",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1200,
"y": 40,
"wires": [
[]
]
},
{
"id": "ba2a9506dae14cbe",
"type": "debug",
"z": "39b5fb135d663385",
"name": "debug state",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "auto",
"x": 270,
"y": 40,
"wires": []
},
{
"id": "9dfe6030616e6252",
"type": "debug",
"z": "39b5fb135d663385",
"name": "debug change",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "auto",
"x": 480,
"y": 40,
"wires": []
},
{
"id": "9748c1a095bcded9",
"type": "within-time-switch",
"z": "39b5fb135d663385",
"name": "",
"nameInt": "",
"positionConfig": "97ae9e1db024e12e",
"startTime": "06:30",
"startTimeType": "entered",
"startOffset": 0,
"startOffsetType": "none",
"startOffsetMultiplier": 60000,
"endTime": "10:00",
"endTimeType": "entered",
"endOffset": 0,
"endOffsetType": "none",
"endOffsetMultiplier": 60000,
"timeRestrictions": 0,
"timeRestrictionsType": "none",
"timeDays": "*",
"timeOnlyOddDays": false,
"timeOnlyEvenDays": false,
"timeOnlyOddWeeks": false,
"timeOnlyEvenWeeks": false,
"timeMonths": "*",
"timedatestart": "",
"timedateend": "",
"propertyStart": "",
"propertyStartType": "none",
"propertyStartCompare": "true",
"propertyStartThreshold": "",
"propertyStartThresholdType": "num",
"startTimeAlt": "",
"startTimeAltType": "entered",
"startOffsetAlt": 0,
"startOffsetAltType": "none",
"startOffsetAltMultiplier": 60000,
"propertyEnd": "",
"propertyEndType": "none",
"propertyEndCompare": "true",
"propertyEndThreshold": "",
"propertyEndThresholdType": "num",
"endTimeAlt": "",
"endTimeAltType": "entered",
"endOffsetAlt": 0,
"endOffsetAltType": "none",
"endOffsetAltMultiplier": 60000,
"withinTimeValue": "true",
"withinTimeValueType": "msgInput",
"outOfTimeValue": "false",
"outOfTimeValueType": "msgInput",
"tsCompare": "0",
"x": 930,
"y": 140,
"wires": [
[
"5d4df436eafec07f",
"5dfa5ecef4e06ef2",
"e601792787fd137b",
"4d58ecf408f034f6"
],
[]
]
},
{
"id": "5dfa5ecef4e06ef2",
"type": "api-call-service",
"z": "39b5fb135d663385",
"name": "Rolladen EG 100%",
"server": "%%ID%%",
"version": 5,
"debugenabled": true,
"domain": "cover",
"service": "set_cover_position",
"areaId": [
"eg_flur",
"e3d3c755e91284326163e59a7f89e802",
"342801cdac81c5707dddadb74709eefe"
],
"deviceId": [],
"entityId": [],
"data": "{\t \"position\": 100\t}",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1170,
"y": 220,
"wires": [
[]
]
},
{
"id": "f948d39b05be3702",
"type": "api-call-service",
"z": "39b5fb135d663385",
"name": "Rolladen Arbeitszimmer 0%",
"server": "%%ID%%",
"version": 5,
"debugenabled": true,
"domain": "cover",
"service": "set_cover_position",
"areaId": [
"arbeitszimmer"
],
"deviceId": [],
"entityId": [],
"data": "{\t \"position\": 0\t}",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1200,
"y": 280,
"wires": [
[]
]
},
{
"id": "903f291b39a940ad",
"type": "api-call-service",
"z": "39b5fb135d663385",
"name": "Rolladen EG 0%",
"server": "%%ID%%",
"version": 5,
"debugenabled": true,
"domain": "cover",
"service": "set_cover_position",
"areaId": [
"eg_flur",
"e3d3c755e91284326163e59a7f89e802",
"342801cdac81c5707dddadb74709eefe"
],
"deviceId": [],
"entityId": [],
"data": "{\t \"position\": 0\t}",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1170,
"y": 460,
"wires": [
[]
]
},
{
"id": "e88cab911bd3b43c",
"type": "api-call-service",
"z": "39b5fb135d663385",
"name": "Rolladen Schlafzimmer 17%",
"server": "%%ID%%",
"version": 5,
"debugenabled": true,
"domain": "cover",
"service": "set_cover_position",
"areaId": [
"ada7bd3f57ccf98551832c59a049f30b"
],
"deviceId": [],
"entityId": [],
"data": "{\t \"position\": 17\t}",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1200,
"y": 340,
"wires": [
[]
]
},
{
"id": "e601792787fd137b",
"type": "api-call-service",
"z": "39b5fb135d663385",
"name": "Rolladen Schlafzimmer 100%",
"server": "%%ID%%",
"version": 5,
"debugenabled": true,
"domain": "cover",
"service": "set_cover_position",
"areaId": [
"ada7bd3f57ccf98551832c59a049f30b"
],
"deviceId": [],
"entityId": [],
"data": "{\t \"position\": 100\t}",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1210,
"y": 100,
"wires": [
[]
]
},
{
"id": "4d58ecf408f034f6",
"type": "api-call-service",
"z": "39b5fb135d663385",
"name": "Rolladen Kinderzimmer 100%",
"server": "%%ID%%",
"version": 5,
"debugenabled": true,
"domain": "cover",
"service": "set_cover_position",
"areaId": [
"kinderzimmer"
],
"deviceId": [],
"entityId": [],
"data": "{\t \"position\": 100\t}",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1210,
"y": 160,
"wires": [
[]
]
},
{
"id": "7f3bb860e97ae56e",
"type": "api-call-service",
"z": "39b5fb135d663385",
"name": "Rolladen Kinderzimmer 17%",
"server": "%%ID%%",
"version": 5,
"debugenabled": true,
"domain": "cover",
"service": "set_cover_position",
"areaId": [
"kinderzimmer"
],
"deviceId": [],
"entityId": [],
"data": "{\t \"position\": 17\t}",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1200,
"y": 400,
"wires": [
[]
]
},
{
"id": "8d38f49e3b1b0f1b",
"type": "within-time-switch",
"z": "39b5fb135d663385",
"name": "",
"nameInt": "",
"positionConfig": "97ae9e1db024e12e",
"startTime": "19:15",
"startTimeType": "entered",
"startOffset": 0,
"startOffsetType": "none",
"startOffsetMultiplier": 60000,
"endTime": "19:30",
"endTimeType": "entered",
"endOffset": 0,
"endOffsetType": "none",
"endOffsetMultiplier": 60000,
"timeRestrictions": 0,
"timeRestrictionsType": "none",
"timeDays": "*",
"timeOnlyOddDays": false,
"timeOnlyEvenDays": false,
"timeOnlyOddWeeks": false,
"timeOnlyEvenWeeks": false,
"timeMonths": "*",
"timedatestart": "",
"timedateend": "",
"propertyStart": "",
"propertyStartType": "none",
"propertyStartCompare": "true",
"propertyStartThreshold": "",
"propertyStartThresholdType": "num",
"startTimeAlt": "",
"startTimeAltType": "entered",
"startOffsetAlt": 0,
"startOffsetAltType": "none",
"startOffsetAltMultiplier": 60000,
"propertyEnd": "",
"propertyEndType": "none",
"propertyEndCompare": "true",
"propertyEndThreshold": "",
"propertyEndThresholdType": "num",
"endTimeAlt": "",
"endTimeAltType": "entered",
"endOffsetAlt": 0,
"endOffsetAltType": "none",
"endOffsetAltMultiplier": 60000,
"withinTimeValue": "true",
"withinTimeValueType": "msgInput",
"outOfTimeValue": "false",
"outOfTimeValueType": "msgInput",
"tsCompare": "0",
"x": 590,
"y": 300,
"wires": [
[
"f208945d395d6bf5"
],
[]
]
},
{
"id": "f208945d395d6bf5",
"type": "api-call-service",
"z": "39b5fb135d663385",
"name": "Rolladen Kinderzimmer 17%",
"server": "%%ID%%",
"version": 5,
"debugenabled": true,
"domain": "cover",
"service": "set_cover_position",
"areaId": [
"kinderzimmer"
],
"deviceId": [],
"entityId": [],
"data": "{\t \"position\": 17\t}",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 780,
"y": 440,
"wires": [
[]
]
},
{
"id": "d736ccbd0b4b7682",
"type": "within-time-switch",
"z": "39b5fb135d663385",
"name": "",
"nameInt": "",
"positionConfig": "97ae9e1db024e12e",
"startTime": "16:00",
"startTimeType": "entered",
"startOffset": 0,
"startOffsetType": "none",
"startOffsetMultiplier": 60000,
"endTime": "23:50",
"endTimeType": "entered",
"endOffset": 0,
"endOffsetType": "none",
"endOffsetMultiplier": 60000,
"timeRestrictions": 0,
"timeRestrictionsType": "none",
"timeDays": "*",
"timeOnlyOddDays": false,
"timeOnlyEvenDays": false,
"timeOnlyOddWeeks": false,
"timeOnlyEvenWeeks": false,
"timeMonths": "*",
"timedatestart": "",
"timedateend": "",
"propertyStart": "",
"propertyStartType": "none",
"propertyStartCompare": "true",
"propertyStartThreshold": "",
"propertyStartThresholdType": "num",
"startTimeAlt": "",
"startTimeAltType": "entered",
"startOffsetAlt": 0,
"startOffsetAltType": "none",
"startOffsetAltMultiplier": 60000,
"propertyEnd": "",
"propertyEndType": "none",
"propertyEndCompare": "true",
"propertyEndThreshold": "",
"propertyEndThresholdType": "num",
"endTimeAlt": "",
"endTimeAltType": "entered",
"endOffsetAlt": 0,
"endOffsetAltType": "none",
"endOffsetAltMultiplier": 60000,
"withinTimeValue": "true",
"withinTimeValueType": "msgInput",
"outOfTimeValue": "false",
"outOfTimeValueType": "msgInput",
"tsCompare": "0",
"x": 930,
"y": 260,
"wires": [
[
"f948d39b05be3702",
"e88cab911bd3b43c",
"7f3bb860e97ae56e",
"903f291b39a940ad"
],
[]
]
},
{
"id": "%%ID%%",
"type": "server",
"name": "Home Assistant",
"version": 2,
"addon": true,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true,
"heartbeat": false,
"heartbeatInterval": 30
},
{
"id": "97ae9e1db024e12e",
"type": "position-config",
"name": "",
"isValide": "true",
"longitude": "0",
"latitude": "0",
"angleType": "deg",
"timeZoneOffset": "99",
"timeZoneDST": "0",
"stateTimeFormat": "3",
"stateDateFormat": "12",
"contextStore": ""
}
]