I have an attribute (shared attribute) that is responsible for activating a water pump. According to my telemetry, I want this water pump to be activated, but I don't know if it's possible or how to do it.
The fist script is to verify the telemetry
return msg.humidity_01 < 29.97;
The second to change the attribute
metadata.pump_01 = true;
msgType = "POST_ATTRIBUTES_REQUEST";
return {msg: msg, metadata: metadata, msgType: msgType};
First of all, I think what you are doing in the image shown is not what you want, I understand that your shared attribute is called "pump_01" and your telemetry "humidity_01", you just want to update your attribute value to "true" if "humidity_01 < 29.97", you are trying to save telemetry and atribute from same node (your second script node), and you cant do that, you can only set one "msgType" to save timeseries or atributes.
Are you saving your telemetry data before entering this rulechain (before input node)? if not, just save your telemetry data before first script node (or before entering this rulechain).
To save your atribute as "true", you just have to set the msg of your sencond script as "msg.pump_01 = true;", then in your "save atribute" node, set shared attribute as type of attributes that you want to save.