python-miio icon indicating copy to clipboard operation
python-miio copied to clipboard

Xiaomi Xiaowan Smart pet feeder mmgg.feeder.petfeeder

Open AlexPotterOnGit opened this issue 4 years ago • 6 comments

Before submitting a new request, use the search to see if there is an existing issue for the device.

Device information:

  • Name(s) of the device: Xiaomi pet feeder
  • Link:

Use miiocli device --ip <ip address> --token <token>.

  • Model: mmgg.feeder.petfeeder
  • Hardware version: esp8266
  • Firmware version: 2.1.3

Additional context If you know already about potential commands or any other useful information to add support for the device, please add that information here.

Hi team,

I'm not a developer but have the device above and would like to contribute to support of it if possible. I installed miiocli and can communicate with it. Just don't know next steps which needs to be done. If you could point me out the right direction will be appreciated.

AlexPotterOnGit avatar May 14 '21 10:05 AlexPotterOnGit

@AlexPotterOnGit You could try similar way as for Pet Water Dispenser but I'm not sure about token flow:

  • hold hardware button to initialize provisioning mode
  • device should indicate that it's waiting for connection (e.g. blue blinking light)
  • connect from laptop to device's wifi (ssid usually contain model name)
  • run miiocli discover --no-mdns
  • output should print token and it should be different from 00000000000000000000000000000000 or ffffffffffffffffffffffffffffffff
  • check that token is valid miiocli device --ip <device_ip> --token <device_discovered_token> info
  • previous command should print model, hardware and firmware version
  • connect device to 2.4Ghz wifi miiocli device --ip <device_ip> --token <device_discovered_token> raw_command miIO.config_router '[{"ssid": "<your_wifi_name>", "passwd": "<your_wifi_password>", "uid": <your_xiaomi_account_user_id>}]'
  • device will print ok, changed it's network address and turn off (you could turn it back manually)
  • after success provisioning and if wifi have internet access, device will regenerate token and send it to Xiaomi cloud for subsequent use via their app
  • to get provisioned token from Xiaomi cloud you could use https://github.com/Squachen/micloud#in-terminal micloud --username [email protected] --country cn --pretty
  • new token should be printed out if device is belong to account and country
  • if wifi network does not have internet access it should not regenerate token
  • go to https://home.miot-spec.com/spec/mmgg.feeder.spec for siid/piid/aiid
  • example: get feedtotal and outfood-num property miiocli device --ip <device_ip> --token <device_token> raw_command get_properties '[{"siid": 4, "piid": 2}, {"siid": 4, "piid": 4}]'
  • example: set server-time-zone property miiocli device --ip <device_ip> --token <device_token> raw_command set_properties '[{"siid": 9, "piid": 13, "value": 3}]'
  • example: run pet-food-out action miiocli device --ip <device_ip> --token <device_token> raw_command action '{"did": "", "siid": 2, "aiid": 1, "in":[]}'
  • example device with similar realization https://github.com/rytilahti/python-miio/blob/master/miio/huizuo.py
  • base class with proper action, getter and setter methods https://github.com/rytilahti/python-miio/blob/master/miio/miot_device.py

ofen avatar Nov 02 '21 09:11 ofen

Great instructions, appreciated. Let me give it a try tonight.

AlexPotterOnGit avatar Nov 02 '21 10:11 AlexPotterOnGit

Great instructions @ofen!

Would you mind creating a PR to add a note or two based on your experiences to https://python-miio.readthedocs.io/en/latest/contributing.html#miot-devices (https://github.com/rytilahti/python-miio/blob/master/docs/contributing.rst#miot-devices) based on what you just wrote above?

rytilahti avatar Nov 03 '21 00:11 rytilahti

Sadly it doesn't follow it's own published miot spec 🤦

But we've worked out all the available miio methods and format now.

See: https://github.com/al-one/hass-xiaomi-miot/issues/220

Wh1terat avatar Dec 05 '21 04:12 Wh1terat

https://github.com/rytilahti/python-miio/pull/1210

Wh1terat avatar Dec 06 '21 03:12 Wh1terat

  • raw_command action '{"did": "", "siid": 2, "aiid": 1, "in":[]}'

Dude you are amazing!

Charliecheung2 avatar Mar 14 '23 04:03 Charliecheung2