Announcement

Collapse
No announcement yet.

convert temperature

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Roger D
    replied
    Greetings sirbooker,

    I do not know if this applies to your situation but some devices can be switched from reporting in one scale to another.

    The following parameter is from an Aeotec water sensor...

    Click image for larger version

Name:	Screenshot_2021-10-21_21-54-04.png
Views:	53
Size:	12.4 KB
ID:	1503470

    Roger D

    Leave a comment:


  • ewkearns
    replied
    When it "doesn't work," what happens?

    Leave a comment:


  • jon00
    replied
    I did a test and the first immediate script command seems to work fine here. Remember that it only sets the device value so may not show up on the device status.

    You can do something like this as an immediate script command to show the status. It's a bit long so a short script may be better:

    Code:
    &hs.SetDeviceString(6795,(hs.DeviceValueEx(3434)*9/5)+32 & "°F",True) : hs.SetDeviceValueByRef(6795,(hs.DeviceValueEx(3434)*9/5)+32,True)

    Leave a comment:


  • Uncle Michael
    replied
    I think you will either need to use a short script or the Easy Trigger plug-in. I haven't tested it, but his might do what you want:

    Code:
    Sub Main(ByVal Params As Object)
    Dim dblTemp as Double = (hs.DeviceValueEx(3434)*9/5)+32
    hs.SetDeviceValueByRef(6795, dblTemp, True)
    End Sub

    Leave a comment:


  • sirbooker
    started a topic convert temperature

    convert temperature

    how does one convert from C to F and also from F to C
    I did a search and came up with this but it does not work.
    &hs.SetDeviceValueByRef(6795,((hs.DeviceValueEx(3434)*9/5)+32),True)
    and
    &nhs.SetDeviceValueByRef(6795,((hs.DeviceValueEx(3434)*9/5)+32),True)

    thanks in advance
    Paul.
Working...
X