0
Answered

Change Display Value

Paolo Scarpetta 8 years ago in Server Solutions / Windows Server updated by Oksana (expert) 8 years ago 3

I got a termostat that give the variable value like (ex. 243) instead of 24,3, so when I try to display this value with $VºC It shows "243 ºC" instead 24,3 ºC, How can I fix this?

I use a Iridium Server with Iridium client.


+1

Hi

http://dev.iridiummobile.net/Systems_API/en#IR.SubscribeTagChange


This is one way you can do it:


1. Create a new feedback in the server for the adjusted value, synch to the client. you can add this feedback tothe driver, or create a server tag. In the example below I have assume the new feedback is added to the driver

2. In JS Add subscription to the Tag of the variable and correct the value.

3. set the new feedback to that value

4. In the client, use the new feedback in the gui

//Set global listener
IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(name, value)
{
     IR.Log("Global Listener Activated: " + name + "\tValue: " + value);
     if (name == "MyDriverName.MyThermostatFeedbackName"){                                                          
        //update adjusted feedback
        //2
        var newValue = value * 0.1; 
        //3
          IR.SetVariable("MyDriverName.Temperature_Adjusted", newValue);
        }
}); 


//1
IR.SubscribeTagChange("Drivers.MyDriverName.MyThermostatFeedbackName");