mirko3000 / MMM-xiaomi

Xiaomi smarthome plugin for the magic mirror
26 stars 3 forks source link

lumi.plug support #19

Open aurely89 opened 4 years ago

aurely89 commented 4 years ago

Hi @mirko3000, first of all thanks for this module.

A quick question, is Xiaomi Lumi smart plug supported or do you think it could be supported in the future?

Thank you, Flavio

mirko3000 commented 4 years ago

Hello Flavio,

please check here if the plug is supported: https://github.com/aholstenson/miio

Anyhow, the question is how would you like to display the plug? As an icon/indicator if the plug is switched on?

Best regards, Mirko

aurely89 commented 4 years ago

Hi @mirko3000, yes, the library you linked supports the Mi Smart Socket Plug.

What I meant is to show an icon when the plug is switched on, just like with the window sensor when it is open.

Thank you for your reply.

Best regards, Flavio

mirko3000 commented 4 years ago

Hi Flavio,

I do not have any of the plugs, but added untested support for those plugs. Please check out this branch and see if it works:

Then run MagicMirror as usual, ideally via npm start dev to get the JS console if any errors occur. Let me know if this works, or if you face any issues or bugs.

Best regards, Mirko

aurely89 commented 4 years ago

Hi @mirko3000, first of all thanks for this very quick add.

I've just tried the new branch and added the device ID in the config.js device list.

Looking at the console it finds the new device ID: [2020-05-31 15:22:05.771] [LOG] Found device with ID **** of type power-plug

Actually the only issue is that no icon of status change is showed on the mirror.

Should I add in the config.js of the mirror a kind of "showPlug: true" configuration?

Thank you, Flavio

mirko3000 commented 4 years ago

Oh correct, forgot about the config option. Yes you need to set showPlugs to TRUE.

aurely89 commented 4 years ago

Great, it works perfectly now.

I'll keep testing it and tell you if any issue/bug comes up, by now everything is working as expected.

Thank you!!!