Announcement

Collapse
No announcement yet.

Help Please. How to change line in Device String?

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

  • Help Please. How to change line in Device String?

    I have made a script that collects data from wireless thermometers and have a problem with how to present the Data in the String.
    What I want is to present it under each other. Not after each other in the Virtual Device.
    I really like Jon00 OneWire plugin and I try to make it look the same for my wireless thermometers. Thanks Jon00
    So far I try vb.newline and CrLf. I also tried to add space between but without luck. None of it workt.

    My Code is.
    Code:
    hs.SetDeviceString(522, " " & "Temperature: " & Bedroom & " C Bedroom" & " Average: " _
       & Average & " C Min: " & Min  & " C Max: " & Max & " C Min (24Hr): " & MinH24 & " C Max (24Hr): " & MaxH24 & " C", True)
    This is how the virtual device looks. And I would like to place the Avaerage on a new line.
    Code:
    Temperature: 22,1 C Bedroom Average: 22,1 C Min: 21,4 C Max: 22,4 C Min (24Hr): 21,9 C Max (24Hr): 22,2 C
    This is how I want it to look like.
    Code:
    Temperature: 23.94C Lower Bathroom
    Average: 24.02C 
    Min: 23.38C  Max: 24.50C 
    Min (24Hr): 23.81C  Max (24Hr): 24.25C
    thanks in advance
    Martin

  • #2
    Try Chr(13) or Chr(13) & Chr(10)
    DSteiNeuro

    HS3Pro

    MSI Cubi Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz, 2201 Mhz, 2 Core(s), 4 Logical Processor(s) 16GB DDRl RAM

    Enabled Plug-Ins
    BLRussound, BLSpeech, HSTouch Server, JowiHue, MyQ, Nest, Rain8, Squeezebox, Ultra1Wire3, UltraGCIR3, Vista Alarm, X10,Z-Wave

    Comment


    • #3
      You may try using the html code <BR> in place of the crlf. Haven't tried it myself, just a thought.

      Comment


      • #4
        Yes, "<br> " will work, and will also work if you show your device string in HSTouch.

        (HSTouch will not consider formatting your string as a table with cells using <tr> and <td>, wich was usable for device string in HS's GUI)
        Visit zee e-maison : http://www.e-maison.com

        Comment


        • #5
          Thank you all for helping out. Very much appreciated.
          & "<br>" & Did the trick! I had never thought of it.

          Best regards
          Martin

          Comment


          • #6
            Great!
            Would you mind posting your code?
            I want to do something very similar and this would give me an easy start.
            Thanks,
            DSteiNeuro
            DSteiNeuro

            HS3Pro

            MSI Cubi Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz, 2201 Mhz, 2 Core(s), 4 Logical Processor(s) 16GB DDRl RAM

            Enabled Plug-Ins
            BLRussound, BLSpeech, HSTouch Server, JowiHue, MyQ, Nest, Rain8, Squeezebox, Ultra1Wire3, UltraGCIR3, Vista Alarm, X10,Z-Wave

            Comment


            • #7
              I do not mind at all posting the code. I also started to modify someone else's code.

              Code:
              Imports System.IO 
              
              ''Heavily modified from Rob Mason's ZeeTemperature.vb - Thanks Rob!
              ''ZeeTemperature.vb - Rob Mason - 10/23/2013 - Free to use/modify. 
              ''
              ''This script reads from a .csv file which the degrees format XX.XX 
              ''It rounds this upward to XX.X before showing it. Example 24.45 shows 24.5
              
              
              Sub Main(parm as object) 
              
                 dim sr as StreamReader 
                 dim wxdata as String 
                 dim lin as String 
                 dim SplitStr() As String
              
                 Try 
              	sr = new StreamReader("D:\Log_Files\LogTemp\last.csv") 'directory for text file.
              	wxdata = sr.ReadToEnd	'read the entire file.
              
              	lin = Split(wxdata, VBCrLf)(1) 'read the second line of text.
              	SplitStr = Split(lin, ",") 'grab each value between the commas.
              
              'Bedroom
              
                 dim before As Double = SplitStr(2)/100  '3rd value, and make it even.
                 dim before1 As Double = SplitStr(5)/100 '5th value, and make it even.
                 dim before2 As Double = SplitStr(6)/100
                 dim before3 As Double = SplitStr(7)/100
                 dim before4 As Double = SplitStr(8)/100
                 dim before5 As Double = SplitStr(9)/100
              
                 dim Bedroom As Double = Math.Round(before, 1, MidpointRounding.ToEven) '1st value rounded upwards.
                 dim Average As Double = Math.Round(before1, 1, MidpointRounding.ToEven) '2nd value rounded upwards.
                 dim MinH24 As Double = Math.Round(before2, 1, MidpointRounding.ToEven)
                 dim MaxH24 As Double = Math.Round(before3, 1, MidpointRounding.ToEven)
                 dim Min As Double = Math.Round(before4, 1, MidpointRounding.ToEven)
                 dim Max As Double = Math.Round(before5, 1, MidpointRounding.ToEven)
              
              
              'This set device string.
              
              	hs.SetDeviceString(522, " " & "Temperature: " & Bedroom & " C Bedroom" _
              	& "<br>" & " Average: " & Average & "C" &" <br>" & "Min: " & Min & "C Max: " & Max & "C" _
                      & "<br>" & "Min (24Hr): " & MinH24 & "C Max (24Hr): " & MaxH24 & "C", True)   
              
              'this set device value
              
              	hs.SetDeviceValueByRef(522, Bedroom, True)
               
              
              'this writes to log.
              
              '	hs.writelog("Event", "Temperature Bedroom " & Bedroom & "C", True)
              
              
                 Catch ex as Exception 
                    hs.WriteLog("WD",ex.Message) 
                 Finally 
                    if(not sr is Nothing) then sr.close() 
                 End Try 
              End Sub
              / Martin

              Comment

              Working...
              X