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

How do I find more features? #10

Closed
1043717432 opened this issue May 19, 2017 · 25 comments
Closed

How do I find more features? #10

1043717432 opened this issue May 19, 2017 · 25 comments

Comments

@1043717432
Copy link

Mi vacuum sweeper APP, there are many practical functions, how to develop it? For example, what code is used to test, send, and receive to get a valid function?. I can test it! But I don't know what code to send!

@rytilahti
Copy link
Owner

rytilahti commented May 19, 2017

The commands would need to be extracted from the communication between the robot and the app (maybe the information found on https://github.com/OpenMiHome/mihome-binary-protocol can help with decrypting) or found elsewhere.

When the commands are known they can be tested with raw_command, for example:

mirobo raw_command set_dnd_timer '[22,0,8,0]'

or

mirobo raw_command app_start

What kind of features do you find practical we are missing right now?

@bramkragten
Copy link

Hi @rytilahti,

First thanks for the great work!

A function that I would find helpful is the remote control.

My mirobo lives under the couch, so to empty the dustbin I have to let him come out with the remote control, empty him and send him to the dock.

Would love to be able to program one button and have the vacuum come under the couch and stop. So programming a certain amount of presses off the remote function in a row.

Would that be possible?

Thanks!

@rytilahti
Copy link
Owner

Yes, that's possible and looks like the required commands for manual control are listed also here: https://github.com/ioBroker/ioBroker.mihome-vacuum/blob/master/README.md#sende-eigene-kommandos . Currently you could test it out with raw_command command of mirobo to see if it fits, implementing proper wrappers to make commanding easier should also not be too hard (requires just modifying vacuum.py file).

@bramkragten
Copy link

Great Thanks! Was searching for that list.

Would you like a PR when I have implemented it? Would like to add it to the Home assistant component as well.

@rytilahti
Copy link
Owner

Patches and PRs are definitely welcome. I will still have to fix the issue with never firmwares properly (to release 0.1.0 and bump the homeassistant component), and as I saw your message I thought including control mode to the same release would be nice.

@1043717432
Copy link
Author

Thank you Looking forward to sharing, cheers!

@bramkragten
Copy link

OK, I added it to vacuum.py and added a service to the home assistant component. Should I make a PR at home assistant for that, or should I send it to you so you can add it (and check, not to familiar with hass...)?

@rytilahti
Copy link
Owner

Both are fine for me, however, please lets get those vacuum.py changes merged here, so that then I can release 0.1.0 and the version can be bumped for the home assistant component. If you want I can check the component and make a PR to homeassistant.

Btw, did you base your component modifications on the component already in homeassistant's repository? It got merged earlier this week and the one in this repository is not up to date.

@bramkragten
Copy link

It is based on the PR in the hass repo.

Everything is working, and the device enters remote control mode, but I can't get it moving yet... don't know what I'm doing wrong.

Do you know if there is any documentation about this function?

@rytilahti
Copy link
Owner

rytilahti commented Jul 8, 2017

In the previous link there's app_rc_move with the following parameters, I translated them:

[{"seqnum":'0-1000',"velocity":velocity,"omega":rotation,"duration":duration}]
velocity = -0.3 - 0.3,
rotation = -3.1 - 3.1
duration = milliseconds?

Here's also a longer example of the messaging: http://www.roboter-forum.com/showthread.php?18752-Das-System-hinter-dem-Robo&p=214572&viewfull=1#post214572 so:

  1. app_rc_start for starting
  2. app_rc_move for ordering the moves, sequence number needs to be increased.
  3. app_rc_end to end the manual mode.

@rytilahti
Copy link
Owner

I just tested it a bit with raw_commands, these seem to work:

  1. Moving onwards (when already started)
mirobo -dd raw_command app_rc_move '[{"seqnum":2,"velocity":0.2,"omega":0.0,"duration":1500}]'
  1. Move back
mirobo -dd raw_command app_rc_move '[{"seqnum":3,"velocity":-0.2,"omega":0.0,"duration":1500}]'

  1. End
mirobo -dd raw_command app_rc_end '[{"seqnum":4}]'

@bramkragten
Copy link

I have:

 def rc_move_once(self, speed, direction, duration):
        self.send("app_rc_start")
        time.sleep(30)
        self.send("app_rc_move", [{"omega":direction,"velocity":speed,"seqnum":1,"duration":duration}])
        time.sleep(30)
        return self.send("app_rc_end", [{"seqnum":2}])

and calling:

vacuum.rc_move_once(0.3, 0.0, 1500)
But it is not moving (added the sleep because I thought it might be sending the command to soon or something...) it just says "using remote control" and stopping after a minute.

@rytilahti
Copy link
Owner

rytilahti commented Jul 8, 2017

That sleep delays it for 30 seconds, maybe that's too long? What does it display when using -d?

DEBUG:mirobo.device:192.168.250.219:54321 >>: {'method': 'app_rc_start', 'id': 76}
DEBUG:mirobo.device:192.168.250.219:54321 (ts: 1970-01-01 19:41:32, id: 76) << {'result': 0, 'id': 76}

DEBUG:mirobo.device:192.168.250.219:54321 >>: {'method': 'app_rc_move', 'id': 80, 'params': [{'omega': 0.0, 'velocity': 0.2, 'seqnum': 5, 'duration': 3000}]}
DEBUG:mirobo.device:192.168.250.219:54321 (ts: 1970-01-01 19:42:20, id: 80) << {'id': 80, 'result': 0}

DEBUG:mirobo.device:192.168.250.219:54321 >>: {'params': [{'seqnum': 5}], 'id': 81, 'method': 'app_rc_end'}
DEBUG:mirobo.device:192.168.250.219:54321 (ts: 1970-01-01 19:42:32, id: 81) << {'result': 0, 'id': 81}

@bramkragten
Copy link

Tried every delay possible (and without...) same result. Don't know, will keep trying...

In hass, I get a lot of time outs, is that happening for you too?

@rytilahti
Copy link
Owner

Hmm, if you don't mind I will try to implement it, what types of commands would you be expecting to have? Move forward, turn left, turn right, move backwards with adjustable angles and speeds?

About the timeouts, are you using the current git master or a released version?

@bramkragten
Copy link

Sure, no problem. I just need it to move forwards, but have it made now that you just put in speed, direction and duration.

I'm using 0.9. I will put the home assistant component in my repo and send you the link.

@rytilahti
Copy link
Owner

rytilahti commented Jul 8, 2017

Actually could you submit that after bumping the version & testing, I can do a code review then on homeassistant repo? I just uploaded new 0.1.0 with basic remote control features, the values for omega, velocity and duration are unknown, although omega lets rotations, velocity backwards/forwards. Duration itself doesn't seem to be a duration but something else.

@bramkragten
Copy link

Nice, I like the way you've done that. I will update the component to play nice with the new version, and then do a PR in the hass repo.

@bramkragten
Copy link

home-assistant/core#8416

@1043717432
Copy link
Author

Thank you. I got a lot of good news! Cheers!

@marksev1
Copy link

Bramkragten, how would I do it in home-assistant that I would press some buttons (forward, left, right, back) and the robot would move while the button was pressed? Or possibly with some joystick style controller (RemoteXY app for android which can be tied with Node-red and HASS), if such an interface could be implemented for HASS it would be really nice.

@bramkragten
Copy link

You would have to deal with that mostly outside of Home Assistant, you should call the service every so many seconds while the button is pressed.

@marksev1
Copy link

marksev1 commented Aug 25, 2017 via email

@rytilahti
Copy link
Owner

As the discussion has turned towards homeassistant functionality and the manual controls are already in place, I will close this for now. If there is interest in adding support for progressive speed controls, I'm open for suggestions and PRs, but those can be handled in separate issues.

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

No branches or pull requests

4 participants