123
Senior Member
Temperature Sensors and Appliances fail to prominently display their status. You have to click a TemperatureSensor icon to view its temperature reading. How much more convenient it'd be if the reading was displayed under the icon.
Here's how to fix it:
Temperature readings will now be displayed below the sensor's icon (see the attached image).
Here's how to fix it:
- In Premise Builder, click Modules in the Shortcut Bar.
- Navigate to: Modules > Plugins > Selectors > ClimateControl > TemperatureSensor
- Right-click TemperatureSensor and select: New > StatusScript
- Call the script: ShowStatus
- In the Properties window, find TargetProperty and click its Browse button ("...").
- In the Select Property dialog box, select: Schema > Device > TemperatureSensor > Temperature
- Click in the Editor pane, copy and paste the following script code and then press F12 to commit the modifications to the Premise Server.
Code:
dim oTempScale, sTemp, sTag, sHTML
set objectGrid = sys.GetObject("sys://Schema/Modules/Plugins/Components/RoomList")
' Determine the default temperature scale for this web session
set oTempScale = Sysevent.Clientsession.Temperature
with this.CurrentObject.Temperature
select case oTempScale.StandardName
case "F": sTemp = round(.Fahrenheit, 1)
case "C": sTemp = round(.Celsius, 1)
case "K": sTemp = round(.Kelvin, 1)
case "R": sTemp = round(.Rankine, 1)
end select
end with
' Format the temperature reading
if sTemp > -250 then
sTemp = sTemp & chr(176) & oTempScale.StandardName
else ' Probably an uninitialized value
sTemp = "None"
end if
set oTempScale = nothing
' Display the temperature reading
sTag = "DIV" ' For Grid view
if sysevent.ClientSession.DisplayMode = 1 then sTag = "SPAN" ' For List view
sHTML = " <" & sTag & " style=""color:" & GetHTMLColor(objectGrid.OnStateColor)
sHTML = sHTML & ";background-color:" & GetHTMLColor(objectGrid.OnStateBackgroundColor)
this.Output = sHTML & ";"">" & sTemp & "</" & sTag & ">"
Temperature readings will now be displayed below the sensor's icon (see the attached image).