Announcement

Collapse
No announcement yet.

Api mode curiosity

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

  • Api mode curiosity

    Hi,

    I'd like to understand better the API mode. In particular way:
    -is it possible to write only "setup" (and no real code) into the sketch in order to permit still HS to manage input/output/etc? I know this could not be sense but I'd like to understand for the future.

    -Is there still a maximum of 30 input as per standard HS mode?7

    -If I want to write a code for 1wire sensor on an API board, in which way I have to dialogue with HS? Do I have to use "SendToHS(Device,Value)" every x time or HS can interrogate it?

    Thanks
    Regards
    Rinpe

  • #2
    I have just entered to API world: disaster for me .

    Anyway I have to understand at the beginning, little things so if somebody can help me please.

    My first simply target is to visualize a pin state on the home screen of Homeseer. I have done in this way.
    -I have set board as APi in the Arduino pluging config.
    -Download API.ino
    -modify it where I set "int pin = 20;" before void setup
    "pinMode(Pin, INPUT);" after void setup
    "digitalRead(Pin); SendToHS(2,Pin);" after if (IsConnected == true)...
    -I don't understand how I can associate pin 20 to status on home screen of Homeseer.
    - I can't visualize change status on Homeseer.

    Next step will be to understand as I can drive a pin.

    Thanks in advance for your help
    Regards
    Rinpe

    Comment


    • #3
      Nobody?
      Thanks
      Rinpe

      Comment


      • #4
        ok so it look like you are nearly there.

        On the config page you need to add the number of api Inputs and outputs that you want. So with on input and one output you would have the setup like the picture below.
        Then to send data as per the text in the API you would use SendToHS(1,digitalRead(Pin)) this would send the pin info to API input 1.
        You do not send the pin number just the API device of the board you want to update and the value you want to display but the above code would send this lots so you are better to store the pin state on the board then when you detect a change send it to Homeseer.

        /* To Send Data to Homeseer use SendToHS(Device,Value)
        Eg.. SendToHS(1,200); where 1 is the API device in homeseer and 200 is the value to send
        To Recieve data from Homeseer look up the FromHS array that is updated when the device value changes.

        I hope this helps.

        Greig.
        Attached Files
        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
          Maybe there is something wrong. Is not possible I'm not able to configure only a one input on API board.
          Please help me. I attachet a lot of images regarding what I did to configure it. There is an error on log file as you can see. Then the status of the device is change itself from dim1% to off without I did something.
          Anyway I hve never seen status change of device when I put pin to high or to low.
          Tell me if you want other information to understand where is my error
          Thanks in advance for your help.
          Rinpe
          Attached Files

          Comment


          • #6
            other images....
            Attached Files

            Comment


            • #7
              ok the problem is that you are flooding homeseer with commands from the board. The Arduino is sending to Homeseer every loop and this is thousands of commands.

              In the API.ino you need to add some code to stop this and only send to Homeseer when there is a change of data or you want to update the value.

              Something like.

              Code:
              const int buttonPin = 9;     // the number of the pushbutton pin  
              int buttonState = 1;         // variable for reading the pushbutton status
              int lastButtonState = 0;    // variable for recording the pushbutton status
              
              
              void setup() {
              
                pinMode(buttonPin, INPUT);     
              }
              
              void loop(){
                // read the state of the pushbutton value:
                buttonState = digitalRead(buttonPin);
              
                // check if the pushbutton is pressed.
                // only is if has then:
               if (buttonState != lastButtonState) {
              
                //Send the new buttonState.   
                SendToHS(1,buttonState);
              lastButtonState = buttonState;
              
                }
              }
              This is untested code but should point you in the correct direction.

              Greig.
              Last edited by enigmatheatre; December 21st, 2014, 04:40 PM.
              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


              • #8
                Thanks enigmatheatre but I'm continuing to have same behaviour and log "error":

                "Arduino Plugin Exception in RecievedText: Riferimento a un oggetto non impostato su un'istanza di oggetto."

                I have tried to modify something to your example sketch (even if it is ok for my point of view) but same behaviour and error. I see Dim%1 on device status.
                Is there other error from my side?
                Thanks
                Rinpe

                Comment


                • #9
                  Can you send me a debug log so I can see the data. Can you translate the error for me to.

                  Sent from my HTC One using Tapatalk
                  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


                  • #10
                    Sorry, where can I find debug log?

                    The translate error is:

                    Arduino Plugin Exception in RecievedText: Object reference not set to an instance of an object

                    I hope you understand.
                    Thanks
                    Rinpe

                    Comment


                    • #11
                      On the config page click the debug checkbox then try and make the board work. Then uncheck the debug box and there will be an option to download the debug log. Please send this to me zipped.


                      Sent from my HTC One using Tapatalk
                      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


                      • #12
                        I think there are some other problems because I can't download the debug log file. See attached images hoping I'm doing right. In the error\warnings of Hs3 seems that arduino log file is not accessible because it is in use from another process (I try to translate).
                        I set on the board 2 (API) the Api debug and check it, works with the board and then try to download the log file.
                        What do you think? Is it better to reinstall all HS3 and start to begin?
                        Thanks
                        Regards
                        Rinpe
                        Attached Files

                        Comment


                        • #13
                          I can't download the debug file but I went to the folder and copy it.
                          See attached.
                          I hope it is right and helpful for you.
                          Thanks
                          Regards
                          Rinpe
                          Attached Files

                          Comment


                          • #14
                            Thanks,

                            Yes this confirms what I was thinking. The data from the board is going to HS to fast. Can you email me the Board.ino to the address at the top of the config page so I can check it and change it for you. We can then try that. I have a new version that will stop the error but there is no point in installing it until we work out your board.ino

                            Thanks,

                            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


                            • #15
                              With Greig help I understand better how input pin on API mode works. There are some little things to refine but a bit 'at a time.

                              Now I'm thinking to understand output pin. In the sketch I set for example pinMode(pin2, OUTPUT); and I thought it was enough. I also thought that in the home (device list) of HS when I push "off" or "full" button of the output, something changing...but it isn't.
                              In which way I can associate pin output to relative device in the HS?
                              I think there is something I miss, probably what is written in the .ino
                              " To Recieve data from Homeseer look up the FromHS array that is updated when the device value changes.
                              Eg.. FromHS[5] would be the data from API Output device 5"
                              But I don't understand....Can anybody give me an example please?

                              Thanks in advance.
                              Regards
                              Rinpe

                              Comment

                              Working...
                              X