I personally use node-red-contrib-schedex for simple scheduling flows. Here’s a sample flows that might work for you.
[{"id":"7893dbce.5b9644","type":"schedex","z":"2802ff38.60d4c","name":"","suspended":false,"lat":"","lon":"","ontime":"9:36","ontopic":"","onpayload":"turn_on","onoffset":0,"onrandomoffset":0,"offtime":"17:36","offtopic":"","offpayload":"turn_off","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":134,"y":736,"wires":[["b49a82af.c606b"]]},{"id":"520d475b.a19978","type":"api-call-service","z":"2802ff38.60d4c","name":"","server":"351c96ee.9dc3aa","service_domain":"homeassistant","service":"","data":"{\"entity_id\":\"kitchen.light\"}","render_data":false,"mergecontext":"","x":506,"y":736,"wires":[[]]},{"id":"9f290fad.61bbb","type":"schedex","z":"2802ff38.60d4c","name":"","suspended":false,"lat":"","lon":"","ontime":"sunrise","ontopic":"","onpayload":"turn_on","onoffset":0,"onrandomoffset":0,"offtime":"sunset","offtopic":"","offpayload":"turn_off","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":144,"y":784,"wires":[["b49a82af.c606b"]]},{"id":"b49a82af.c606b","type":"template","z":"2802ff38.60d4c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"service\": \"{{payload}}\"}","output":"str","x":336,"y":736,"wires":[["520d475b.a19978"]]}]
Setting the On Payload
and Off Payload
to turn_on
/turn_off
combined with the template node allows you to dynamically tell the call-service node to either turn on/off