BroadLink MP1, MP2 controlled switches support

BroadLink MP1(2) is remote controlled power outlet with 4 independently controlled outlets, for MP1, one for MP2.
Using python-broadlink, I have already developed my own scripts for controlling those devices, so I can use them locally with command_line switch. (https://github.com/Paxy/IFTTT-broadlink-milight-smart)

My goal now would be to try to extend broadlink.py component to support MP1,2.

I would probably need some assistance as I have not involved with HASS project before.

So my thoughts are:

  • We should create an additional class inside switches/broadlink.py to support MP devices with a different number of sockets.
  • We should make functions for both set and get a state of the particular socket.
  • Probably new field ‘type’ should be added to YAML file to indicate is it RM or MP device (maybe even others in future).
1 Like

Here is my variant of broadlink.py switch that supports MP2. Not yet tested with MP1 (still waiting for its arrivial).

In conf file new field is required type: ‘MP’ or SP or RM
http://pastebin.com/D2cMprH2

This is great! Was just planning to buy one of these. Does each individual socket appear as a service?

It will be in the next release https://github.com/home-assistant/home-assistant/pull/4961

Have not tested yet MP1 with individual sockets. It will arrive in next few days so I will check is current module compatible with MP1 controls and how can we access to different sockets.

MP1 just arrived.
Great news are that python-broadlink has just publish support for MP1 strip.
Just tested with python scripts, so individual sockets could be controlled.

I will try to make HASS support today.

I have done something to control MP1 from HASS, but I need further assistance:
https://github.com/home-assistant/home-assistant/compare/Broadlink_fix...Paxy:patch-3

Hi @Paxy, I have included MP1 support in broadlink python library and was planning to do a PR in home-assistant github, if you need some help please let me know!

There is a open PR that suports raw format status reading: https://github.com/mjg59/python-broadlink/pull/47

I’m thinking of buying one of these (MP1). Would would I have to do to get it working with HASS?

Hi guys thanks for the great work! is the MP1 already supported on the latest version of HA 0.36? is it hard to implement? thanks!

It is not implemented.
It should be easy to implement, but someone have to do it…

is support for the MP1 something that will be available soon? (total newbie here, and have one of these)

It will be supported when someone find time and are interested in doing so.
It should be easy to implement, but someone have to do it…

thanks for your quick reply much appreciated - fingers crossed someone can implement this

If you want to try. You should add a MP1 class here: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/switch/broadlink.py

I would love to but I have no idea where to even start :frowning:

I added MP1 compatibility to the HA broadlink.py. It is not the most elegant solution, but I started reading up on Python yesterday so please be kind. Basically, there are now four more types of broadlink devices, mp1-1, mp1-2, mp1-3 and mp1-4 for the four sockets of each MP1. I tested it and it seems to work so far and updates the state of the switch on the home assistant.

http://pastebin.com/AGu9Tph8

1 Like

Hey @gpw4888 and @Paxy, if you guys haven’t got it working already, please test this with your MP1’s and let me know if it works for you.

hi Kahthan - thank you so much for this much appreciated - I am so sorry to sound like a complete novice (which I am) but how would I test this? where would I add that code? thank you in advance

after much googling this worked a treat exactly what I was looking for thank you very much :slight_smile: