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

Xiaomi MiIO Remote: Lazy discover disabled #12710

Merged

Conversation

syssi
Copy link
Member

@syssi syssi commented Feb 26, 2018

The Chuang Mi IR Remote Controller wants to be re-discovered every 5 minutes. As long as polling is disabled the device should be re-discovered in front of every command.

rytilahti/python-miio#210 (comment)

Improves sporadic timeouts/retries (if the device needs to be re-discovered):

2018-02-26 07:07:48 DEBUG (Thread-19) [miio.device] 192.168.86.60:54321 >>: {'method': 'miIO.ir_play', 'id': 4, 'params': {'code': 'Z6XHAL0BAACkAgAA0QIAAOYFAAARBgAABxEAAKgRAAD2EQAASBIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABWMQExMQEBMQEBMQEBMTEBMQExMTExATExMQEBAQExAQExMTEBAQEBAQEBATExMTExgVcxATExAQExAQExAQExMQExAUExMTEBMTExAQEBATEBATExMQEBAQEBAgEBMTExMTEB', 'freq': 38400}}
2018-02-26 07:07:53 ERROR (Thread-19) [miio.device] Got error when receiving: timed out
2018-02-26 07:07:53 WARNING (Thread-19) [miio.device] Retrying with incremented id, retries left: 3

…be re-discovered every 5 minutes. As long as polling is disabled the device should be re-discovered in front of every command.
@@ -70,7 +70,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):

# Create handler
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])
device = ChuangmiIr(host, token)
device = ChuangmiIr(host, token, 0, 0, False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would much prefer if this would use kwargs instead of args (and maybe adding a short comment), if just to make it more readable for anyone stumbling upon why this is done.

@syssi syssi changed the title Xiaomi MiIO Remote: Lazy discovery disabled Xiaomi MiIO Remote: Lazy discover disabled Feb 27, 2018
@rytilahti
Copy link
Member

Sorry, somehow forgot about this, looks good even if a bit verbose :-)

@rytilahti rytilahti merged commit b0e062b into home-assistant:dev Mar 5, 2018
@balloob balloob mentioned this pull request Mar 9, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants