Your function needs to listen for msg and and then convert msg.payload by dividing by 100.
The scope.$watch()
example in the help text is what you want.
e.g.
<script>
(function(scope) {
const gaugeElement = document.querySelector(".gauge");
function setGaugeValue(gauge, value) {
if (value < 0 || value> 1) {
return;
}
gauge.querySelector(".gauge__fill").style.transform = `rotate(${
value / 2
}turn)`;
gauge.querySelector(".gauge__cover").textContent = `${Math.round(
value * 100
)}%`;
}
// Set initial value of the gauge to 0.3
setGaugeValue(gaugeElement, 0.3);
// Listen for incoming messages from Node-RED
// and update the gauge value accordingly
scope.$watch('msg', function(msg) {
if (msg.payload) {
// Do something when msg arrives
setGaugeValue(gaugeElement, msg.payload/100);
}
})
})(scope);
</script>