Announcement

Collapse
No announcement yet.

ERROR System.ArgumentException: An item with the same key has already been added.

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

  • ERROR System.ArgumentException: An item with the same key has already been added.

    Hello,
    I am attempting to use the Raspberry Pi plugin and am having issues.
    I am running HS3Pro on Windows 10. My Raspberry Pi 3 B+ is running Raspian Stetch. I have installed Mono 5.16 and mono-vbnc as sugested in other
    forum entries. Initially I was able to get the plugin connected to the main HS3 and see the Remote plugin listed in HS3. I then went to the configure screen and changed a couple of the GPIO from Not used to Outputs. That seems to be where the problems began.
    I have never seen the GPIO show up on the HS3 device list. I do have one entry that shows RaspberryPi however.

    I am not sure how to view or send logs from the RPi or I would send them as well.

    Any help would be appreciated.

    Below is the log from HS3, filtered by RaspberrIO

    Oct-15 8:06:09 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 8:06:09 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 8:06:09 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 8:06:03 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 7:56:57 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 7:56:57 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 7:56:57 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 7:56:52 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 7:56:18 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 7:56:18 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 7:56:18 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 7:56:12 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 6:20:50 PM RaspberryIO ERROR System.ArgumentException: An item with the same key has already been added. Key: Pin2 at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000dd] in :0 at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in :0 at HSPI_RaspberryIO.RaspberryPiApp.b__49_0 () [0x004f2] in <4ede16bb2c524fc6a74653e3fb9eb675>:0
    Oct-15 6:20:50 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 6:20:50 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 6:20:50 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 6:20:45 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 6:20:13 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 5:04:29 PM RaspberryIO ERROR System.ArgumentException: An item with the same key has already been added. Key: Pin2 at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000dd] in :0 at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in :0 at HSPI_RaspberryIO.RaspberryPiApp.b__49_0 () [0x004f2] in <4ede16bb2c524fc6a74653e3fb9eb675>:0
    Oct-15 5:04:29 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 5:04:29 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 5:04:29 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 5:04:24 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 5:03:50 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 4:54:47 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 4:54:47 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 4:54:47 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 4:54:42 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 4:54:09 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 4:54:09 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 4:54:09 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 4:54:04 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 4:53:31 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 4:53:31 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 4:53:31 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 4:53:26 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 4:52:54 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 4:52:54 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 4:52:54 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 4:52:49 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 4:52:16 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 4:52:16 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 4:52:16 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 4:52:11 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 4:51:38 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 4:51:38 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 4:51:38 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 4:51:33 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 4:51:01 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 4:51:01 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 4:51:01 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 4:50:56 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 4:50:23 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 4:50:23 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 4:50:23 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 4:50:18 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 4:49:01 PM RaspberryIO ERROR System.ArgumentException: An item with the same key has already been added. Key: Pin2 at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000dd] in :0 at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in :0 at HSPI_RaspberryIO.RaspberryPiApp.b__49_0 () [0x004f2] in <4ede16bb2c524fc6a74653e3fb9eb675>:0
    Oct-15 4:49:01 PM RaspberryIO INFO Raspberry Pi running on Bcm2709 processor
    Oct-15 4:49:01 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 4:49:01 PM RaspberryIO INFO Serial number: 00000000282a94c0
    Oct-15 4:48:55 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 4:48:23 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 4:47:51 PM RaspberryIO INFO RaspberryIO version 3.0.0.13
    Oct-15 4:47:18 PM RaspberryIO INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
    Oct-15 4:47:18 PM RaspberryIO INFO Serial number: 00000000282a94c0

  • #2
    How do you start the remote plugin instance? with which parameters?
    It looks like it's started several times in a row, which is wrong....

    Could you try to start it from the command line and paste the output here, there may be more information on what's going on.

    Comment


    • #3
      Hello,
      I am starting the remote plugin instance from the command line prompt in the terminal. I also attempted to have it start at boot time but it didn't seem to work. Here is my latest information. For this experiment I restarted HS3 on the Windows Pc. I removed the run.sh from the startup script on the RPi. Rebooted the RPi. I then started the run.sh from the terminal and below is the output.

      Keep in mind that I am not a Linux guy. I assume the terminal is how you get to the command prompt. If not, please correct me. Also, if I start the plugin from the terminal and close the terminal, does that kill the plugin on the RPi? And finally, is there a way in Raspian to determine if the plugin is running in background?

      Thanks for all of your help.

      pi@raspberrypi:~/RaspberryIO $ sudo ./run.sh
      Plugin: RaspberryIO Instance: homeseerpi starting...
      Connecting to server at 192.168.11.100...
      Connection attempt #1
      Connected (HomeSeer API 3). Waiting to be initialized...
      Oct-16 11:34:01 INFO RaspberryIO version 3.0.0.13
      Oct-16 11:34:06 INFO Raspberry Pi running on Bcm2709 processor
      Oct-16 11:34:06 INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
      Oct-16 11:34:06 INFO Serial number: 00000000282a94c0
      Oct-16 11:34:08 INFO Shutting Down plug-in
      Disconnected from server - client
      System.NullReferenceException: Object reference not set to an instance of an object.
      at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_remoting_wrapper(intptr,i ntptr)
      at (wrapper remoting-invoke) HomeSeerAPI.IHSApplication.WriteLog(string,string)
      at HSPI_RaspberryIO.Logger.Log (System.String line, HSPI_RaspberryIO.Logger+ELogLevel level) [0x0008e] in <4ede16bb2c524fc6a74653e3fb9eb675>:0
      Oct-16 11:34:08 ERROR System.NullReferenceException: Object reference not set to an instance of an object.
      at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_remoting_wrapper(intptr,i ntptr)
      at (wrapper remoting-invoke) HomeSeerAPI.IHSApplication.GetINISection(string,string)
      at HSPI_RaspberryIO.RaspberryPiApp.ReadPinsConfigFromIni () [0x00011] in <4ede16bb2c524fc6a74653e3fb9eb675>:0
      System.NullReferenceException: Object reference not set to an instance of an object.
      at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_remoting_wrapper(intptr,i ntptr)
      at (wrapper remoting-invoke) HomeSeerAPI.IHSApplication.WriteLog(string,string)
      at HSPI_RaspberryIO.Logger.Log (System.String line, HSPI_RaspberryIO.Logger+ELogLevel level) [0x0008e] in <4ede16bb2c524fc6a74653e3fb9eb675>:0
      Connection lost, exiting
      Waiting 30 seconds before trying to reconnect


      Comment


      • #4
        what version of HS3 are you running?
        Try to copy Scheduler.dll, HSCF.dll and HomeSeerAPI.dll from your HS3 machine to your RPi in the same directory than run.sh

        Comment


        • #5
          Thanks. I will work on this tonight.

          Comment


          • #6
            Hi,
            The HS3 version is HS3 Pro Edition 3.0.0.435 (Windows)
            I copied the dll files to the RPi as you asked. I then rebooted the RPi and started the plugin.
            Below is the text from the startup.

            pi@raspberrypi:~ $ cd RaspberryIO
            pi@raspberrypi:~/RaspberryIO $ sudo ./run.sh
            Plugin: RaspberryIO Instance: homeseerpi starting...
            Connecting to server at 192.168.11.100...
            Connection attempt #1
            Connected (HomeSeer API 3). Waiting to be initialized...
            Oct-16 17:10:20 INFO RaspberryIO version 3.0.0.13
            Oct-16 17:10:25 INFO Raspberry Pi running on Bcm2709 processor
            Oct-16 17:10:25 INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
            Oct-16 17:10:25 INFO Serial number: 00000000282a94c0
            Exception deserializing message: The input stream is not a valid binary format. The starting contents (in bytes) are: 01-00-00-00-01-00-00-00-FF-FF-FF-FF-01-00-00-00-00 ...
            Cannot access HomeSeer API
            Oct-16 17:13:01 INFO Shutting Down plug-in
            Connection lost, exiting
            Disconnected from server - client
            Waiting 30 seconds before trying to reconnect
            Connecting to server at 192.168.11.100...
            Connection attempt #1
            Connected (HomeSeer API 3). Waiting to be initialized...
            Oct-16 17:13:33 INFO RaspberryIO version 3.0.0.13
            Oct-16 17:13:38 INFO Raspberry Pi running on Bcm2709 processor
            Oct-16 17:13:38 INFO Firmware rev10494163, board model B3Plus (Raspberry Pi 3 Model B+)
            Oct-16 17:13:38 INFO Serial number: 00000000282a94c0

            Comment


            • #7
              ok, let's try to restart from scratch.

              Stop your RaspberryIO plugin instance on your RPi
              In your HS3 machine in HomeSeer HS3/Config delete all the files that starts with RaspberryIO
              From the Device management screen, delete all the devices of type RaspberryIO
              Then restart your instance on your RPi

              At that point in there any error in the logs? any "shutting down" lines? If so please post the HS logs without filtering on RaspberryIO, as well as the output from the RPi

              Can you access the config page? If so please try to set one pin to output.

              Comment


              • #8
                Hi,
                From post #3:
                Marty_B
                "Keep in mind that I am not a Linux guy. I assume the terminal is how you get to the command prompt. If not, please correct me. Also, if I start the plugin from the terminal and close the terminal, does that kill the plugin on the RPi? And finally, is there a way in Raspian to determine if the plugin is running in background?"

                Yes the plugin will stop when you close the terminal window, unless you do the command like this:
                "sudo ./run.sh &" in the directory where the plugin is located on the raspberry pi. The "&" puts it in the background, so if you close the terminal window, it will stay running.
                To check what is running on the pi:
                from the terminal window (command line - with a prompt something like this - "pi@HVAC-raspberrypi-2:~ $"
                type:
                "sudo ps x" that will show you what is running, even what has been started by root.
                You should see something like this:

                848 ? S< 0:00 [kworker/3:1H]
                887 ? S 0:00 sudo python RFID.py
                891 ? Sl 3:11 python RFID.py
                922 ? S 0:00 sudo ./run.sh
                926 ? S 0:00 /bin/sh ./run.sh
                927 ? Sl 33:11 mono HSPI_RaspberryIO.exe server=10.0.0.231 instance=
                11788 ? S 0:00 sudo python door-lock-indicator2.py
                11792 ? Sl 12:44 python door-lock-indicator2.py
                16274 ? S 0:01 [kworker/u8:1]
                22295 ? S 0:00 [kworker/3:2]
                22995 ? S 0:00 [kworker/u8:0]
                23225 ? S 0:00 [kworker/3:0]
                23498 ? S 0:00 [kworker/1:0]
                23738 ? S 0:00 [kworker/1:1]
                23961 ? S 0:00 [kworker/0:0]
                24323 ? S 0:00 [kworker/2:2]
                24347 ? S 0:00 [kworker/2:1]
                24409 ? S 0:00 [kworker/0:2]
                24434 ? S 0:00 [kworker/2:0]
                24440 ? Ss 0:00 sshd: pi [priv]
                24469 pts/2 S+ 0:00 sudo ps x
                24473 pts/2 R+ 0:00 ps x

                As you see, my raspberry pi is running the plugin - processes - 922, 926, 927

                Hope this helps a little
                Bruce

                Comment


                • #9
                  This helps allot. Thanks very much

                  Comment


                  • #10
                    So here is the latest. In my tests, It was apparent that the plugin was ALMOST working. Sometimes it would work and sometimes it would not. Sometimes the plugin config would appear and sometimes not. It appeared to me after seeing the "Exception deserializing message: The input stream is not a valid binary format. The starting contents (in bytes) are: 01-00-00-00-01-00-00-00-FF-FF-FF-FF-01-00-00-00-00 ..." message that there might be a communications issue between the RPi and my HS3 windows box. I plugged the RPi into my hardwired network as apposed to the WiFi connection that I had been using. Everything seems like it is working in this configuration and appears stable. I can configure the GPIO and the appear in the device list. I can turn them on and off, though I haven't verified that they are actually turning on and off. I don't have a relay board or leds or anything yet. I will test it with a meter tomorrow. I just put in a very long day and I am tired.
                    SO...the culprit seems to be Wifi on the RPi. I am not sure why however. The RPi is only about 5 meters from my Wifi Router and shows good signal strength. My plan for this project is to make a gate opener that will be about 100 meters from my house and plan on using Wifi with high gain antennas, so Wifi is pretty important to me for this project. Any thoughts?
                    By the way Spud, I really appreciate your effort in helping me get this working.

                    Comment

                    Working...
                    X