Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommandTimeoutException in 0.3.X.X version #47

Closed
ghost opened this issue May 7, 2019 · 8 comments
Closed

CommandTimeoutException in 0.3.X.X version #47

ghost opened this issue May 7, 2019 · 8 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented May 7, 2019

Version 3 of your api does not work for me. When I am trying to use version 3 of your api , The following error occurs when trying to command or get the status of any device I own.
The devices I own are mss110 and the dimmer switch (MSS560).

Unknown event!
Unknown event!
Unknown event!
Device online status changed: Family Lights went online
Device online status changed: Living Lights went online
Device online status changed: V2 Extra 2 went online
Device online status changed: V1 Extra 1 went online
Device online status changed: Bedroom Lamp went online
Device online status changed: UV Light went online
Traceback (most recent call last):
  File "./test.py", line 54, in <module>
    bed.get_status()
  File "~/git/MerossIot/meross_iot/cloud/devices/power_plugs.py", line 117, in get_status
    self._state = self._get_status_impl()
  File "~/git/MerossIot/meross_iot/cloud/devices/power_plugs.py", line 78, in _get_status_impl
    data = self.get_sys_data()['all']
  File "~/git/MerossIot/meross_iot/cloud/device.py", line 129, in get_sys_data
    return self.execute_command("GET", ALL, {})
  File "~/git/MerossIot/meross_iot/cloud/device.py", line 126, in execute_command
    return self.__cloud_client.execute_cmd(self.uuid, command, namespace, payload, callback=callback, timeout=timeout)
  File "~/git/MerossIot/meross_iot/cloud/client.py", line 300, in execute_cmd
    raise CommandTimeoutException("A timeout occurred while waiting fot the ACK: %d" % timeout)
meross_iot.cloud.exceptions.CommandTimeoutException.CommandTimeoutException: A timeout occurred while waiting fot the ACK: 10

I'm not sure why this is happening as version 2 seems to be working fine (Although for me, version 2 stops working after a day of running which is why I want to test version 3)

The test script is essentially doing this:

# Initiates the Meross Cloud Manager. This is in charge of handling the communication with the remote endpoint
    manager = MerossManager(meross_email=username, meross_password=password)

    # Register event handlers for the manager...
    manager.register_event_handler(event_handler)

    # Starts the manager
    manager.start()

    # You can retrieve the device you are looking for in various ways:
    # By kind
    devs = manager.get_supported_devices()
    devs[0].get_status()

It happens on the .get_status(), .turn_on(), .turn_off() commands.

@vincenzosuraci
Copy link

Just my two cents. It is just a matter of handling the Exception when calling bed.get_status(), so that it does not freeze the execution of the python script. A CommandTimeoutException can occur for a variety of causes, e.g. internet leaks.

VS

@ghost
Copy link
Author

ghost commented May 7, 2019

Surrounding the commands with a try: except did not work either

@ghost
Copy link
Author

ghost commented May 9, 2019

Figured it out.
For anyone experiencing this issue, it is due to the domain being set to "eu-iot.meross.com" instead of "iot.meross.com"
I assume only people in the US will have issue with this.

@ghost
Copy link
Author

ghost commented May 15, 2019

Created a pull request to fix this issue.

#48

@albertogeniola
Copy link
Owner

Hi @ace5987 ,
Nice spot. I've had very little time lately, so I could not look into that. Anyways I've just merged your PR. New version of the library is 0.3.0.0.b2. Could you check it's now working?

Alberto.

@ghost
Copy link
Author

ghost commented May 15, 2019

It's been tested already on my own local source for a while now. I just decided to create a pull request now since I would like it to be up on pip. Thanks for the merge! One thing to make sure would be that @vincenzosuraci can also use the api still I cannot confirm if it works in EU the same way.

@albertogeniola
Copy link
Owner

albertogeniola commented May 15, 2019 via email

@albertogeniola albertogeniola added the bug Something isn't working label May 19, 2019
@ehenriqu7
Copy link

Hi.
I recently refreshed my Pi Zero image with Diet pi version, and installed the updated meross_iot=0.3.3.0. I'm running python 3.7.1 with GCC 8.3.0.
I'm having the same 'CommandTimeoutException' error since the new install. Previously, I was running meross_iot on a Raspbian bustar image, with older meross_iot module and no issues.

tst.py.txt
terminal_error.txt

File "/home/dietpi/.local/lib/python3.7/site-packages/meross_iot/cloud/device.py", line 143, in execute_command
return self.__cloud_client.execute_cmd(self.uuid, command, namespace, payload, callback=callback, timeout=timeout)
File "/home/dietpi/.local/lib/python3.7/site-packages/meross_iot/cloud/client.py", line 321, in execute_cmd
raise CommandTimeoutException("A timeout occurred while waiting for the ACK: %d" % timeout)
meross_iot.cloud.exceptions.CommandTimeoutException.CommandTimeoutException: A timeout occurred while waiting for the ACK: 10

Any ideia what could be the issue?

Many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants