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

Device sync improvements #23

Merged
merged 4 commits into from
Jan 25, 2022
Merged

Device sync improvements #23

merged 4 commits into from
Jan 25, 2022

Conversation

Skons
Copy link
Collaborator

@Skons Skons commented Jan 21, 2022

This PR improves the way devices are synced. It has got a reverse engineered device sync implementation from the original app. It does this by using the DEVICE_NAME_REPLY, grabbing the ID of the device and send it back with a bogus device state. This will trigger DEVICE_STATUS_UPDATE to be sent to ELRO Connects. With this, ELRO Connects will get all the devices and their statuses within ~40 seconds after launch.

The protocol documentation has also been updated.

@Skons
Copy link
Collaborator Author

Skons commented Jan 21, 2022

This PR solves issue #18

@Skons
Copy link
Collaborator Author

Skons commented Jan 25, 2022

@hildensia not to push you, but do you have time to review this pr?

elro/hub.py Outdated Show resolved Hide resolved
@@ -50,6 +51,12 @@ async def sender_task(self):
await self.sync_scenes(0)
await self.get_device_names()

logging.info("Waiting until all devices are retreived")
await trio.sleep(5)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why 5s? Could we react to the actual event somehow?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The problem faced here is that it is not known how many devices will be returned. So we can wait for the first device name to return, but then we still don't know how much devices will show up. The best thing to do imo, is to rerun this sync some times more often, but it is not necessary to do this every 30 seconds. It takes some time to implement that. Is it ok that this becomes an issue and it is resolved later?

elro/hub.py Outdated Show resolved Hide resolved
elro/hub.py Outdated Show resolved Hide resolved
@hildensia
Copy link
Collaborator

Only minor things. Can you run the pep8 tool on your code to lint it?

@hildensia hildensia merged commit bc521be into dib0:master Jan 25, 2022
@Skons Skons mentioned this pull request Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants