Edit: Find the completed Cover Control here
Hi all,
I created this
[
{
"id": "f33a51af.7993c8",
"type": "tab",
"label": "Rollos mit der Sonne",
"disabled": false,
"info": ""
},
{
"id": "461906f9.0db388",
"type": "api-call-service",
"z": "f33a51af.7993c8",
"name": "Rollos rauf",
"server": "7e24b1f3.1fe48",
"version": 1,
"service_domain": "cover",
"service": "open_cover",
"entityId": "cover.somecover, cover.somecover, cover.somecover",
"data": "",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 690.5,
"y": 129.99999237060547,
"wires": [
[
"8084afa0.386248"
]
]
},
{
"id": "710655f9.dacd1c",
"type": "server-state-changed",
"z": "f33a51af.7993c8",
"name": "Sonnenstand",
"server": "7e24b1f3.1fe48",
"version": 1,
"entityidfilter": "sensor.sonnenstand",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 1,
"output_only_on_state_change": true,
"x": 104.36666870117188,
"y": 319.83331298828125,
"wires": [
[
"f1d5d3.2bf3f23"
]
]
},
{
"id": "f1d5d3.2bf3f23",
"type": "switch",
"z": "f33a51af.7993c8",
"name": "Ăśber / unter Horizont",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "-2.5",
"vt": "str"
},
{
"t": "eq",
"v": "-3",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 310.36663818359375,
"y": 318.75,
"wires": [
[
"3e4872cd.16a68e"
],
[
"70bfc34b.95ccdc"
]
]
},
{
"id": "87145822.2832a",
"type": "api-call-service",
"z": "f33a51af.7993c8",
"name": "Rollos runter",
"server": "7e24b1f3.1fe48",
"version": 1,
"service_domain": "cover",
"service": "close_cover",
"entityId": "cover.somecover, cover.somecover, cover.somecover, cover.somecover",
"data": "",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 703.3666381835938,
"y": 423.33331298828125,
"wires": [
[
"ee169274.754238"
]
]
},
{
"id": "693f7a2e.9011e4",
"type": "api-call-service",
"z": "f33a51af.7993c8",
"name": "Treppe auf 20%",
"server": "7e24b1f3.1fe48",
"version": 1,
"service_domain": "cover",
"service": "set_cover_position",
"entityId": "cover.treppe",
"data": "{\"position\":\"35\"}",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 700.3666381835938,
"y": 198.33334350585938,
"wires": [
[
"bed7afd4.dfe448"
]
]
},
{
"id": "8084afa0.386248",
"type": "debug",
"z": "f33a51af.7993c8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 883.1666412353516,
"y": 128.8333282470703,
"wires": []
},
{
"id": "bed7afd4.dfe448",
"type": "debug",
"z": "f33a51af.7993c8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 889.1666259765625,
"y": 200.83334350585938,
"wires": []
},
{
"id": "ee169274.754238",
"type": "debug",
"z": "f33a51af.7993c8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 881.1666412353516,
"y": 426.8333282470703,
"wires": []
},
{
"id": "3e4872cd.16a68e",
"type": "time-range-switch",
"z": "f33a51af.7993c8",
"name": "Morgens",
"lat": "xx.xxxx",
"lon": "y.yyyy",
"startTime": "04:30",
"endTime": "11:00",
"startOffset": 0,
"endOffset": 0,
"x": 488.5,
"y": 176,
"wires": [
[
"461906f9.0db388",
"693f7a2e.9011e4"
],
[]
]
},
{
"id": "70bfc34b.95ccdc",
"type": "time-range-switch",
"z": "f33a51af.7993c8",
"name": "Abends",
"lat": "xxxxx",
"lon": "yyyy",
"startTime": "16:00",
"endTime": "23:00",
"startOffset": 0,
"endOffset": 0,
"x": 497,
"y": 423,
"wires": [
[
"87145822.2832a"
],
[]
]
},
{
"id": "7e24b1f3.1fe48",
"type": "server",
"z": "",
"name": "Home Assistant",
"legacy": false,
"hassio": true,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true
}
]
It was working fine as long I was using above_horizon and beyond_horizon as an trigger. But as they did not match my needs, I decided to use sun elevation leverl and created an sensor in HA where I put that state:
- platform: template
sensors:
sonnenstand:
friendly_name: "Sonnenstand"
unit_of_measurement: '°'
value_template: "{{ state_attr('sun.sun', 'elevation') }}"
The sensor seems to be working fine, however the automation never gets triggered. Now I have an idea why already: The sensor is only updated in intervals (I think because sun is only updated in intervals?) and therefore the sensor does not get each value (i.e. -2.8, -2.7, -2.6…) but only the value thats there when the update interval hits. So it happens that my sensor never gets set to the value I chose to trigger…
Any suggestions how to mitigate this? I thought of putting a < -2.5 instead of = -2.5 (like in an example here https://www.home-assistant.io/cookbook/automation_sun/). but then again this would be triggered on every update in the morning or evening that is below that value.
Next was that I thought that again could be mitigated by creating an input_boolean, that is switched on on the first occasion and switched off later (i.e. after the tim ranges I defined for morning / evening) and run the tasks only when the switch is off. That would work I think but seems like an overkill to me.
Any input is welcome