If my assumption was correct then your original if statements were incorrect. Here is the flow with a corrected version and a second flow showinng how you could do it without a function node.
[{"id":"15069f84.a068c8","type":"function","z":"94b68392.acdaf8","name":"","func":"// initilize flag to he contents of the flow variable\n// or as an empty string\nvar flag = flow.get('flag') || \"\";\n//node.warn(\"flag=\"+flag) //uncomment to see contents of 'flag'\n\n//initilize 'p' as an object\nvar p = {}; \n\n// set p.status to the value of msg.payload.status. This means it\n// msg.payload.status = {\"status\": \"OFF\"} then \n// p.status will be {\"status\": \"OFF\"}\np.status=msg.payload.status;\n\n// now set msg.payload to just the contents of p.status so all the \n// other parts of teh original paload object will be gone and \n// msg.payload will be {\"status\": \"OFF\"}\nmsg.payload=p;\n\n// Display the contents of p.status and msg.payload\n//node.warn(\"p.status=\"+JSON.stringify(p))\n//node.warn(\"msg.payload=\"+JSON.stringify(msg.payload))\n\n//test p.status (or you could test msg.payload.status)\nif (p.status == flag ) { \n node.warn(\"No change in status\") // show 'no change debug msg flow.set('flag',p.status); \n return // exit flow without returning anything\n \n} \nelse { // the status has changed, so update flow.flag\n // with the new statusu and return the msg\n flow.set('flag',p.status) \n} \n\n// return the msg\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":580,"wires":[["6a376694.7e5d5"]]},{"id":"6a376694.7e5d5","type":"debug","z":"94b68392.acdaf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":560,"y":580,"wires":[]},{"id":"40268cde.710c54","type":"inject","z":"94b68392.acdaf8","name":"ON","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"update_available\":true,\"status\":\"ON\",\"linkquality\":76,\"brightness\":254,\"color_temp\":254,\"color\":{\"x\":0.4599,\"y\":0.4106}}","payloadType":"json","x":140,"y":580,"wires":[["15069f84.a068c8","cd498fad.d0b9b"]]},{"id":"9f62723c.7523f8","type":"inject","z":"94b68392.acdaf8","name":"OFF","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"update_available\":true,\"status\":\"OFF\",\"linkquality\":76,\"brightness\":254,\"color_temp\":254,\"color\":{\"x\":0.4599,\"y\":0.4106}}","payloadType":"json","x":140,"y":640,"wires":[["15069f84.a068c8","cd498fad.d0b9b"]]},{"id":"cd498fad.d0b9b","type":"debug","z":"94b68392.acdaf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":360,"y":640,"wires":[]},{"id":"5f552c7d.0f0b04","type":"inject","z":"94b68392.acdaf8","name":"ON","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"update_available\":true,\"status\":\"ON\",\"linkquality\":76,\"brightness\":254,\"color_temp\":254,\"color\":{\"x\":0.4599,\"y\":0.4106}}","payloadType":"json","x":130,"y":740,"wires":[["d149731c.7b49f"]]},{"id":"f0e9018f.11f94","type":"inject","z":"94b68392.acdaf8","name":"OFF","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"update_available\":true,\"status\":\"OFF\",\"linkquality\":76,\"brightness\":254,\"color_temp\":254,\"color\":{\"x\":0.4599,\"y\":0.4106}}","payloadType":"json","x":130,"y":780,"wires":[["d149731c.7b49f"]]},{"id":"d149731c.7b49f","type":"switch","z":"94b68392.acdaf8","name":"Check Flag vrs status","property":"flag","propertyType":"flow","rules":[{"t":"null"},{"t":"neq","v":"payload.status","vt":"msg"},{"t":"else"}],"checkall":"false","repair":false,"outputs":3,"x":320,"y":760,"wires":[["b62adb39.0ae9a"],["b62adb39.0ae9a"],["acd6481b.a2c018"]]},{"id":"acd6481b.a2c018","type":"change","z":"94b68392.acdaf8","name":"build a debug message","rules":[{"t":"set","p":"payload","pt":"msg","to":"no change in status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":780,"wires":[["f09866c7.d4511"]]},{"id":"f09866c7.d4511","type":"debug","z":"94b68392.acdaf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":780,"wires":[]},{"id":"b62adb39.0ae9a","type":"change","z":"94b68392.acdaf8","name":"update flow.flag and msg.payload","rules":[{"t":"set","p":"flag","pt":"flow","to":"payload.status","tot":"msg"},{"t":"move","p":"payload.status","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":740,"wires":[["735e0ec3.9275e"]]},{"id":"735e0ec3.9275e","type":"debug","z":"94b68392.acdaf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":740,"wires":[]}]