The global context ‘homeassistant’ is a copy of the HA state, pulled over by the Home Assistant WebSocket server. If you check the HA server configuration node, you will see an option Enable global context store. This is that option doing its stuff.
This context store is a read only copy of the HA state. It is used by the WebSocket nodes for such things as auto complete, and for picking up state values (I defer to Kermit who built this stuff as to what it actually does…)
Therefore, you can read from the context store any part of the HA state, including attributes.
The reverse (writing) is another matter.
Firstly, this is a copy of what is happening in HA. It is not HA. Changing the copy won’t change HA (and no, you can’t change this copy).
Secondly, any entity (and its attributes) belong to the integration that created them, and no you can’t just change an entity state or its attributes in HA just because you fancy doing so.
I have an air-conditioning unit. It has a sensor for the room temperature. My A/C integration has created an entity in HA for the a/c unit with an attribute for the room temperature. I can’t change that sensor attribute value. HA has that value as a sensor of something in the real world. Changing the value of my temperature sensor does not change the temperature in the real world.
The good news is that some integrations allow some values to be changed. For example, in air-conditioning there will be a target temperature, which is like a dial on the outside of the unit. My integration holds this value as an entity attribute, and the integration provides a service that I can call to change this value. Changing this value causes the integration to connect to my A/C and update the control settings.
If an entity has a state or attribute that can be changed, then there will be a service that allows you to call a service to change or set the value of that entity state or value.
If there is a service call, then you can find that service in HA in Developer Tools > Service Calls. The service calls for ‘climate.’ entities are under domain ‘climate’.
If you can find a service call to change your climate fan mode, then you can test it out in HA. Hint - there is a service call Climate: Set fan mode
If you can successfully make a service call in HA to change your fan mode, then you can do this in Node-RED.
In Node-RED, we use the WebSocket node for the Call Service. This allows for a selected service to be applied to a selected entity (or area or device) to perform a given task.
Here is a service call node, set for the climate: set_fan_mode, for my bedroom aircon.
The critical bit (which will be your next question) is the Data field - which has to be set to an object containing the various field values required by the integration. In this case - “fan_mode”: “low” or whatever your model / integration requires.
Documentation can be found at https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/call-service.html
It is, as is often the way, blindingly obvious when you know what is going on, otherwise it is a complete fog. I hope this helps you (and anyone else who later reads this stuff)!