Request for help with multiple configuration entries for the same platform

Looking for help I can do either of the scenarios below, but can’t figure out the syntax for both (they are different IP’s/hardware):

Working sensor:

  gc100:
    host: 192.168.1.23

binary_sensor:
  - platform: gc100
    scan_interval:
      milliseconds: 50
    ports:
      - '1:1': Sensor1
      - '1:2': Sensor2
      - '1:3': Sensor3

Working switch:

  gc100:
    host: 192.168.1.21

switch:
  - platform: gc100
    ports:
      - '1:1': Ch1
      - '1:2': Ch2
      - '1:3': Ch3

When I list multiple hosts under the gc100 platform entry it fails.
When I do not include a host under the gc100 entry and try to put it in the switch/sensor configuration variables, the logs state the config needs an IP tied to the host.

Anyone know how to have more than one of these global cache units on the same HA instance?

Thanks in advance!

Jeremy

Please see the sticky post for how to mark code correctly. The quotes you need are backticks, not normal quotes.

have you tried:

gc100:
  - host: 192.168.1.23
  - host: 192.168.1.21

I don’t use it so I have no idea if that will work but it’s worth a try.

The home-assistant.log file errors out with more than 1 host listed. Perhaps, I don’t know the correct syntax, but as you show in the above fails.

Sound like it might be the right time for a feature request or post an issue for it if you think it’s a bug.

For those that are interested…my work around is below:

A) I copied the gc100.py file and named it gc100a.py. I then edited its contents to change all gc100 code to gc100a (file is here: /srv/homeassistant/lib/python3.5/site-packages)

The only exception here is (where I left the gc100 alone):

class GC100SocketClient(object):
    """A Python client for the GC100 socket server."""

    queue = queue.Queue()
    subscribers = {}
    _socket_recv = 1024

B) I also copied the gc100 directory and named it as gc100a (found here: /srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/gc100)

I then edited all of the files within the directory anywhere gc100 was referenced to “gc100a”.

The only exceptions are:

  1. Within manifest.json where I had to leave the following as gc100:
  "documentation": "https://www.home-assistant.io/components/gc100",
  "requirements": [
    "python-gc100==1.0.3a"
  1. Within binary_sensor.py where I had to leave the following as gc100 ‘GC100BinarySensor(’:
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the GC100 devices."""
    binary_sensors = []
    ports = config.get(CONF_PORTS)
    for port in ports:
        for port_addr, port_name in port.items():
            binary_sensors.append(GC100BinarySensor(

Now my configuration looks like this:

# Itach ir sensor
gc100:
  host: 192.168.1.23
gc100a:
  host: 192.168.1.21

binary_sensor:
  - platform: gc100
    scan_interval:
      milliseconds: 50
    ports:
      - '1:1': Sensor1
      - '1:2': Sensor2
      - '1:3': Sensor3
switch:
  - platform: gc100a
    ports:
      - '1:1': Ch1
      - '1:2': Ch2
      - '1:3': Ch3

Reboot and everything works…guess I’ll have to do this for each of the gc100 components I plan to use.

Anyone know why the current documentation would only allow one device? Seems strange.

Was there ever a follow up on this and perm resolution? Googling suggests the answer is no. Even the HA docs still only represent a single entry in the config.yaml file.
I have numerous Global Cache products needing to be added… I’ll look to incorporate your workaround in parallel.

jwb

Not that I’ve seen.

I have 9 of these up and running with the setup above.

Let me know how it goes.

Good to know.

It looks like code has changed since you modified yours - roughly 2 months after. I didn’t have the file path you had and some of the coding was different.

I did read up on custom components and made a “custom_component” dir under /config. I grabbed the files from the GC100 Git. I presume the init.py file is the gc100.py file (I named mine after the last octet of IP, so gc100-214).

When I goto check my config, I just get a spinning wheel forever. This is what i have in my config file:
Capture
If I # it out, code checks fine.

Also attached are screen shots of my gc10-214.py and my switch.py. The switch.py and the gc100-214.py file sits in /config/custom_component/gc100-214. Would appreciate anyone’s sanity check of my editing… I am pretty good at modifying code to do what I need it to do.


On the bright side… I dont get any errors when putting in gc100 and gc100-214, so some progress.

Cheers

jwb