Announcement

Collapse
No announcement yet.

Simple API not updating HS

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

  • Simple API not updating HS

    I'm trying to read a voltage into HS. The sketch is working correctly (I'm calculating and displaying the voltage on a 16x2 LCD).

    I have the following line of code in the ADI sketch, after the "if is connected..
    SendToHS(1,Voltage);

    Here is the log -
    Jan-15 1:33:45 PM Arduino Plugin Updating Values on Board No: 2
    Jan-15 1:33:45 PM Arduino Plugin Updating pins on Board No: 2
    Jan-15 1:33:45 PM Arduino Plugin Connected to Board No:2 on COM13
    Jan-15 1:33:44 PM Arduino Plugin Board 2 Version API1.0.0.118 and Plugin Version 1.0.0.131 are compatible.
    Jan-15 1:33:41 PM Arduino Plugin Resetting Board No 2
    -------
    What am I missing?
    Barry
    Attached Files

  • #2
    I read voltage with no problem.
    Could be a good idea to put on forum your sketch...
    This is a part of mine:

    Code:
      if (millis() - tempoPrecedente1 > 5100) {
        tempoPrecedente1 = millis();
        sens_batteria_UPS = (analogRead(A1) / 56.39);
        if (sens_batteria_UPS != sens_batteria_UPS_old) {
          SendToHS(4, sens_batteria_UPS);
          sens_batteria_UPS_old = sens_batteria_UPS;
        }
      }
    
      if (millis() - tempoPrecedente2 > 5200) {
        tempoPrecedente2 = millis();
        sens_luminosita_rep_giorno = (analogRead(A2) * 100 / 1023 * 4);
        if (sens_luminosita_rep_giorno != sens_luminosita_rep_giorno_old) {
          SendToHS(5, sens_luminosita_rep_giorno);
          sens_luminosita_rep_giorno_old = sens_luminosita_rep_giorno;
        }
      }
    Obviously you need to declare variables etc....

    Comment


    • #3
      Sorry I wasn't clear. The HS device Board2 API Input1 never changes.

      Here is some of the code I added to the API -

      int potPin=A2; //Define pin
      int readValue; //Value on pin
      long Voltage; //Converted value
      //End added code

      pinMode (potPin,INPUT); //start pot read
      LCD.begin(16,2); //Start 16x2
      LCD.setCursor(0,0);
      LCD.print("Temp: Volts"); //Print message on first row

      readValue = analogRead(potPin); //get value
      Voltage = (5./1023.)*readValue; //convert
      LCD.setCursor(0,1);
      LCD.print(" "); //blank line
      LCD.setCursor(0,1);
      LCD.print(sensors.getTempFByIndex(0));
      LCD.print(" F");
      LCD.setCursor(10,1); //move cursor for volts
      LCD.print(Voltage); //print voltage.



      if (IsConnected == true) {
      /*Execute ONLY when HomeSeer is connected*/
      SendToHS(1,Voltage);
      }
      --------------------------------------------
      The LCD correctly displays Voltage, so I know it is changing.

      Do I need to do something in HS to force it to up the value?

      Barry

      Comment


      • #4
        I think your problem is that you are flooding the plugin with data as you are sending to Homeseer with SendToHS() as you are sending it on every loop of the code and that is a lot of data to handle. What you need to do is set up a delay to only send to Homeseer every x seconds or as per the code below store the last sent value and only send it to Homeseer if it is different.

        Code:
        int potPin=A2; //Define pin
        int readValue; //Value on pin
        long Voltage; //Converted value
        long LastHSVoltage;
        //End added code
        
        pinMode (potPin,INPUT); //start pot read
        LCD.begin(16,2); //Start 16x2
        LCD.setCursor(0,0); 
        LCD.print("Temp: Volts"); //Print message on first row
        
        readValue = analogRead(potPin); //get value
        Voltage = (5./1023.)*readValue; //convert
        LCD.setCursor(0,1);
        LCD.print(" "); //blank line
        LCD.setCursor(0,1);
        LCD.print(sensors.getTempFByIndex(0));
        LCD.print(" F");
        LCD.setCursor(10,1); //move cursor for volts
        LCD.print(Voltage); //print voltage.
        
        
        
        if (IsConnected == true) {
          if(voltage ! LastHSVoltage){
        /*Execute ONLY when HomeSeer is connected*/
        SendToHS(1,Voltage);
        LastHSVoltage = Voltage;
          }
        }
        I hope this helps you.

        Greig.
        Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
        X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
        Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
        Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
        Scripts =
        Various

        Comment


        • #5
          Thanks, but still not updating. Fear I may have a config issue -

          Here is a bit of the log at last connect -
          Jan-16 4:03:36 PM Arduino Plugin Updating Values on Board No: 2
          Jan-16 4:03:36 PM Arduino Plugin Updating pins on Board No: 2
          Jan-16 4:03:36 PM Arduino Plugin Connected to Board No:2 on COM13
          Jan-16 4:03:36 PM Arduino Plugin Board 2 Version API1.0.0.118 and Plugin Version 1.0.0.131 are compatible.

          I've attached shots of the config page, the device status page and the of the device.k Note the last change time on the Input1.

          Thanks again for the help.
          Barry
          Attached Files

          Comment


          • #6
            I can not tell without a debug log. Please select debug Logging on the plugin config page and then change the input voltage so you see it change on your LCD then turn off debug logging and click the link to get the log and send it to me so I can check it.

            Greig.
            Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
            X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
            Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
            Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
            Scripts =
            Various

            Comment


            • #7
              Originally posted by enigmatheatre View Post
              I can not tell without a debug log. Please select debug Logging on the plugin config page and then change the input voltage so you see it change on your LCD then turn off debug logging and click the link to get the log and send it to me so I can check it.

              Greig.
              I turn the volts from 0 to 5 I disabled Board 1, since that one is working. Here is the log.

              Thanks,
              Barry

              Edit- Added sketch
              Attached Files
              Last edited by lhfarm; January 16th, 2018, 05:27 PM.

              Comment


              • #8
                That is not much help as there is nothing in it??

                Can you send me the API code you put on the board?

                Greig.
                Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                Scripts =
                Various

                Comment


                • #9
                  Originally posted by enigmatheatre View Post
                  That is not much help as there is nothing in it??

                  Can you send me the API code you put on the board?

                  Greig.
                  Just tried to send it. Try this.

                  Thanks,
                  Barry
                  Attached Files

                  Comment


                  • #10
                    That looks ok to me.

                    Can you disconnect the board then enable debug logging then wait 1min and then connect the board, change the voltage a couple of times then disconnect the board and send me the log.

                    Greig.
                    Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                    X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                    Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                    Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                    Scripts =
                    Various

                    Comment


                    • #11
                      Here it is.
                      Attached Files

                      Comment


                      • #12
                        OK that is better.

                        The board is not sending the data to the plugin for some strange reason. I have not seen this before or had any reports of it so it might take a moment to find out what is going on.
                        I would also try the beta version that is in the updater as there are lots of changes and added features.
                        I see you are using usb and would also recommend updating to ethernet for a better and more reliable connection. I am thinking of removing support for usb in the future.

                        Greig.
                        Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                        X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                        Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                        Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                        Scripts =
                        Various

                        Comment


                        • #13
                          Thanks! I'll try the beta. I'll move it to Ethernet too. I'm just starting out, so still buying boards and figuring this all out. Thanks again for the plug-in. I'll get back with you in a couple of days with an update.

                          Barry

                          Comment


                          • #14
                            Simple API not updating HS - Fixed!

                            The beta fixed the problem. I'm running Win7 and had comm port issues when redoing things (new IDE version and drivers?). The port wouldn't show up. Once I got through that, everything works.

                            I still plan to go with Ethernet. But will go ahead with testing for now.

                            Thanks for the help.

                            Barry

                            Comment


                            • #15
                              Instead of pushing from the Arduino to HS, how could I set up HS to poll the Arduino to get the data instead?

                              Comment

                              Working...
                              X