How to set context variables containing spaces?

Would it not be better to change the friendly names so they don't contain special characters? Otherwise, if the device fails, you will have to change all your flows when you fit a new device, rather than just configuring the original friendly name in Zigbee2MQTT.

Not sure what the problem is. I use spaces in all my zigbee2MQTT friendly names and I haven't had any problems in over a year. All data goes via MQTT and they are used as a topic in many places in my flows.

They are also used as the device name in my device Objects (as in device['Smart Socket 01'] : {} ) [The IEEE address is used as the zigbee device ID which is part of the Object].

I think I did originally use _ (underscores) but did some trials and the spaces never gave me an issue. (famous last words - but..)

Yes, I didn't think of that. You're right!