Announcement

Collapse
No announcement yet.

Less than "<" working wrong way around -Solved!

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

    Less than "<" working wrong way around -Solved!

    I've a very starnge problem with a script I use to control my heating. The stragest thing is that this was working perfectly, but stopped working all of a sudden.

    Here is a part of my script causing me the problems



    start-----------------------
    'Get workshop desired temp
    workshop_therm = hs.devicestring ("t14")
    'get workshop current temp
    workshop_current = hs.devicestring ("w5")


    hs.WriteLog "workshop_current=",workshop_current
    hs.WriteLog "workshop_therm=",workshop_therm
    if workshop_current < workshop_therm then
    hs.WriteLog "workheat","in event to cold"
    'hs.WriteLog "workshop","fancoil on"
    boiler = "On"
    fancoil = "On"
    End if
    --------------------end

    In the event log I get the following

    21/01/2013 15:04:04 - workshop_current= - 4.5
    21/01/2013 15:04:04 - workshop_therm= - 21
    and it does not enter the event.

    If replace the "<" sign for a great ">" sign then the script enters the if loop.

    also if If change statement to be "if 4 < workshop_therm then" it also enters the loop.

    any ideas whats going on?

    #2
    Are you comparing strings or numbers? Try putting a CDbl() around the values before comparing. ie workshop_therm = CDbl(hs.devicestring ("t14")) Do this for both values.
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      Thanks Rupp that works! you star! hopefully my workshop will now warm up as 4.5c is bit chilly

      Comment

      Working...
      X