Close Curtains Depending on Sun Set and Sun Rise

Hi,

I need to create one automation that opens the curtains 30 minutes after sun rise, and closes them 30 minutes before sun set…

not sure if i need to use State, Sun, Time,… or any other triggers to do this. Any ideas?

Sun elevation (numeric state) if you want it based off light levels, otherwise just the sun trigger, which supports a time offset.

1 Like

Thanks for the reply. Yet, I prefer using the Sun trigger. But you see I am not sure if the time offset can be used for negative value, i.e. how can I set that trigger to be 30 minutes before sun set?

Please do read the sun trigger documentation.

I used the node-red addon for the majority of my automation. And I use the bigtimer node to accomplish this. I can share my yaml if anyone would like.

sure, yes please.

i will. :+1:

I meant json. you can import this into node red and it will paste the nodes into it. just need to install the bigtimer palette

[{"id":"021bb7423d9ec777","type":"api-call-service","z":"4c59561f4d9339e2","name":"Set Living Room Blinds","server":"cb9257b5.168488","version":5,"debugenabled":false,"domain":"cover","service":"set_cover_position","areaId":[],"deviceId":[],"entityId":["cover.dining_room_shade","cover.kitchen_left_shade","cover.kitchen_right_shade"],"data":"{ \"position\": shadepct }","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":300,"wires":[["aed1d27235c6c223"]]},{"id":"aed1d27235c6c223","type":"api-call-service","z":"4c59561f4d9339e2","name":"Set slider value","server":"cb9257b5.168488","version":5,"debugenabled":false,"domain":"input_number","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_number.living_room_blinds_percent"],"data":"{ \"value\": shadepct }","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":910,"y":300,"wires":[[]]},{"id":"197646ad35721cac","type":"server-state-changed","z":"4c59561f4d9339e2","name":"LR Slider","server":"cb9257b5.168488","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"input_number.living_room_blinds_percent","entityIdType":"exact","outputInitially":false,"stateType":"num","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"shadepct","propertyType":"msg","value":"","valueType":"entityState"}],"x":500,"y":260,"wires":[["021bb7423d9ec777"]]},{"id":"c8d750333582e511","type":"function","z":"4c59561f4d9339e2","name":"set shade pct","func":"if (msg.payload === \"shades_on\") {\n msg.shadepct = 100;\n return msg;\n}\nif (msg.payload === \"schedule_on\") {\n msg.shadepct = 80;\n return msg;\n}\nif (msg.payload === \"schedule_off\") {\n msg.shadepct = 0;\n return msg;\n}\nif (msg.payload === \"shades_off\") {\n msg.shadepct = 0;\n return msg;\n}\nif (msg.payload === \"shades_50\") {\n msg.shadepct = 50;\n return msg;\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":320,"wires":[["021bb7423d9ec777"]]},{"id":"1b2a4d11243341af","type":"bigtimer","z":"4c59561f4d9339e2","outtopic":"","outpayload1":"schedule_on","outpayload2":"schedule_off","name":"LR Shade Sched","comment":"","lat":"29.424163","lon":"-81.173480","starttime":"480","endtime":"5001","starttime2":0,"endtime2":0,"startoff":0,"endoff":"0","startoff2":0,"endoff2":0,"offs":0,"outtext1":"schedule_on","outtext2":"schedule_off","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":0,"month7":0,"day8":0,"month8":0,"day9":0,"month9":0,"day10":0,"month10":0,"day11":0,"month11":0,"day12":0,"month12":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xday7":0,"xmonth7":0,"xday8":0,"xmonth8":0,"xday9":0,"xmonth9":0,"xday10":0,"xmonth10":0,"xday11":0,"xmonth11":0,"xday12":0,"xmonth12":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"randon1":false,"randoff1":false,"randon2":false,"randoff2":false,"repeat":false,"atstart":false,"odd":false,"even":false,"x":260,"y":320,"wires":[["c8d750333582e511"],[],[]]},{"id":"cb9257b5.168488","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":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

I was also intending to add weather changes adjusting the blinds as well. but i needed to configure some nodes so the flow would know if the blind was manually adjusted, so it could ignore the weather changes the rest of the day.

Thanks for sharing. I will work on it. I see you made big effort on this. :+1:

1 Like