OK try this flow
[{"id":"41fafddd.381444","type":"comment","z":"56d3c1c6.0d901","name":"Door Open","info":"Send to the Ligth Node to switch on","x":920,"y":600,"wires":[]},{"id":"4f75983f.a459c8","type":"comment","z":"56d3c1c6.0d901","name":"Door Closed - Switch off light - Change Colour","info":"Turn the light off","x":1030,"y":760,"wires":[]},{"id":"e6cb300a.a589f","type":"inject","z":"56d3c1c6.0d901","name":"Door Open","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"On","payloadType":"str","x":160,"y":500,"wires":[["4c5be29d.2f8a0c"]]},{"id":"279cd515.c5d3ba","type":"change","z":"56d3c1c6.0d901","name":"Set COntext for Door to Open","rules":[{"t":"set","p":"DoorState","pt":"flow","to":"Open","tot":"str"},{"t":"set","p":"LightColour","pt":"flow","to":"LightColour","tot":"msg"},{"t":"set","p":"LightColour","pt":"msg","to":"Red","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":640,"wires":[["9de4da00.350d58"]]},{"id":"4c5be29d.2f8a0c","type":"mytimeout","z":"56d3c1c6.0d901","name":"Check for Door Open too long","outtopic":"","outsafe":"Open","outwarning":"","outunsafe":"OpenTooLong","warning":"-","timer":"300","debug":false,"ndebug":false,"ignoreCase":true,"repeat":false,"again":false,"x":390,"y":500,"wires":[["632e19a9.3651d8"],[]]},{"id":"a486dfec.e2fde","type":"inject","z":"56d3c1c6.0d901","name":"Door Closed","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Cancel","payloadType":"str","x":150,"y":560,"wires":[["4c5be29d.2f8a0c","632e19a9.3651d8"]]},{"id":"632e19a9.3651d8","type":"switch","z":"56d3c1c6.0d901","name":"Monitor Door State","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Open","vt":"str"},{"t":"eq","v":"Cancel","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":370,"y":680,"wires":[["279cd515.c5d3ba"],["74665c94.85bf04"]]},{"id":"74665c94.85bf04","type":"change","z":"56d3c1c6.0d901","name":"Set COntext for Door to Closed","rules":[{"t":"set","p":"DoorState","pt":"flow","to":"Closed","tot":"str"},{"t":"set","p":"LightColour","pt":"msg","to":"LightColour","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":720,"wires":[["cb7daab.ea53558"]]},{"id":"cb7daab.ea53558","type":"debug","z":"56d3c1c6.0d901","name":"Door CLosed Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":960,"y":720,"wires":[]},{"id":"9de4da00.350d58","type":"debug","z":"56d3c1c6.0d901","name":"Door Open","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":640,"wires":[]}]
I have used a Contrib node - My Timeout by Neil Cherry - you will need to download and install this
I have assumed the following
-
Your incoming message from the Light Websocket will have information about the Colour and State of the switch - you can see the values i have used - you can adjust those values accordingly
-
I have used debug nodes as output - you will need to include the Websocket nodes to communicate your light state and colour - again this will need to be adjusted as appropriate.
Craig