Turn on light two times a day

ok this is maybe simple and I have got it to work if I just want to turn on/off light one times a day.

To turn on/off the light I use a big timer, a switch and on and off of the lamp I want to turn on and off.

But now I want with same lamp turn on Another time on the works day and not sure how to do that.
I did try with two big time but I guess it does not like it when one is on and one is off.

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

4 Likes

ohh thanks.
Going to try that and see if it works like I want it to works

install node-red-contrib-light-scheduler. Here’s an example that turns on/off light from 7-9am and 10am-12pm, MWF:

1 Like

Nice, looking in to that too.

@Kermit
so I need to use node-red for the time of day? Maybe this is why it will not work? It does not know AM from PM.

I’m not able to wrapped my head around this, can you explain like I’m 5?

2 Likes