jghaanstra/com.xiaomi-miio

Support Xiaomi Smart Pet Food Feeder

Zmove opened this issue · 25 comments

Zmove commented

Hello,

It would be great to add support of Xiaomi Smart Pet Food Feeder device.

See the product here : https://www.mi.com/global/product/xiaomi-smart-pet-food-feeder/

The Smart Pet Fountain is already supported, adding the support of the food device would be a perfect combo.

Thank you

Did you read this: https://github.com/jghaanstra/com.xiaomi-miio/wiki/Adding-new-devices

I'm unable to find much documentation about this device. I can try to add it based on what I found online but without any garantee. If it doesnt work and you want it integrated you need to send me the characteristics of the device or donate a device so I can integrate it.

At the very least you will need to send me the device model you have which is something like mmgg.feeder.fi1 or mmgg.feeder.petfeeder.

Zmove commented

Could you explain in further details what controls for the feeder are available and how you would like to see these implemented in Homey. The documentation doesnt make much sense without have at least a basic understanding of what the device is capable of.

Please explain it based on this documentation: https://home.miot-spec.com/spec/mmgg.feeder.fi1

Zmove commented

You can post images when replying over email.

But what you are describing is way to complex to implement without having the actual device and the lack of proper documentation. I would be happy if I could even get the distribution of one portion working. I'll see what I can do.,

Zmove commented

Hi @jghaanstra

I thought I could continue in this thread instead of the general one.

I got my device yesterday. Got the miiocli devtool working aswell as I did a wireshark... But the pcap decryption doesn't reply anything.

I would like to be as helpful as I can in this case, since I really would like to get it to work with Homey.

So what I did get this far:

== Xiaomi Smart Pet Food Feeder (Device online ) ==
Model: mmgg.feeder.fi1
Token: c98c24982c60b01014ada932d*******
IP: 10.10.10.217 (mac: EC:4D:3E:10:7D:55)
DID: 467588959
Locale: de
Other fields:
family_id: 0
pd_id: 74716
shareFlag: 0
show_mode: 1
reset_flag: 0
extra: {'isSetPincode': 0, 'pincodeType': 0, 'fw_version': '2.1.3', 'needVerifyCode': 0, 'isPasswordEncrypt': 0, 'mcu_version': '0015'}
permitLevel: 16
uid: 6170057195
password:
longitude: 0.0
latitude: 0.0
p2p_id:
adminFlag: 1
pid: 0

When I do a Wireshark after a command via the emulated app through BlueStack emulator, the device does indeed work and I can see the communication thru the cloud into my device.

When I save the pcap file and use my token as a decryption, it doesnt return anything.
miiocli devtools parse-pcap C:\temp\miio-feeder4.pcap c98c24982c60b01014ada932d*******

I did 4 captures, first one filtered to only my computers IP, which I thought could be the reason... The second one without filter. At that attemt, I actually got a reply, without any sufficient info though...

C:\Windows\System32>miiocli devtools parse-pcap C:\temp\miio-feeder2.pcap c98c24982c60b01014ada932d*******

== stats ==
miio_packets: 1
empty_packets: 1

The 3rd and 4th capture didn't resolve anything either.

I also tried running the genericmiot command, giving me plenty of errors. :)

C:\Windows\System32>miiocli genericmiot --ip 10.10.10.217 --token c98c24982c60b01014ada932d******* status
Running command status
ERROR:miio.click_common:Exception: Unable to discover the device 10.10.10.217
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\miio\click_common.py", line 54, in call
return self.main(*args, **kwargs)
File "C:\Python310\lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "C:\Python310\lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Python310\lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Python310\lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Python310\lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "C:\Python310\lib\site-packages\miio\click_common.py", line 305, in wrap
result = kwargs["result"] = func(*args, **kwargs)
File "C:\Python310\lib\site-packages\click\decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "C:\Python310\lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "C:\Python310\lib\site-packages\miio\click_common.py", line 270, in command_callback
return miio_command.call(miio_device, *args, **kwargs)
File "C:\Python310\lib\site-packages\miio\click_common.py", line 218, in call
return method(*args, **kwargs)
File "C:\Python310\lib\site-packages\miio\click_common.py", line 184, in _wrap
self._fetch_info()
File "C:\Python310\lib\site-packages\miio\integrations\genericmiot\genericmiot.py", line 198, in _fetch_info
info = super()._fetch_info()
File "C:\Python310\lib\site-packages\miio\device.py", line 163, in _fetch_info
devinfo = DeviceInfo(self.send("miIO.info"))
File "C:\Python310\lib\site-packages\miio\device.py", line 122, in send
return self._protocol.send(
File "C:\Python310\lib\site-packages\miio\miioprotocol.py", line 162, in send
self.send_handshake()
File "C:\Python310\lib\site-packages\miio\miioprotocol.py", line 75, in send_handshake
raise DeviceException("Unable to discover the device %s" % self.ip)
miio.exceptions.DeviceException: Unable to discover the device 10.10.10.217

So I am clearly doing something wrong, but I can't find out what.

If you can help me to sort out what I am doing wrong, I'll gladly chare any output I can to help you integrate the device into the app.

Best regards
Richard

don't know if it helps but found this: https://home.miot-spec.com/spec/mmgg.feeder.fi1 and this: al-one/hass-xiaomi-miot#220 I dont know where you live in the netherland but it is possible to lend you the device if needed.

don't know if it helps but found this: https://home.miot-spec.com/spec/mmgg.feeder.fi1 and this: al-one/hass-xiaomi-miot#220 I dont know where you live in the netherland but it is possible to lend you the device if needed.

Thanx, I'm aware of the miot spec (I use this site for integration of most of the devices and it's already posted above here ;-) ). The issue with the pet fooder is translating it to meaningful capabilities in Homey. What I can probably do is this:

  • Fault registration and trigger card
  • Food left level (normal, low, empty) plus triggercard
  • Serve portion of food trigger card (not entirely clear from the docs but I think I can get that to work)

don't know if it helps but found this: https://home.miot-spec.com/spec/mmgg.feeder.fi1 and this: al-one/hass-xiaomi-miot#220 I dont know where you live in the netherland but it is possible to lend you the device if needed.

Thanx, I'm aware of the miot spec (I use this site for integration of most of the devices and it's already posted above here ;-) ). The issue with the pet fooder is translating it to meaningful capabilities in Homey. What I can probably do is this:

  • Fault registration and trigger card
  • Food left level (normal, low, empty) plus triggercard
  • Serve portion of food trigger card (not entirely clear from the docs but I think I can get that to work)

I would like to to use the pet feeding trigger cards to be able to only feed X portions while we are at home. For this Im going to use the Tractive GPS tracker Homey app to apply the condition. When the GPs is within a certain area, the extraction of X portions will be done at the current schedule.

In the standard app, you can set a fixed schedule when to extract X portions - but that will "go to waste" when we aren't at home.

I would also like my daugthers to push a physical button (with an timeout to not be able to push more than one action), to do an extraction action if something goes wrong with the GPS trackcing.

Best Regards
Richard

I'm owning such a device and using it through an custom component in Home Assistant. I'm switching to Homey, therefore the support for this device would be great. If needed I can share input from the existing custom component.
At the moment I'm only using the function to "pet feed X portion" to the dog, but as you can not specify how many portions like in the app, i have build a flow where the "feed pet button" is pressed a defined number of times in a loop.

Let me know if you need specifics. Would be great to get this device supported!

Anything new in the case that you have the information you need to be able to integrate it?

Anything new in the case that you have the information you need to be able to integrate it?

Nope.

At the moment I'm only using the function to "pet feed X portion" to the dog, but as you can not specify how many portions like in the app, i have build a flow where the "feed pet button" is pressed a defined number of times in a loop.

If you are using ut as a service with the mapping as parameters posting your automations here would surely help me understand how API of the device works.

Please test release 3.2.17 which contains experimental and basic support for this device. The release is pending approval by Athom in the app store but you can test it through the test channel

https://homey.app/a/com.xiaomi-miio/test/

Please test release 3.2.17 which contains experimental and basic support for this device. The release is pending approval by Athom in the app store but you can test it through the test channel

https://homey.app/a/com.xiaomi-miio/test/

The setup went smooth the second time. First time the pair session timeout because it took me about 5 minutes to find my token.

So after the connection was completed, i saw it in homey gui, but after the first update in the app, i got this error message:

Screenshot_20231014_195415_Homey

The bin is currently empty on food, so i think the status value has to match the empty state, which it doesnt right now (from what i can understand from the error message).

So after the connection was completed, i saw it in homey gui, but after the first update in the app, i got this error message:

Just noticed a bug which I'll fix first, could be that resolves this issue. Will be added on the next release.

Thank you for taking the time to get it into the app. But as the others also write, an error message comes up when it has been added.

A possible fix has been added with release 3.2.18 which is currently pending Athom's approval in the app store. You can test it by installing the test version.

https://homey.app/a/com.xiaomi-miio/test/

Closed due to lack of response.

Hello. Now I have tested it through, and here is my experience of it.
It seems fine to be able to serve food. And when there is a lack of food in the container, it also lets you know.
However, the action called Mode Has Changed does not work as intended.
Because when the machine starts to get empty, yes, it tells you that if you have used "Mode has changed", but when you fill up the container and the sensor detects that there is no food missing in the machine, "Mode has changed" is triggered again.
Here, the difference between empty and full is missing. It would be great if it could be fixed, because then it is just as it should be.

"Mode has changed" is triggered again.
Here, the difference between empty and full is missing. It would be great if it could be fixed, because then it is just as it should be.

The old an new mode values are available as tokens in the "mode has changed" trigger card when it's triggered. You should use condition logic to determine what triggered the card.

condition logic
I have now tried that, but without success. It does not work. Is there something I'm not doing right? I have made a screenshot of my flow so you can see it. But why can't the cards be just like on the Smart Pet Water Dispenser? Here the cards are called Water alarm is activated and Water alarm was deactivated.

Skærmbillede 2023-10-29 kl  20 03 06

First check the actual value of the new / previous mode before filtering on it. It's not medium or silent but Normal | Low | Empty.

Now I got it to work. Thank you so much.