GoGogate 2 Cover

I don’t get that error “Data must be padded to 16 bytes boundary in CBC mode” and am able to control my device from HA 0.67.

It looks like it’s something to do with the size of the data when we do the encryption to talk to the Gogogate device.

My username is 5 characters and password and password 17 characters.

Can you let me know how long your username/password is @Chris_Quach and I’ll see if I can replicate the problem.

@antoinevandenhurk we don’t need the UDI since that’s for remote access only, and this integration is local. I couldn’t get remote access working after they did the recent firmware upgrade.

Hi @dbroadfoot

my username is only 5 chars long and my password is 8 chars long.

what minimum length should it be ?

By the way, thanks again for working on this :slight_smile:

Hey @Chris_Quach

I think I’ve worked out the problem. I’ve released a new version of the api package.

Can you try it out and let me know.

Since it’s not updated in HomeAssistant yet, you’ll need to add it as a custom component.

. Add the following file to your config directory config\custom_components\cover\gogogate2.py

https://raw.githubusercontent.com/home-assistant/home-assistant/dev/homeassistant/components/cover/gogogate2.py

  1. Change REQUIREMENTS = [‘pygogogate2==0.0.3’] to REQUIREMENTS = [‘pygogogate2==0.0.7’]

  2. Save the file and restart HomeAssistant

Hi @dbroadfoot

I’m going to be overseas for a week so I won’t be able to try it till I get back :frowning:

I’ll definitely let you know as soon as I can try it

Hi Dbroadfoot,

I want to try your suggestion, but I’m not familier with step 2. I’m using Hassio. How can I assign the REQUIREMENTS? Sorry, I’m a bit off a rooky…

Hi,

In addition to password errors, I moved over to another RPI3 and received this

Error while setting up platform gogogate2
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 82, in async_setup
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/cover/gogogate2.py", line 46, in setup_platform
    devices = mygogogate2.get_devices()
  File "/usr/lib/python3.6/site-packages/pygogogate2/__init__.py", line 78, in get_devices
    self.apicode = devices.find('apicode').text
AttributeError: 'NoneType' object has no attribute 'text'

""Add the following file to your config directory config\custom_components\cover\gogogate2.py

https://raw.githubusercontent.com/home-assistant/home-assistant/dev/homeassistant/components/cover/gogogate2.py 10
Change REQUIREMENTS = [‘pygogogate2==0.0.3’] to REQUIREMENTS = [‘pygogogate2==0.0.7’]

Save the file and restart HomeAssistant""

Had the username and password problem, confirm works like a charm after modify, I can open and close two garage doors thru HA now.

Thank you dbroadfoot.

Worked for me. Thank you.

Hi @dbroadfoot

just copied the gogogate.py file into config\custom_components\cover\gogogate2.py and edited it as per step 2.

Im still getting the same error.

Error: Data must be padded to 16 byte boundary in CBC mode
You will need to restart hass after fixing.

Hi @dbroadfoot

Ok, its working now. I added a new user to my gogogate2, with a username of ‘hassio’ and a password length of 14 characters. That seemed to have fixed it :slight_smile:

Its working great now !

I have created a new user on the GOGOGATE console for Hassio corresponding to the number of characters as indicated by dbroadfoot. Hassio then found 2 entities, so that the doors can now be steered without delay. The corresponding sensors indicate the status with a small delay. With this, I can now generate an alert with an automation.

Thanks for the good work!

Thanks for the feedback,

I’ve submitted a PR to get this fix in to the next version of HA so you won’t need the custom component if your password is not 17 characters.

Just popped in to say great job on this dbroadfoot and those who helped with testing.

Updated to 67.1 last night and was able to quickly add my GoGoGate2 to my configuration with a new 6 char local user and 14 char password (avoiding the padding issue). I’ve also added some automations to warn me if the door is opened at odd hours overnight.

This all means that I’m finally able to get shot of my hacky IFTTT Gogogate recipe with limited hours of control and Tasker based security alerts in case the door was opened at odd hours during the night.
This means I can now get shot of my IFTTT account altogether - the GogoGate was the last component I needed it for.

Great job all round guys.

Hi dbroadfoot,

after using the cover for a week now, a few things I have noticed especially around automation’s.

several of my automations which involve closing the garage/gate seem to be firing correctly, however what ive noticed is that when the cover state is ‘closed’ and an automation fires off to close_cover (close it), and thus attempting to close the garage/when it is already closed. What seems to happen is the garage/gate will then begin to open. Ive tested a few different automation, and it seems both close_cover/open_cover seem to act as a toggle switch.

Ie. If the gate is already open, automation fires to open it… it will close
If the gate is already open, automation fires to close it…it will close
if the gate is already closed, automation fires to close it…it will open
so on… so forth…

Im not sure if this has anything to do with the service call, but using my old IFTTT command line cover didn’t exhibit this behaviour.

Would like to hear if anyone else has this same behaviour when using with an automation ?

Once again, thanks for putting your time into this @dbroadfoot

Hi @Chris_Quach

Yes the Gogogate2 api does seem to function as a toggle button. The component just sends the ‘activate’ command which can open or close.

The HomeAssistant UI seemed to not allow opening if the garage is already open, but probably not from an automation/service call.

I can update the component to only perform an open, if the state is closed and this will probably be in 0.69

That would be awesome @dbroadfoot

I can also confirm that the HA native homekit implementation on 0.68 also exhibits the same behaviour when creating an automation from within the apple home app.

Also wondering whether the temperature sensor on the gogogate2 is something that can be exposed as a sensor ?

Hi @Chris_Quach

The issue you reported is fixed in https://github.com/home-assistant/home-assistant/pull/14209

I don’t have a need for the temperature sensor at the moment but that information is exposed in the api.

Hi

Do you think you could also apply the converse to the rule in the next release? i.e. Only perform close if the state is open?

Thanks for all your hard work on this.

Hi @uiguy,

Yes it applies to both - so you can only open when it’s closed and close when it’s open.

awesome! works like a charm…

I don’t really use it, but is it likely that you would be able to include the light in the component?