Try this example flow
[{"id":"5dfa49af.8e191","type":"inject","z":"c28fcd8e.4dd2b","name":"device1 - on","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":118,"y":360,"wires":[["78a3fe6f.1a52d8","56683060.4a9a1"]]},{"id":"56683060.4a9a1","type":"switch","z":"c28fcd8e.4dd2b","name":"device1_state ?","property":"device1_state","propertyType":"flow","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":392,"y":480,"wires":[["a0c76c9f.589c3"],["264f939a.c8bdfc"]]},{"id":"a0c76c9f.589c3","type":"switch","z":"c28fcd8e.4dd2b","name":"device2_state ?","property":"device2_state","propertyType":"flow","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":584,"y":456,"wires":[["afa86581.9147d"],["68a594bd.066c24"]]},{"id":"373c972b.ab751","type":"inject","z":"c28fcd8e.4dd2b","name":"device1 - off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":118,"y":408,"wires":[["78a3fe6f.1a52d8","56683060.4a9a1"]]},{"id":"78a3fe6f.1a52d8","type":"change","z":"c28fcd8e.4dd2b","name":"","rules":[{"t":"set","p":"device1_state","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":412,"y":360,"wires":[[]]},{"id":"5a6e05d6.24d3ec","type":"inject","z":"c28fcd8e.4dd2b","name":"device2 - on","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":118,"y":552,"wires":[["d894a266.bfaa2","56683060.4a9a1"]]},{"id":"1efdeebb.f56f41","type":"inject","z":"c28fcd8e.4dd2b","name":"device2 - off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":118,"y":624,"wires":[["d894a266.bfaa2","56683060.4a9a1"]]},{"id":"d894a266.bfaa2","type":"change","z":"c28fcd8e.4dd2b","name":"","rules":[{"t":"set","p":"device2_state","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":388,"y":624,"wires":[[]]},{"id":"ba713890.7006a","type":"debug","z":"c28fcd8e.4dd2b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":951,"y":432,"wires":[],"l":false},{"id":"afa86581.9147d","type":"change","z":"c28fcd8e.4dd2b","name":"dev1 and dev2 on","rules":[{"t":"set","p":"payload","pt":"msg","to":"Both on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":786,"y":432,"wires":[["ba713890.7006a"]]},{"id":"264f939a.c8bdfc","type":"change","z":"c28fcd8e.4dd2b","name":"dev1 off","rules":[{"t":"set","p":"payload","pt":"msg","to":"dev 1 is off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":588,"y":504,"wires":[["b8a8c38.dca9ac"]]},{"id":"c5bbe1e5.5a24a8","type":"debug","z":"c28fcd8e.4dd2b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":951,"y":480,"wires":[],"l":false},{"id":"68a594bd.066c24","type":"change","z":"c28fcd8e.4dd2b","name":"dev1 = on, dev2 = off","rules":[{"t":"set","p":"payload","pt":"msg","to":"dev1 = on, dev2 = off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":796,"y":480,"wires":[["c5bbe1e5.5a24a8"]]},{"id":"b8a8c38.dca9ac","type":"debug","z":"c28fcd8e.4dd2b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":711,"y":528,"wires":[],"l":false},{"id":"975c1230.cac36","type":"change","z":"c28fcd8e.4dd2b","name":"","rules":[{"t":"set","p":"device1_state","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":207,"y":168,"wires":[[]],"l":false},{"id":"28a5ecd9.8f921c","type":"change","z":"c28fcd8e.4dd2b","name":"","rules":[{"t":"set","p":"device2_state","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":207,"y":216,"wires":[[]],"l":false},{"id":"a2d5a4eb.e27a1","type":"inject","z":"c28fcd8e.4dd2b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":109,"y":192,"wires":[["975c1230.cac36","28a5ecd9.8f921c"]],"l":false},{"id":"7aa780d2.581bd8","type":"comment","z":"c28fcd8e.4dd2b","name":"intialize variables - they need to exist before flow works","info":"","x":270,"y":120,"wires":[]}]
It is a very literal flow.