Announcement

Collapse
No announcement yet.

Problem with a count line

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

  • #16
    if i execute the script normal , and add my device codes in there
    there is case , 0,1,11,9, else

    Normal my devices are on 0=standby and 11=disabled

    i get this the normal log and works

    Code:
    Aug-02 16:23:19	 	TTS	Speak ():no Errors found
    Aug-02 16:23:19	 	TTS	Speak ():And 2 Sensors Disabled
    Aug-02 16:23:19	 	TTS	Speak ():There are 1 Sensors Enabled
    Aug-02 16:23:19	 	Array	Errors: 0
    Aug-02 16:23:19	 	Array	disabled pir's: 2
    Aug-02 16:23:19	 	Array	enabled pir's: 1
    Aug-02 16:23:19	 	TTS	Speak ():Motion sensor 3 at the Livingroom is Disabled
    Aug-02 16:23:19	 	TTS	Speak ():Motion sensor 2 at the Garage is standby
    Aug-02 16:23:19	 	TTS	Speak ():Motion sensor 1 at the Garden is Disabled


    if i change 1 device code to an device that has a value of 75 and run the script , i get this log

    so it triggers normal the speach , but no the array log and the other speech what needs to come after...

    PHP Code:
    Aug-02 16:22:22         TTS    Speak ():Motion sensor 3 at the Livingroom is Disabled
    Aug
    -02 16:22:22         TTS    Speak ():Motion sensor 1 Battery at the Garden has an error
    Aug
    -02 16:22:22         TTS    Speak ():Motion sensor 1 at the Garden is Disabled 
    Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
    Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




    HS3Pro 3.0.0.531 on windows 7 ultimate X64 on hp quadcore laptop 8 GB.

    Comment


    • #17
      I'll bet if you uncomment the LOG COUNTS, that will tell you if it's the IF statements that are not firing, or it's not actually getting to them.

      Change your If's to:

      If pirEnabled_count > 0 Then
      hs.writelog("Array", "enabled pir's: " & pirenabled_count)
      End If
      If pirdisabled_count > 0 Then
      hs.writelog("Array", "disabled pir's: " & pirdisabled_count)
      End If
      If error_count = 0 Then
      hs.writelog("Array", "Errors: " & error_count)
      End If

      Z

      Comment


      • #18
        this is very strange , you solved my problem !!

        why is the problem End If

        so what does it matter if i put the End If somewhere else..
        really weird

        but many thanks for your time, and sorry for disturbing

        many thanks!

        Originally posted by vasrc View Post
        I'll bet if you uncomment the LOG COUNTS, that will tell you if it's the IF statements that are not firing, or it's not actually getting to them.

        Change your If's to:

        If pirEnabled_count > 0 Then
        hs.writelog("Array", "enabled pir's: " & pirenabled_count)
        End If
        If pirdisabled_count > 0 Then
        hs.writelog("Array", "disabled pir's: " & pirdisabled_count)
        End If
        If error_count = 0 Then
        hs.writelog("Array", "Errors: " & error_count)
        End If

        Z
        Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
        Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




        HS3Pro 3.0.0.531 on windows 7 ultimate X64 on hp quadcore laptop 8 GB.

        Comment


        • #19
          End If tells each "IF, Else IF or Else when to stop looking. If you don't stop it, it may not process the "IF" below it because the initial IF was true..

          Z

          Comment


          • #20
            ok , i remind it now

            yes its new for me because i started scripting a few weeks ago
            now i learned a new thing.

            many thanks!!

            Originally posted by vasrc View Post
            End If tells each "IF, Else IF or Else when to stop looking. If you don't stop it, it may not process the "IF" below it because the initial IF was true..

            Z
            Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
            Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




            HS3Pro 3.0.0.531 on windows 7 ultimate X64 on hp quadcore laptop 8 GB.

            Comment


            • #21
              As an FYI, if you only have one line for each IF, then you can simplify to:

              Code:
              If pirEnabled_count > 0 Then hs.writelog("Array", "enabled pir's: " & pirenabled_count)
              If pirdisabled_count > 0 Then hs.writelog("Array", "disabled pir's: " & pirdisabled_count)
              If error_count = 0 Then hs.writelog("Array", "Errors: " & error_count)
              Each line is considered a complete If/END IF statement even though the END IF is not there.

              Cheers
              Al
              HS 3.0.0.532: 1963 Devices 1141 Events
              Z-Wave 3.0.1.261: 122 Nodes on one Z-Net

              Comment


              • #22
                Try using indentation and spacing to help "see" your code better. If you had done this with your original code it would have looked like this:

                PHP Code:
                If pirEnabled_count 0 Then 
                   hs
                .writelog("Array""enabled pir's: " pirenabled_count)

                   If 
                pirdisabled_count 0 Then 
                        hs
                .writelog("Array""disabled pir's: " pirdisabled_count)

                        If 
                error_count 0 Then 
                            hs
                .writelog("Array""Errors: " error_count)
                        Else 
                            
                        
                End If 
                    
                End If
                 
                End if 
                You can now see why it might not get to the internal IF statements.

                Z
                Last edited by vasrc; August 2nd, 2016, 12:51 PM. Reason: Fixed BB formatting :)

                Comment


                • #23
                  Hi AL

                  yeah already tried that but doesnt trigger the counts also...

                  Originally posted by sparkman View Post
                  As an FYI, if you only have one line for each IF, then you can simplify to:

                  Code:
                  If pirEnabled_count > 0 Then hs.writelog("Array", "enabled pir's: " & pirenabled_count)
                  If pirdisabled_count > 0 Then hs.writelog("Array", "disabled pir's: " & pirdisabled_count)
                  If error_count = 0 Then hs.writelog("Array", "Errors: " & error_count)
                  Each line is considered a complete If/END IF statement even though the END IF is not there.

                  Cheers
                  Al
                  hi vasrc

                  i did this and its working also , its clear visable for me

                  PHP Code:
                  '======================================SPEECH COUNTS==========================================================
                              If pirEnabled_count > 0 Then 
                              hs.speak ("There are  " & pirenabled_count & " Sensors Enabled ")
                              End If
                              If pirdisabled_count > 0 Then 
                              hs.speak ("And " & pirdisabled_count & " Sensors Disabled ")
                              End If
                              If error_count = 0 Then 
                              hs.speak ("no Errors found")
                              End If
                              If error_count > 0 Then 
                              hs.speak ("And " & error_count & " Errors")
                              End If
                  '
                  ===================================SPEECH CLIENT SELECT====================================================== 
                  Originally posted by vasrc View Post
                  Try using indentation and spacing to help "see" your code better. If you had done this with your original code it would have looked like this:

                  PHP Code:
                  If pirEnabled_count 0 Then 
                     hs
                  .writelog("Array""enabled pir's: " pirenabled_count)

                     If 
                  pirdisabled_count 0 Then 
                          hs
                  .writelog("Array""disabled pir's: " pirdisabled_count)

                          If 
                  error_count 0 Then 
                              hs
                  .writelog("Array""Errors: " error_count)
                          Else 
                              
                          
                  End If 
                      
                  End If
                   
                  End if 
                  You can now see why it might not get to the internal IF statements.

                  Z
                  Last edited by Malosa; August 3rd, 2016, 02:39 AM.
                  Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
                  Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




                  HS3Pro 3.0.0.531 on windows 7 ultimate X64 on hp quadcore laptop 8 GB.

                  Comment

                  Working...
                  X