merdok / homebridge-miot

Homebridge plugin for devices supporting the Xiaomi miot protocol
MIT License
394 stars 63 forks source link

Support for MYSH0E1ACM #293

Closed ghost closed 2 years ago

ghost commented 2 years ago

I have a new Multifunctional Kettle, setup in my Xiaomi Home App. I retrieved the token and added a new blank device. Without any actionButtons I only have one power button and a temp indicator in the Home app, without any functionality. If I set the actionButtons to true I have a total of 13 switches within the device available, but they do not execute anything and it ends in a no response.

My log shows:

[7/1/2022, 3:11:31 PM] [homebridge-miot] [Kettle] Device found: chunmi.health_pot.a1
[7/1/2022, 3:11:31 PM] [homebridge-miot] [Kettle] Setting up miot device!
[7/1/2022, 3:11:31 PM] [homebridge-miot] [Kettle] Device setup finished! Miot device ready!
[7/1/2022, 3:11:31 PM] [homebridge-miot] [Kettle] Connected to device: chunmi.health_pot.a1
[7/1/2022, 3:11:31 PM] [homebridge-miot] [Kettle] Doing initial property fetch.
[7/1/2022, 3:11:31 PM] [homebridge-miot] [Kettle] Starting property polling.

The log gives me these options for a manual setup, but I can not figure out how to create custom actions. All I want would be on/off the Kettle and set temperature.

The log gives me these options:

[Kettle] Device services: [
  "health-pot",
  "custom"

[Kettle] Device properties: [
  "health-pot:status",
  "health-pot:fault",
  "health-pot:cook-mode",
  "health-pot:left-time",
  "custom:menu-id",
  "custom:cook-total-time",
  "custom:left-time",
  "custom:temperature",
  "custom:kw-left-time",
  "custom:kw-temperature",
  "custom:ctrl-temperature",
  "custom:auto-keepwarm",
  "custom:recipe-type",
  "custom:power-value",
  "custom:pre-left-time",
  "custom:custom-save-flag",
  "custom:cook-data",
  "custom:recipe-index",
  "custom:cook-mode",
  "custom:setting-data",
  "custom:cook-finish-menu-id",
  "custom:pot-out-info",
  "custom:pot-out-recover",
  "custom:start-header",
  "custom:kw-total-time",
  "custom:inspection-data",
  "custom:set-menu-data",
  "custom:cook-time-dif",
  "custom:event-runstatus-inf",
  "custom:error-event-inf",
  "custom:pot-out-timeout-inf",
  "custom:power-total",
  "custom:power-cur-pos",
  "custom:p-cur-pos-time",
  "custom:log-string",
  "custom:log-index",
  "custom:cur-left-time",
  "custom:selfcheck-cmd",
  "custom:selfcheck-value"
]
[Kettle] Device actions: [
  "health-pot:start-cook",
  "health-pot:cancel-cooking",
  "custom:cooking-start",
  "custom:cooking-cancel",
  "custom:set-menu",
  "custom:factory-reset",
  "custom:set-setting",
  "custom:get-setting",
  "custom:get-inspection-data",
  "custom:get-log-string",
  "custom:reset-baud",
  "custom:get-selfcheck"
]

Here the metadata fetcher: https://merdok.github.io/miotspec/?model=chunmi.health_pot.a1

I am able to create a Start and Stop button and get the current temperature, but I am not able to change the temperature. I am getting this error:

[homebridge-miot] [Kettle] <-W-> This property is not writable! Cannot create property wrapper! [homebridge-miot] [Kettle] Cannot add Temperature wrapper! Invalid property! [homebridge-miot] [Kettle] <-W-> This property is not writable! Cannot create property wrapper! [homebridge-miot] [Kettle] Cannot add Temp wrapper! Invalid property!

My current try to setup the device:

{ "name": "Kettle", "ip": "192.168.xxx.xx", "token": "xxxxxxxxxxx", "model": "chunmi.health_pot.a1", "pollingInterval": 10, "deepDebugLog": true, "customAccessory": true, "buzzerControl": false, "ledControl": false, "childLockControl": false, "modeControl": true, "actionButtons": [ { "action": "custom:cooking-start", "name": "Turn on", "params": [ "custom:cooking-start" ] }, { "action": "custom:cooking-cancel", "name": "Turn off", "params": [ "custom:cooking-cancel" ] }, { "action": "custom:set-menu", "name": "Menu", "params": [ "custom:set-menu" ] } ], "propertyControl": [ { "property": "custom:temperature", "name": "Temperature" }, { "property": "custom:ctrl-temperature", "name": "Temp" } ], "propertyMonitor": [ { "property": "custom:temperature" } ] }

Is there any way to resolve this?

PS: When I turn on the kettle, the switch immediately turns off. Is there any way, to keep it on, until the kettle turns off, because it reaches the set temp?

Thx in advance!

merdok commented 2 years ago

So first of, if you have a no response from the device on every request then it might be that your device requires a MiCloud connection. You could try that our by adding the MiCloud section to the config of your device. Second, looking at the spec from your device literally all properties all read only, that means they can only be read out from the device but not set. In that case it might mean that your device can only by controlled by actions. But keep in mind that some actions might require extra params which you can see as the In column in the metadata, that basically means that you can have a look at the property with the id to see what they expect as input.

ghost commented 2 years ago

The network issue sorted out automatically, I can turn on/off the kettle and check for current temp. Regarding MiCloud: I setup the account with Login with Apple. Is there a way to integrate this? I mean I resolved it with the token itself, I extracted from the backup, I am just curious.

Question: Is there any way to change the bevaiour of the switch? Currently, I have to create two. one for turning on and one for turning off. Turning on will immedialty switch back to "off". is there any chance to configure it as a stateful switch? So that I only have one? It is more like a cosmetic request, so if not possible or too much hassle its not a big deal.

Thx in advance for your help and great plugin!

merdok commented 2 years ago

I guess you would need to use your Apple credentials to login to the MiCloud then, but not sure about that. You can try that out.

Actions are always stateless switches, they just execute an action on the device, hence the switch returns back to off state immediately after you press it. It would be possible to create stateful switches for that but that requires to implement a special device class which based on certain properties sets the switch state, and based on if it was set to on or off executes a specific action.

ghost commented 2 years ago

Already tried that, with no succes. I guess it is because of "hide my mail", even with that mail address and my password I was not able to login...

Any chance that in future updates stateful switch could be available within your plugin?

merdok commented 2 years ago

I might add a configuration to be able to configure a stateful switch by yourself in the future...

ghost commented 2 years ago

Thanks a lot. Until then, I will tinker a bit around with the plugin and just as a reference now, my Kettle is, with a manual configuration, also compatible with your plugin