BroadLink MP1, MP2 controlled switches support

hi Kahthan, I have changed the friendly name to the same way as you have it within the switch config and it seems to have fixed the issue - i have restarted multiple times and cannot replicate the issue i was having anymore :slight_smile: thanks again

1 Like

I tried it too and works really well! Thanks a lot mate!

1 Like

I tried it too and works well, thanks

1 Like

Hi… it works for me also, in the sense, I can see 4 individual controls in HA dashboard.
However, when I turn the switches ON or OFF, it does not really switch on or off the power.

Further to my previous message, I looked into the homeassistant.log and noticed it has the following errors…

File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/switch/broadlink.py”, line 329, in update
self._update()
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/switch/broadlink.py”, line 334, in _update
state = state1[‘s1’]
TypeError: ‘NoneType’ object is not subscriptable

Any help is appreciated… thanks in advance.

OK. Just to add, All did was to download the broadlink code from the link given and created a text file called broadlink.py and replaced it n the repository. Then added the following in the config.yaml.

  • platform: broadlink
    view: yes
    host: 192.168.1.35
    mac: B4:43:0D:DB:D4:B6
    type: mp1-1
    friendly_name: 2GB Hard Disk

  • platform: broadlink
    view: yes
    host: 192.168.1.35
    mac: B4:43:0D:DB:D4:B6
    type: mp1-2
    friendly_name: Phone Charger

  • platform: broadlink
    view: yes
    host: 192.168.1.35
    mac: B4:43:0D:DB:D4:B6
    type: mp1-3
    friendly_name: Laptop Charger1

  • platform: broadlink
    view: yes
    host: 192.168.1.35
    mac: B4:43:0D:DB:D4:B6
    type: mp1-4
    friendly_name: Laptop Charger2

if I have missed out anything, please highlight. thanks.

HI…

Further Update. Good news !. It 's all working fine as needed.

The issue was that the IP address got changed when router rebooted. I have now set it to static IP, to prevent future issues.

Thanks.

@KvRajan That’s great! Sorry I couldn’t jump in earlier, I had some internet connectivity issues.

Hi…
I really thank you for your MP1 broadlink.py
It works well in my HA
I need the REST API entity_id for MP1-1, MP1-2, MP1-3, MP1-4
Could you tell me about it?

You will find all entity_ids if you go to your_ip:8123/dev-state

Daniel,
Thank you so much.
You saved me :wink:

Hi to everyone,

Can someone tell me where i I need to save broadlink.py? Maybe in custom_components folder? also i need to create a subfolder for this file?

About config file (configuration.yaml), in my case i’m using different files for each component (sensor, light, binary_sensors, etc),

platform: broadlink
view: yes
host: 192.168.1.35
mac: B4:43:0D:DB:D4:B6
type: mp1-1
friendly_name: 2GB Hard Disk
platform: broadlink
view: yes
host: 192.168.1.35
mac: B4:43:0D:DB:D4:B6
type: mp1-2
friendly_name: Phone Charger
platform: broadlink
view: yes
host: 192.168.1.35
mac: B4:43:0D:DB:D4:B6
type: mp1-3
friendly_name: Laptop Charger1
platform: broadlink
view: yes
host: 192.168.1.35
mac: B4:43:0D:DB:D4:B6
type: mp1-4
friendly_name: Laptop Charger2

In this case only i can put the configuration of the braodlink MP1 in file configuration.yaml, or maybe in other file like sensor.yaml or other one?

thanks

Hi @garvarma,

Yes you will need to put the broadlink.py into the custom_components folder under a subfolder called switch… so full path will be custom_components\switch\broadlink.py

Thanks

Gareth

hi @gpw4888,

thanks for reply.

About config option of broadlink? i must put in configuration.yaml or maybe i can in other file like sensors.yaml?

Which version of broadlink.py to control the MP1 i need to download? maybe @kahthan version?

http://pastebin.com/AGu9Tph8

thanks

Hi @garvarma I am not sure if you can put in other locations - yes i used the one from @kahthan

@Danielhiversen what are the next steps to getting this into home assistant without the custom components being required?

Thanks

Gareth

Someone have to make pull request against the home Assistent repo.
But the code would need some clean up before it can be approved.

1 Like

thanks @Danielhiversen,

@kahthan is that something you fancy doing?

@gpw4888 I would love to! I don’t know where to start though.

@Danielhiversen Is there a tutorial that I can follow for both the cleanup and the pull request? or at least some place I can start.

Any news on this? I’m so looking forward to see broadlink mp1 included in ha!!

Broadlink SC1 is coming.

5 Likes