Skip to content

Create switch.xiaomi_vacuum #2771

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

Merged
merged 12 commits into from
Jul 10, 2017
Merged

Create switch.xiaomi_vacuum #2771

merged 12 commits into from
Jul 10, 2017

Conversation

jcastro
Copy link
Contributor

@jcastro jcastro commented Jun 5, 2017

First revision

Description:

Pull request in home-assistant (if applicable): home-assistant/home-assistant#

The `xiaomi_vacuum`switch platforms allows you to control the state of your [Xiaomi Mi Robot Vacuum](http://www.mi.com/roomrobot/).
Current supported features are start and stop (go to dock).

{% linkable_title Installation %}
Copy link
Member

Choose a reason for hiding this comment

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

The installation should be unnecessary as homeassistant downloads the dependencies.

INFO:mirobo.vacuum: IP 192.168.8.1: Xiaomi Mi Robot Vacuum - token: b'ffffffffffffffffffffffffffffffff'
```

If the value is as shown above, the vacuum has already been connected and it needs a reset.
Copy link
Member

Choose a reason for hiding this comment

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

If the value is full of ffs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, at least is what I experienced when running the commands. Is it not clear enough, maybe?

```

Configuration variables:
- **name** (*Required*): The name of your robot
Copy link
Member

Choose a reason for hiding this comment

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

Name is not required at the moment, should it be?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wasn't sure about the required ones, will change it to optional then!

@@ -0,0 +1,47 @@
The `xiaomi_vacuum`switch platforms allows you to control the state of your [Xiaomi Mi Robot Vacuum](http://www.mi.com/roomrobot/).
Copy link
Member

Choose a reason for hiding this comment

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

Platform not platforms.

This token is only attainable before the device has been connected over the app to your local wifi.

In order to fetch the token, reset the robot, connect to its the network its announcing (rockrobo-XXXX)
and run the following command:
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if this part is too vague (for users who do not know how to access the virtualenv/environment of homeassistant), but can't directly think of how to write it out in a nicer manner.

INFO:mirobo.vacuum: IP 192.168.8.1: Xiaomi Mi Robot Vacuum - token: b'ffffffffffffffffffffffffffffffff'
```

If the value is as shown above, full of ffs, the vacuum has already been connected and it needs a reset.
Copy link
Member

@rytilahti rytilahti Jun 5, 2017

Choose a reason for hiding this comment

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

"full of ffs" sounds weird. Maybe it'd be better to rewrite it in a more user-friendly manner?
edit: other than these two things, I think it's fine from my side.

@rytilahti
Copy link
Member

One more note, all documentation needs an information table, see https://github.com/home-assistant/home-assistant.github.io/blob/current/source/_components/neato.markdown

@jcastro
Copy link
Contributor Author

jcastro commented Jun 5, 2017

@rytilahti oh great, thanks for letting me know! will add it in a bit!

@jcastro
Copy link
Contributor Author

jcastro commented Jun 5, 2017

@fabaff would you mind pointing me on the right direction to know where I should upload and what sizes and formats should the component image be like?

Sorry I need to ask for this but I've tried searching for example "telldus_tellstick.png" which is one of the current Switch components in the whole repository and I couldn't find the image, so I'm a bit lost on where I should upload it

@fabaff fabaff added the new-integration This PR adds documentation for a new Home Assistant integration label Jun 5, 2017
@fabaff
Copy link
Member

fabaff commented Jun 5, 2017

Images for brands are located in source/images/supported_brands. PNG is preferred because it allows a transparent background. Size doesn't really matter as the images will be scaled anyway. Something between 200px and 400px usually works well.

@jcastro
Copy link
Contributor Author

jcastro commented Jun 5, 2017

@fabaff thanks! I tried to upload a new image but it says I have no permissions. I'm attaching it here in case you can do it?

xiaomi_vacuum

Tweaks on info table
@Landrash
Copy link
Contributor

Landrash commented Jun 7, 2017

File name is wrong for this documentation.

@jcastro
Copy link
Contributor Author

jcastro commented Jun 7, 2017

@Landrash thanks for letting me know! I checked other switches and I followed same naming conventions. Would you mind telling me what's wrong in the file name?

Changed filename to .markdown
@Landrash
Copy link
Contributor

Landrash commented Jun 7, 2017

@jcastro Filename of the documentation needed to end with .markdown. Changed it for you.

Copy link
Contributor

@Landrash Landrash left a comment

Choose a reason for hiding this comment

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

Seems to be some information missing but looks good in general.

and run the following command:

```
mirobo discover
Copy link
Contributor

Choose a reason for hiding this comment

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

There seems to be some part missing on how the end users obtains this software.

{% linkable_title Getting started %}

To be able to communicate with the vacuum one needs to have its IP address as well as an encryption token.
This token is only attainable before the device has been connected over the app to your local wifi.
Copy link
Contributor

Choose a reason for hiding this comment

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

You must retrieve the token before using the mobile app to connect the device to your wireless network.

```

In order to fetch the token, reset the robot, connect to its the network its announcing (rockrobo-XXXX)
and run the following command:
Copy link
Contributor

Choose a reason for hiding this comment

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

In order to fetch the token, reset the vacuum following the instructions in the manual. Then,
connect to its built-in wireless network (**rockrobo-XXXX**) with a computer that has the
[python-mirobo](https://github.com/rytilahti/python-mirobo) package installed.
Run the following command:

```

If the value is exactly as shown above, meaning a lot of f letters, then the vacuum has already been connected and it needs a reset.

Copy link
Contributor

Choose a reason for hiding this comment

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

The token is the value between the single quotes. If the value is exactly as shown above
(`ffffffffffffffffffffffffffffffff`), the vacuum was previously configured and it needs to be
reset to obtain a valid token.

and run the following command:

```bash
mirobo discover
Copy link
Contributor

Choose a reason for hiding this comment

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

No information is provided on what needs to be installed for this command to be available.

Copy link
Contributor

Choose a reason for hiding this comment

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

In order to fetch the token, reset the vacuum following the instructions in the manual. Then, connect to its built-in wireless network (**rockrobo-XXXX**) with a computer that has the [python-mirobo](https://github.com/rytilahti/python-mirobo) package installed. Run the following command:

@balloob
Copy link
Member

balloob commented Jul 7, 2017

Please address the comments by Landrash.

{% linkable_title Getting started %}

To be able to communicate with the vacuum one needs to have its IP address as well as an encryption token.
This token is only attainable before the device has been connected over the app to your local wifi.
Copy link
Contributor

Choose a reason for hiding this comment

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

This sentence would be clearer as:
You must retrieve the token from the device before using the mobile app to connect it to your wireless network.

and run the following command:

```bash
mirobo discover
Copy link
Contributor

Choose a reason for hiding this comment

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

In order to fetch the token, reset the vacuum following the instructions in the manual. Then, connect to its built-in wireless network (**rockrobo-XXXX**) with a computer that has the [python-mirobo](https://github.com/rytilahti/python-mirobo) package installed. Run the following command:

INFO:mirobo.vacuum: IP 192.168.8.1: Xiaomi Mi Robot Vacuum - token: b'ffffffffffffffffffffffffffffffff'
```

If the value is exactly as shown above, meaning a lot of f letters, then the vacuum has already been connected and it needs a reset.
Copy link
Contributor

Choose a reason for hiding this comment

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

The token is the value between the single quotes. If the value is exactly as shown above
(`ffffffffffffffffffffffffffffffff`), the vacuum was previously configured and it needs to be
reset to obtain a valid token.

@bramkragten
Copy link
Member

bramkragten commented Jul 9, 2017

@jcastro Could you also take this PR in the documentation?

home-assistant/core#8416

Here are the services and fields:

xiaomi_vacuum_command:
  description: Send command to the vacuum.
  fields:
    command:
      description: Command to execute
      example: 'set_dnd_timer'
    params:
      description: Parameters for the command
      example: '[22,0,6,0]'

xiaomi_vacuum_set_fanspeed:
  description: Set the fanspeed.
  fields:
    fanspeed:
      description: Fanspeed, between 0 and 100
      example: '60'

xiaomi_vacuum_remote_control_start:
  description: Start remote control of the vacuum. You can then move it with xiaomi_vacuum_move_remote_control.

xiaomi_vacuum_remote_control_stop:
  description: Stop remote control mode of the vacuum.

xiaomi_vacuum_remote_control_move:
  description: Remote control the vacuum, make sure you first set it in remote control mode. With xiaomi_vacuum_start_remote_control.
  fields:
    velocity:
      description: Speed, between -0.3 - 0.3
      example: '0.2'
    rotation:
      description: Rotation, between -180 degrees and 180 degrees
      example: '90'
    duration:
      description: Duration of the movement?
      example: '1500'

xiaomi_vacuum_remote_control:
  description: Remote control the vacuum, only makes one move and then stops.
  fields:
    velocity:
      description: Speed, between -0.3 - 0.3
      example: '0.2'
    rotation:
      description: Rotation, between -180 degrees and 180 degrees
      example: '90'
    duration:
      description: Duration of the movement?
      example: '1500'

Copy link
Contributor Author

@jcastro jcastro left a comment

Choose a reason for hiding this comment

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

some changes

Update, collaboration from other users
Added WIP token instructions based on some reading
@jcastro
Copy link
Contributor Author

jcastro commented Jul 9, 2017

@bramkragten sure, will add it!

@jcastro
Copy link
Contributor Author

jcastro commented Jul 9, 2017

@bramkragten umm I'm a bit lost on how to structure it, mostly because I'm not too much into entities, attributes, services, etc... do you think a table like the ones here would be ok? https://home-assistant.io/components/media_player.plex/

@bramkragten
Copy link
Member

@jcastro yeah, that would work fine!

Copy link
Contributor

@Landrash Landrash left a comment

Choose a reason for hiding this comment

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

Looks good and will be merged since parent PR has been merged.

@Landrash
Copy link
Contributor

@jcastro Want me to merge this as as and you'll create a new one for the services?

@jcastro
Copy link
Contributor Author

jcastro commented Jul 10, 2017

@Landrash sure, sounds good!

@Landrash Landrash merged commit c7d4a93 into home-assistant:next Jul 10, 2017
@rytilahti
Copy link
Member

Thank you @jcastro for doing the leg work and thanks @Landrash for comments and for the merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-integration This PR adds documentation for a new Home Assistant integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants