Somfy MyLink Not Working

I was excited seeing the update for this week that showed the Somfy MyLink integration. Thank you to the kind soul who finally built this as I was getting ready to start digging into some python bits I’d found and see how I could adapt them to work. This should hopefully make things easier!!

That said, I went along to setup the integration yesterday but was met with issues in attempting to get it to run. I’ve successfully grabbed the IP and SystemID of the device, per the configuration instructions in the component info. Upon startup I can see the following detail in the logs, and I see nothing configured in the interface to show these entities.

Currently running the latest update of HA (0.92.1) on a Rock64 device running DietPi for an OS. Any assistance is greatly appreciated. From my first unknowing glance, it would seem perhaps something is not configured properly in the component?

2019-04-27 12:30:49 ERROR (MainThread) [homeassistant.components.cover] Error while setting up platform somfy_mylink
Traceback (most recent call last):
  File "/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/home/homeassistant/.pyenv/versions/3.6.3/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/lib/python3.6/site-packages/homeassistant/components/somfy_mylink/cover.py", line 22, in async_setup_platform
    mylink_status = await somfy_mylink.status_info()
  File "/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/lib/python3.6/site-packages/somfy_mylink_synergy/__init__.py", line 34, in status_info
    return await self.command("mylink.status.info", targetID=target_id)
  File "/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/lib/python3.6/site-packages/somfy_mylink_synergy/__init__.py", line 59, in command
    return await self.send_message(message)
  File "/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/lib/python3.6/site-packages/somfy_mylink_synergy/__init__.py", line 71, in send_message
    return await self._recieve_data(read_until_string)
  File "/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/lib/python3.6/site-packages/somfy_mylink_synergy/__init__.py", line 135, in _recieve_data
    await self._close_socket()
  File "/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/lib/python3.6/site-packages/somfy_mylink_synergy/__init__.py", line 107, in _close_socket
    await self._stream_writer.wait_closed()
AttributeError: 'StreamWriter' object has no attribute 'wait_closed'

I have a somewhat similar issue. I get below error. Seems like it must have connected to the MyLink but the response back to it didn’t actually have a ‘result’ item in it. Not sure how to proceed or debug further here.

19-05-12 13:51:22 ERROR (MainThread) [homeassistant.components.cover] Error while setting up platform somfy_mylink
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/somfy_mylink/cover.py", line 27, in async_setup_platform
    for cover in mylink_status['result']:
KeyError: 'result'

I’m hopeful that perhaps the mods have a way for us to find/tag the creator of the plugin? Unfortunately I don’t see an easy way to do this on the GitHub as its all pooled together. :frowning:

I’m getting the same error here. really hoping to be able to use this soon.

Hi all, apologies for the delay in picking this up.
What would be super helpful is if you could try doing the following:

  • Check that the details you have entered in the configuration match the Integration report in the Somfy MyLink app
  • Check that your device supports the Synergy API, this can be verified by following the below steps:

At a command prompt (ideally where HomeAssistant is running from), enter the following:

telnet YOUR_MYLINK_IP_ADDRESS 44100

Once you receive a message Connected to YOUR_MYLINK_IP_ADDRESS, try pasting in the following, substituting the uppercase section with your System ID (keeping all quotes intact):

{"method": "mylink.status.info", "params": { "targetID" : "*.*", "auth": "YOUR_SYSTEM_ID"}, "id":1}

You should get something that looks like this:

{"jsonrpc":"2.0","result":[{"targetID":"CC12345C.1","name":"Blinds 1","type":0},{"targetID":"CC12345C.2","name":"Blinds 2","type":0}],"id":1}

If any of the above doesnt seem right, please PM me with your Somfy integration report and the output of the commands :slight_smile: Otherwise, if the command returned something similar to the above it should be fully compatible.

Thanks!

@bendews - thanks for jumping in! Not sure, are you the creator? If so thanks in advance for creating this. I was contemplating going down the road of taking some python projects I saw and making a crude integration to start with simply using python extensions. Anyhow, matter at hand.

So I am indeed able to connect using your command above. I then do get a valid output similar to what you describe. But again, I’m not able to get this to function properly with HomeAssistant. Any additional tests, logs, error information I can provide?

user @ host~/Downloads: telnet <SOMFY IP> 44100
Trying <SOMFY IP>...
Connected to somfy_4b41.iot.local.
Escape character is '^]'.
{"method": "mylink.status.info", "params": { "targetID" : "*.*", "auth": "mylink01"}, "id":1}
{"jsonrpc":"2.0","result":[{"targetID":"CC104B41.1","name":"Kitchen Window","type":0},{"targetID":"CC104B41.2","name":"Breakfast Left","type":0},{"targetID":"CC104B41.3","name":"Breakfast Slider","type":0},{"targetID":"CC104B41.4","name":"Breakfast Right","type":0},{"targetID":"CC104B41.5","name":"All Shades","type":0},{"targetID":"CC104B41.6","name":"Family Room","type":0}],"id":1}

@1activegeek - Your issue is due to running on Python 3.6, the ‘wait_closed’ attribute was added in Python 3.7, so if you can run Python 3.7 that should clear everything right up :slight_smile:
Regardless, Python 3.6 is supposed to be fully supported, so that’s completely my mistake, I’ll raise a PR to get it fixed up, apologies for that!

The other issues on this thread look to be completely different, so keen to see if anyone is able to give some feedback after following the steps I posted :slight_smile:

Thanks for the update. This makes sense! I’ll see about working through a possible upgrade to a newer Python in the virtualenv. I run HA on a Rock64 and this was installed by DietPi initially. I’m not as savvy with moving this stuff around but I’ve found a bit of the documentation from HA pretty promising. May just need a day where I have some time to troubleshoot my inevitable screw ups. :smiley:

If you happen to get a fix for older Python version though first, I’ll take that for a spin. Thanks for bringing this to life again, and giving me hope I can get control over these bad boys!!

1 Like

@1activegeek - Looks like the fix will be included in 0.95. If you’re feeling brave you can try running the beta version and see how it goes :slight_smile:

I’ll hang tight for .95 :wink:

I’m fighting another issue with my Rock64 that runs HA rebooting randomly, or hanging randomly. I can’t pinpoint anything yet, and I can’t isolate a pattern of any sort.

I’ll test it out though once .95 is released and let you know if I have any issues. Thanks for getting it corrected!!

@bendews I’m another MyLink user, got a similar problem, but mine isn’t the same resolution. Here is the output of the following command:

{"method": "mylink.status.info", "params": { "targetID" : "*.*", "auth": "CC114B2F"}, "id":1}

Which returns:

{"jsonrpc":"2.0","error":{"code":-32652,"message":"Invalid auth"},"id":1}

When I check the “Info” area on my mobile application (that’s where the MAC and ID are now, not under Integrations) I’ve confirmed my ID. However, there is also a “Mobile PIN” as well as a “Base Address”. Not sure if those need to be used, as I saw in the previous poster’s ID he had a “.2” at the end of his ID.

I’m also sourcing the query from an IP address that is NOT on the same local LAN as the Somfy MyLink, so curious if that matters as well or not?

Thanks!

-Rob

Hmmm, @bendews NVM on the .2, I figured out that’s just in the response and is an enumeration of the various devices that belong to that ID. So, that’s not the issue. Curious about the PIN, Base Address, and possibility of some type of network-based authorization that requires you to source from the same subnet as the MyLink is on…

Thanks!

-Rob

Hi @pickerin , it sounds like you just need to set up your integration - in the latest versions of the app it is less obvious than it used to be. The ID shown in the app under ‘info’ is the ‘hardware ID’ as opposed to the ‘system ID’.

  • Go to “Integrations” in the app sidebar
  • Click on any provider that isn’t a cloud provider (Don’t click on Amazon Alexa or IFTTT)
  • There will be the option to set a System ID. I recommend setting the System ID as a short simple text without numbers or symbols. In this example I will set it as mylink
  • Once the System ID is set, click the ‘Get Integration Report’ button

Once you have the integration report you can then use the details on that page to configure the HomeAssistant integration. Assuming the hub IP is 192.168.1.50 and I set mylink as my system ID my config would look like this:

somfy_mylink:
  host: "192.168.1.50"
  system_id: "mylink"

Let me know how you go!

4 Likes

My issue is fixed after using system ID from the Integrations tab in the app instead of hardware ID in my config. Thanks for this integration @bendews, really cool. Having a better error message here when the system ID isn’t found would be helpful vs the Python KeyError.

1 Like

Yep, thanks for that tip to update the System ID via an integration.
I also had trouble actually getting it to take, this was due to the Somfy refusing to do it from a different subnet (I have 4). So I had to move to the same subnet as the myLink and then it would take.

1 Like

Thanks @mattsahn & @pickerin for confirming - I’ll see if I can get the documentation updated to be clearer on the ‘Integration’ requirement and if I can put a more friendly error in the instances that no response is returned.
The latter may be more difficult due to the way the MyLink API is accessed.

1 Like

Also had similar trouble around that poor documentation on System ID. Also, had left telnet open and it wouldn’t connect from HA. Only when the telnet closed did it allow connection from HA.

@bendews I’ve been having trouble as well. Here’s my configuration:

somfy_mylink:
  host: "10.0.0.66"
  system_id: "mylink"

I can reach it with telnet:

$ telnet 10.0.0.66 44100
{"method": "mylink.status.info", "params": { "targetID" : "*.*", "auth": "mylink"}, "id":1}
{"jsonrpc":"2.0","result":[{"targetID":"CC10A0B3.1","name":"Living Room Right","type":3}],"id":1}

but the integration and entities aren’t showing up in Home Assistant. I saw errors saying it couldn’t connect if I didn’t quote the host and system_id. Now that I’m quoting them, I’m not seeing anything in the logs from this integration.

Any ideas? Can’t wait to use this with my new shades! :slight_smile:


Actually, they are showing up! I spent a lot of time trying things, using the Python library directly, etc. since they weren’t showing up in Entities or Devices. I was working on something else and discovered them in the Unused Entities screen though!

Are they expected to show up in Entities or Devices?

How do we go about making these Cover listings show up in entities/devices/be set to an area?

For now I seem to be stuck with them only possibly visible via the group of all covers and can’t assign them any additional information as they don’t show up in the entities (disabled or otherwise).

I’m in the same boat. Not able to move them to specific rooms. They are all listed under Cover. Not really sure how to place them into a room.