merdok / homebridge-miot

Homebridge plugin for devices supporting the Xiaomi miot protocol
MIT License
392 stars 61 forks source link

Smart pet feeder #429

Closed kinouzero closed 1 year ago

kinouzero commented 1 year ago

Device model mmgg.feeder.fi1

Device name Xiaomi Smart Pet Food Feeder

Does the device require a MiCloud connection? Do not know

Anything special about the device? It can be controlled with actionButton : { "action": "pet-feeder:pet-food-out", "name": "Feed", "params": [ "1" ] } But cannot control the number of portion, incrementation of the param doesn't affect portions.

Some properties parsing generate errors : [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Preparing property poll! [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Error while parsing response from device for property pet-feeder:fault. Response: {"did":"413682609","siid":2,"piid":1,"code":-4004} [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Error while parsing response from device for property pet-feeder:pet-food-left-level. Response: {"did":"413682609","siid":2,"piid":6,"code":-4004} [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Error while parsing response from device for property indicator-light:on. Response: {"did":"413682609","siid":3,"piid":1,"code":-4004} [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Error while parsing response from device for property desiccant:desiccant-left-time. Response: {"did":"413682609","siid":11,"piid":2,"code":-4004} [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Error while parsing response from device for property feedserve:outfood-num. Response: {"did":"413682609","siid":4,"piid":4,"code":-4004} [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Error while parsing response from device for property feedserve:outfood-id. Response: {"did":"413682609","siid":4,"piid":5,"code":-4004} [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Error while parsing response from device for property feedserve:outletstatus. Response: {"did":"413682609","siid":4,"piid":8,"code":-4004} [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Error while parsing response from device for property feedserve:doorstatus. Response: {"did":"413682609","siid":4,"piid":9,"code":-4004} [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Error while parsing response from device for property feedplanserve:feedplan-contr. Response: {"did":"413682609","siid":5,"piid":5,"code":-4004} [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Error while parsing response from device for property keyserve:key-stat. Response: {"did":"413682609","siid":6,"piid":1,"code":-4004} [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Error while parsing response from device for property clearnserve:cleantime. Response: {"did":"413682609","siid":8,"piid":1,"code":-4004} [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Error while parsing response from device for property devicecontrolserve:factory-result. Response: {"did":"413682609","siid":9,"piid":11,"code":-4004} [2/2/2023, 1:38:32 PM] [miot] [Pet Feeder] Error while parsing response from device for property devicecontrolserve:contrycode. Response: {"did":"413682609","siid":9,"piid":13,"code":-4004}

merdok commented 1 year ago

You would need to look at the spec here: http://www.merdok.org/miotspec/?model=mmgg.feeder.fi1 Based on that you can set the action parameters, or even using propertyControl expose the needed properties and change them.

The specified action accepts the property pet-feeder:feeding-measure and this is a value type uint, so you probably would need to change your action to: { "action": "pet-feeder:pet-food-out", "name": "Feed", "params": [ 1 ] }

kinouzero commented 1 year ago

Thanks !

The IHM automatically put the value between double quotes (type string) maybe useful to indicate the type of the value to avoid this sort of problem, I've to edit manually the config to avoid this issue every time I made a change through the IHM.

An example of config to feed specific numbers of portion and food level indicators :

{ "name": "Pet Feeder", "ip": "****", "token": "****", "deviceId": "****", "model": "mmgg.feeder.fi1", "pollingInterval": 10, "deepDebugLog": false, "customAccessory": false, "onlyMainService": false, "buzzerControl": false, "ledControl": false, "childLockControl": false, "modeControl": false, "actionButtons": [ { "action": "pet-feeder:pet-food-out", "name": "Feed", "params": [ 7 ] } ], "propertyMonitor": [ { "property": "pet-feeder:pet-food-left-level", "name": "Food Normal", "value": 0, "linkedProperty": "pet-feeder:pet-food-left-level", "linkedPropertyValue": 0 }, { "property": "pet-feeder:pet-food-left-level", "name": "Food Low", "value": 1, "linkedProperty": "pet-feeder:pet-food-left-level", "linkedPropertyValue": 1 }, { "property": "pet-feeder:pet-food-left-level", "name": "Food Empty", "value": 2, "linkedProperty": "pet-feeder:pet-food-left-level", "linkedPropertyValue": 2 } ] }

I've also purchased the Smart Pet Fountain and with the same spirit, control + no water indicator :

{ "name": "Pet Fountain", "ip": "****", "token": "*****", "deviceId": "*****", "model": "mmgg.pet_waterer.s1", "pollingInterval": 10, "deepDebugLog": false, "buzzerControl": false, "ledControl": true, "childLockControl": false, "modeControl": false, "propertyMonitor": [ { "property": "no-water-flag:no-water-flag", "name": "Water Empty", "value": false, "linkedProperty": "no-water-flag:no-water-flag", "linkedPropertyValue": false } ] }

Is it possible to improve what type of device is used for property control ? Light or sensor is very limited but I don't have any idea of what type it'll be useful to add

merdok commented 1 year ago

Yeah, well in in the homebridge ui i need to specify up front what kind of type the property is, hence it is not possible to do that in a generic way there. Editing the config.json manually is the recommended way here.

Also HomeKit is very limited to display values, hence you only have this options. There is no other way to display a value then to use a light sensor for that purpose so this is the best which we have currently. Hopefully that will change in the future...

kinouzero commented 1 year ago

Hi, I've seen you added native support for pet feeder, that's great ! But the switch accessory created is useless and pollute HomeKit devices list, if you can add support for manually feeding with personalized portions that would be awesome or if you can't to keep the more flexibility possible on your plugin, remove it since it serve nothing. Thanks 👍

merdok commented 1 year ago

The switch uses the pet-food-out action which I think is the one used to distribute food, right? Why do you think that this is useless?

kinouzero commented 1 year ago

Yes it's the good action but without parameters the switch do nothing, my current config has a params for this action

"actionButtons": [ { "action": "pet-feeder:pet-food-out", "name": "Pet Feeder", "params": [ 7 ] } ],

merdok commented 1 year ago

Oh, that is a good point that the action needs a parameter. I might add a default one then!

RavidCo commented 1 year ago

Hi, joining the issue.

I am also experiencing the same problem.

Also can't get the sensors to respond, for example when the food runs out or reaches a low level, the sensor doesn't report

kinouzero commented 1 year ago

Hi, for your sensor you need to link to a property and property value, the sensors are working in my config

"propertyMonitor": [ { "property": "pet-feeder:pet-food-left-level", "name": "Food Normal", "value": 0, "linkedProperty": "pet-feeder:pet-food-left-level", "linkedPropertyValue": 0 }, { "property": "pet-feeder:pet-food-left-level", "name": "Food Low", "value": 1, "linkedProperty": "pet-feeder:pet-food-left-level", "linkedPropertyValue": 1 }, { "property": "pet-feeder:pet-food-left-level", "name": "Food Empty", "value": 2, "linkedProperty": "pet-feeder:pet-food-left-level", "linkedPropertyValue": 2 } ]

RavidCo commented 1 year ago

Thank you, going to check it out.

Hope the metered feeding parameter will be resolved soon, my dog ​​is hungry lol

merdok commented 1 year ago

Yeah, probably next week I will be able to fix it. Don't have access to my development PC right now... Until that you can create a custom action button with the parameter set.

RavidCo commented 1 year ago

Thank you very much for your time. I will check the option you suggested

RavidCo commented 1 year ago

I checked your offer, and even with an action button, it outputs a fixed amount, and not what is set in the parameter

"actionButtons": [ { "action": "pet-feeder:pet-food-out", "name": "Button", "params": [ 20 ]

merdok commented 1 year ago

@kinouzero might be able to help you with that.

kinouzero commented 1 year ago

Your config looks OK, if the } ] missing at the end is just an omission, it's weird that the param isn't working. The param is an integer so you need to remove the " (double quotes) around it if the config interface force the double quotes, if you edit by the interface the param will always be a string between double quotes, you need to edit the config by hand.

RavidCo commented 1 year ago

Is just an omission. I already remove the " (double quotes) around it

I edit the config by hand.

wired no?

RavidCo commented 1 year ago

"actionButtons": [ { "action": "pet-feeder:pet-food-out", "name": "Button", "params": [ 20 ] } ], "propertyControl": [ { "property": "pet-feeder:feeding-measure", "name": "Button", "value": 20, "linkedProperty": "pet-feeder:feeding-measure" } ],

kinouzero commented 1 year ago

Maybe the same name for 2 different things cause conflict and I don't think the propertyControl is needed, just the actionButton as it is should work

RavidCo commented 1 year ago

I thought about that too, and tried without. Still not spending set amount.

In the first place, I tried with, because of merdok's response

RavidCo commented 1 year ago

093ECC86-2E0F-4CC7-A516-9237F456BF01

merdok commented 1 year ago

The pet-feeder:feeding-measure orioerty has no access so it cannot be accessed directly. It can only be used as a param for the pet-feeder:pet-food-out action

RavidCo commented 1 year ago

Ok, and if I define as you mentioned, what is the param I should config in the action, param, “null”?

Below this is my configurations now, without pet-feeder:feeding-measure, and still it’s not working. Do you understand why?

"actionButtons": [ { "action": "pet-feeder:pet-food-out", "name": "Button", "params": [ 20 ] } ],

merdok commented 1 year ago

kinouzero posted a working config so you should use that as a base. I do not know what it is not working for you, the config looks ok. Do you have the exactly same device as kinouzero?

RavidCo commented 1 year ago

I did what he said, and yes we have the same device

merdok commented 1 year ago

Sorry i have no other ideas as i do not have the mentioned device.

RavidCo commented 1 year ago

thanks anyway.

I joined the topic, because from what I understood he also experienced the same problem as me, but maybe I misunderstood

RavidCo commented 1 year ago

Ok, I solved the matter with an action button, as you mentioned, only that I had micloud setting marked at first, as soon as I removed it, everything worked fine

merdok commented 1 year ago

Oh interesting, I wonder if the params are not properly send over micloud! Could you please try again with micloud and post a deep debug log from when you press the button so I can see what is exactly sent?

RavidCo commented 1 year ago

Another small question, in this guide: http://www.merdok.org/miotspec/?model=mmgg.feeder.fi1

when I see “-“, what should be the value? null? False?

RavidCo commented 1 year ago

Oh interesting, I wonder if the params are not properly send over micloud! Could you please try again with micloud and post a deep debug log from when you press the button so I can see what is exactly sent?

Yes I can, but I left the house. it's urgent?

merdok commented 1 year ago

Not urgent, whenever you have time 😃

“-“ means nay value which is in the correct format.

RavidCo commented 1 year ago

I hope I can make time in the evening.

So if I understood you correctly about the "-", when it's in the manual, I don't actually mark anything? this is what you mean by nay value

RavidCo commented 1 year ago

Oh interesting, I wonder if the params are not properly send over micloud! Could you please try again with micloud and post a deep debug log from when you press the button so I can see what is exactly sent?

Yes I can, but I left the house. it's urgent?

Hi, I checked for you.
But there is something strange, I mark a deepbuglog in the plugin, I marked MyCloud, but nothing appears in the log...

RavidCo commented 1 year ago

I hope I can make time in the evening.

So if I understood you correctly about the "-", when it's in the manual, I don't actually mark anything? this is what you mean by nay value

@merdok Maybe you missed it :)

merdok commented 1 year ago

@RavidCo i do not understand your question. If Value List has a "-" then you can enter any value in the correct format.

Check the https://github.com/merdok/homebridge-miot#troubleshooting section

RavidCo commented 1 year ago

@RavidCo i do not understand your question. If Value List has a "-" then you can enter any value in the correct format.

Check the https://github.com/merdok/homebridge-miot#troubleshooting section

I try to explain In here http://www.merdok.org/miotspec/?model=chuangmi.camera.046a01

I can add property motion-detection:motion-detection

When I add a number It’s exposed a light sensor When I add fulse/true It’s exposed a presence sensor And that what I want But, the sensor don’t respond

my current config is: "propertyMonitor": [ { "property": "motion-detection:motion-detection", "name": "Motion Detection", "value": false, "linkedProperty": "motion-detection:motion-detection", "linkedPropertyValue": true } ]

merdok commented 1 year ago

This is a configuration field to enable or disable motion detection not the motion detection itself.

RavidCo commented 1 year ago

This is a configuration field to enable or disable motion detection not the motion detection itself.

Sorry, I do not understand your explanation

what in need to write in value and linkedPropertyValue? Nothing?

merdok commented 1 year ago

First off, this issue is not about motion detection or cameras... Second, this is a configuration field for you camera to enable or disable motion detection. This will not trigger when motion is detected. linkedPropertyValue will not bring you anything.

RavidCo commented 1 year ago

First off, this issue is not about motion detection or cameras... Second, this is a configuration field for you camera to enable or disable motion detection. This will not trigger when motion is detected. linkedPropertyValue will not bring you anything.

Sorry, you're right. Thanks for the help

merdok commented 1 year ago

Added a default value in version 1.6.0

kinouzero commented 1 year ago

Great and can we personalize it ?

merdok commented 1 year ago

I just added the value which you recommended so why do you want to personalize it?

kinouzero commented 1 year ago

The owners don't serve the same number of portion for their animals, and if you put just 1 by default you have to hit the button x times (in my case 14 times...) it's not very convenient.

The value is needed for this to work but to personalize it is the goal

kinouzero commented 1 year ago

You have this property pet-feeder:feeding-measure but in the spec it's not writable

http://www.merdok.org/miotspec/?model=mmgg.feeder.fi1

merdok commented 1 year ago

Maybe at some point a slider or a config property can be added to control that value...

RavidCo commented 1 year ago

Hey, thanks for the update.
I checked, and it still doesn't seem to work.

I put the: “pet-feeder:feeding-measure” under “property control” with a value 1, and then, also without a value at all.

And the button still doesn't do anything in both modes (with/without value)

Did I set it right?

merdok commented 1 year ago

It seems like your token might be wrong, I am no not sure what else might be incorrect.