Broadlink RM-PRO and A1 sensor

@oliverdog How much did you increase it to?

Increased to 300 all broadlink products…

Sensors working fine since that date I increased.

Thanks, I’ll try that, i wrote my own python script and used it as a command line sensor up till now :slight_smile:

hi,

I have a problem. My broadlink will not work/show up in frontend when Iadd aircon_br_temp_up, aircon_br_temp_down, and aircon_br_timer_set. When delete the three then the broadlink will workagain. I dont know how to solve this. I tried also to use broadlink.send_packet but it will not send and there will be the an error that the packet cannot be sent. I hope you guys can help me to solve the problem :slight_smile:

Thanks

Switches.yaml

- platform: broadlink
  name: "RM Mini Bedroom"
  host: 10.0.0.103
  mac: 'B4:43:0D:F9:16:99'
  timeout: 160
  type: rm_mini
  switches:
   #Aircon
    aircon_br:
      friendly_name: aircon_br
      command_on: 'JgAMAXQ3EQwQKRANEA0PDRANEAwQDRAMEA0QDRAMEA0QKRANEAwQDRAMEA0QDRAMECkQKRAqEAwQDRApEA0QDBANEAwQDRANEAwQDRAMEA0QDBANEA0QDBANEAwQDRANEAwQDRAMEA0QDRAMEA0QDBANEAwQDRANECkQKRANEAwQDRAMEA0QAAFSdDgQDBAqEAwQDRAMEA0QDRAMEA0QDBANEAwQDRApEA0QDBANEA0QDBANEAwQKhApECkQDRAMECkQDRAMEA0QDRAMEA0QDBANEA0QDBANEAwQKg8qEAwQDRAMEA0QKRANECkQKRApEA0QDRApECkQDBANEA0QKRAMECoQKRAMECoPDRAADQUAAAAAAAAAAAAAAAA='
      command_off: 'JgAMAXQ4EAwQKhAMEA0QDBANEA0QDBANEAwQDRANDw0QKRANEAwQDRANEAwQDRAMECoQKRApEA0PDRApEA0QDBANEA0QDBANEAwQDRANEAwQDRAMEA0QDRAMEA0QDBANEAwQDRANEAwQDRAMEA0QDRAMEA0QDBANECkQKRANEAwQDRANEAwQAAFTdDcQDRApEAwQDRANEAwQDRAMEA0QDRAMEA0QDBAqEAwQDRAMEA0QDQ8NEA0QKRApECkQDRAMECoQDBANEAwQDRANDw0QDRAMEA0QDBANEA0QKRApEA0QDBANEAwQKg8NECkQKRAqEAwQDRApECkQDRAMEA0QKRANECkQKRANECkQDBAADQUAAAAAAAAAAAAAAAA='
    aircon_br_temp_up:
      friendly_name: aircon_br_temp_up
      command_on: 'JgAMAXU3EA0QKRAMEQwQDRAMEA0QDBEMEA0QDBANEAwQKhAMEA0QDBANEA0QDBANECkQKRApEA0QDBEpEAwQDRAMEA0QDRAMEA0QDBANEA0QDBANEAwQDRAMEQwQDRAMEA0QDBEMEA0QDBANEAwQDRANEAwQDRAMECoQKRAMEA0QDRAMEA0QAAFSdDgQDBApEQwQDRAMEA0QDBANEA0QDBANEAwQDRApEA0QDBANEAwRDBANEAwQKREpECkQDBANECkQDRAMEA0QDRAMEA0QDBANEAwRDBANEAwQKREpEAwQKRANEA0QKRAMECkRKRApEAwRDBApECkRDBANEAwQKRAqECkQKRANECkQDBAADQUAAAAAAAAAAAAAAAA'
    aircon_br_temp_down:
      friendly_name: aircon_br_temp_down
      command_on: 'JgAMAXQ4EAwQKRANEA0QDBANEAwQDRANEAwQDRAMEA0QKRANEAwQDRAMEQwQDRAMECkQKhApEAwQDRApEA0QDBANEA0QDBANEAwQDRAMEQwQDRAMEA0QDBEMEA0QDBANEAwQDRANEAwQDRAMEA0QDRAMEA0QDBANECkQKRANEAwRDBANEAwQAAFTdDcQDRApEA0QDBANEAwQDRAMEQwQDRAMEA0QDBEpEAwQDRAMEA0QDRAMEA0QKRApECkQDRAMESkQDBANEAwRDBANEAwQDRAMEQwQDRAMEA0QKRANEAwQKRANEA0QKRAMECkRKRApEAwRDBApECkQDRANECkQDBApESkQKRAMESkQDBAADQUAAAAAAAAAAAAAAAA'
    aircon_br_timer_set:
      friendly_name: aircon_br_timer_set
      command_on: 'JgAMAXQ4EAwQKREMEA0QDBANEAwQDRANEAwQDRAMEA0QKRANEAwQDRAMEQwQDRAMECkRKRApEAwQDRApEA0QDBANEA0QDBANEAwQDRAMEQwQDRAMEA0QDBEMEA0QDBANEAwRDBANEAwQDRAMEA0QDRAMEA0QDBANECkQKRANEAwRDBANEAwQAAFTdDcQDRApEA0QDBANEAwQDRANEAwQDRAMEA0QDBEpEAwQDRAMEQwQDRAMEA0QKRApECkQDRANECkQDBANEA0QDBANEAwQDRAMEQwQDRAMEA0QKRApECkQKhAMEA0QKRANECkQKRApEA0QDBApESkQDBANEAwRDBANEAwQDRApECkQDRAADQUAAAAAAAAAAAAAAAA'

Scripts.yaml

aircon_br_temp_up:
  alias: Aircon Temp Up
  sequence:
    - service: switch.turn_on
      entity_id: switch.aircon_br_temp_up
aircon_br_temp_down:
  alias: Aircon Temp Down
  sequence:
    - service: switch.turn_on
      entity_id: switch.aircon_br_temp_down
aircon_br_timer_set:
  alias: Aircon Timer Set
  sequence:
    - service: switch.turn_on
      entity_id: switch.aircon_br_timer_set

1 Like

Nevermind, I solved the problem,

apparently, the sniffed code from HASS didnt show the whole code “=” was missing at the end of the code

the code should be

JgAMAXU3EA0QKRAMEQwQDRAMEA0QDBEMEA0QDBANEAwQKhAMEA0QDBANEA0QDBANECkQKRApEA0QDBEpEAwQDRAMEA0QDRAMEA0QDBANEA0QDBANEAwQDRAMEQwQDRAMEA0QDBEMEA0QDBANEAwQDRANEAwQDRAMECoQKRAMEA0QDRAMEA0QAAFSdDgQDBApEQwQDRAMEA0QDBANEA0QDBANEAwQDRApEA0QDBANEAwRDBANEAwQKREpECkQDBANECkQDRAMEA0QDRAMEA0QDBANEAwRDBANEAwQKREpEAwQKRANEA0QKRAMECkRKRApEAwRDBApECkRDBANEAwQKRAqECkQKRANECkQDBAADQUAAAAAAAAAAAAAAAA=

Hi Guys,

If you are interested in using these sensors with home assistant you are welcome to take a look at my post here:

Hello everyone,
I have got some milight devices, broadlink tc2 switches and rf433 blinds and xiaomi smart home accessories at my home.
I use homebridge to control all my devices (except sensors from xiaomi which need apple tv for automation) from homekit. I am currently using home assistant also for automation and remote access mainly and i am loving the log, graph and automation features.

Homebridge has a great plugin for broadlink devices. It has many device types:

learn-code
switch
switch-multi
switch-repeat
fan
light
garage-door-opener
window-covering
air-conditioner

Currently as far as i know home assistant only has “switch” component for broadlink integration. Which only has “on” and “off”. For my RF blinds I would like to use the homebridge’sque integration with home assistant also. Homebridge supports “on”, “off” and “stop”. It also has the “duration to close and open” values for curtains. So the plugin can use the information to set the blinds to %55 for instance. (send a stop command after total time / percent vs)

It would be great to have such functionality in home assistant too.

Thanks in advance.

2 Likes

Sensors still working fine.
But my SP Mini stoped working.
It works some hours on every reboot.

Did anyone get SP switches working properly?

Mine also do this, I have 3 spmini2 and they all stop working at different times with a timeout error in the log. Restart of HA works for a while then they do it again.

I am using a command line switch to run my own script for turning them on and off, for some reason it is more reliable than the implementation in HA.

Which one is?

Both SP and A1

Are you able to post an example of the command line switch you are using for the sp? TIA.

This is what I am doing with the SP2, the only “problem” with it that you don’t get the state which is actually the root cause of the problems I had with the built-in component which wasn’t reliable due to the broadlink device timeouts:

I have this script in my “/home/pi/” folder:

#!/usr/bin/python
import broadlink, sys, time

def sendSPCommand(spIP, spMAC, spState):
	try:
		device = broadlink.sp2(host=(spIP,80), mac=bytearray.fromhex(spMAC))
		device.auth()
		time.sleep(3)
		device.host

		if spState == "1":
			device.set_power(True)
			print "on"
		else:
			device.set_power(False)
			print "off"
	except:
		print "error"
		pass


sendSPCommand(sys.argv[1], sys.argv[2], sys.argv[3])

And in the home assistant configuration I have the command line switch:

- platform: command_line
  switches:
      BedroomLamp:
        command_on: '/usr/bin/python /home/pi/sp2.py 10.0.0.12 B44300000000 1'
        command_off: '/usr/bin/python /home/pi/sp2.py 10.0.0.12 B44300000000 0'
        friendly_name: Bedroom Lamp

And this is what I am using for the A1 sensor:

#!/usr/bin/python
import broadlink, time, sys

try:
	device = broadlink.a1(host=("10.0.0.2",80), mac=bytearray.fromhex("B44300000000"))
	time.sleep(3)
	device.auth()
	time.sleep(3)
	result = device.check_sensors_raw()
	print result[sys.argv[1]]
except:
	print "Cannot connect to sensor"

HASS Coniguration:

- platform: command_line
      name: Temperature
      command: "python /home/pi/temp.py temperature"
      unit_of_measurement: "°C"
      scan_interval: 300

    - platform: command_line
      name: Humidity
      command: "python /home/pi/temp.py humidity"
      scan_interval: 300

    - platform: command_line
      name: Light
      command: "python /home/pi/temp.py light"
      scan_interval: 300

    - platform: command_line
      name: Noise
      command: "python /home/pi/temp.py noise"
      scan_interval: 300

Thanks for that.

i run homeassistant in docker in synology, when i set config as

switch:

  • platform: broadlink
    host: 192.168.1.169
    mac: ‘34:ea:34:c7:37:58’
    switches:
    reciever:
    command_on: ‘switch_packet on’
    command_off: ‘switch_packet off’

the broadlink don’t work…
i find that you say:
‘if you use a virtual environment enable it.
Run pip install pycrypto’

but how can i do that? in docker? or in synology??

2017-07-11 00:24:18 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform broadlink
Traceback (most recent call last):
File “/usr/src/app/homeassistant/helpers/entity_component.py”, line 164, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 352, in wait_for
return fut.result()
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 244, in result
raise self._exception
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/app/homeassistant/components/switch/broadlink.py”, line 133, in setup_platform
device_config.get(CONF_COMMAND_OFF)
File “/usr/src/app/homeassistant/components/switch/broadlink.py”, line 159, in init
self._command_on = b64decode(command_on) if command_on else None
File “/usr/local/lib/python3.6/base64.py”, line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

Broadlink has a new app that works with Alexa.

Usual crap app from broadlink, but I managed to make it work with the TV (not the air conditioning)

Don’t know if it’s anything to do with your problem but you spelt ‘receiver’ wrong :slight_smile:

I came to HA to disconnect it from China.

Working good for me on my prime day Dot and Harmony Elite via emulated_hue :wink:

Hi all, new user to home-assistant.io. I’m trying to link to my Broadlink RM PRO and A1, but they’re not appearing on my home-assistant.io page. The logs shows the following. Can anyone troubleshoot it for me please?

2017-07-25 19:40:59 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform broadlink
Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py”, line 164, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File “/usr/lib/python3.4/asyncio/tasks.py”, line 372, in wait_for
return fut.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/broadlink.py”, line 58, in setup_platform
mac_addr, config.get(CONF_TIMEOUT))
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/broadlink.py”, line 111, in init
self._device = broadlink.a1((ip_addr, 80), mac_addr)
AttributeError: ‘module’ object has no attribute ‘a1’
2017-07-25 19:41:00 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform broadlink
Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py”, line 164, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File “/usr/lib/python3.4/asyncio/tasks.py”, line 372, in wait_for
return fut.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/broadlink.py”, line 58, in setup_platform
mac_addr, config.get(CONF_TIMEOUT))
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/broadlink.py”, line 111, in init
self._device = broadlink.a1((ip_addr, 80), mac_addr)
AttributeError: ‘module’ object has no attribute ‘a1’
2017-07-25 19:41:10 WARNING (MainThread) [homeassistant.setup] Setup of sensor is taking over 10 seconds.

(I’ve redacted the IP & MAC addresses in the configuration.yaml snippet below)

sensor:

  • platform: broadlink
    name: A1
    update_interval: 60
    host: 192.168.x.xx
    mac: ‘B4:43:0D:xx:xx:xx’
    monitored_conditions:
    • temperature
    • humidity
    • air_quality
    • light
    • noise
  • platform: broadlink
    name: RMPRO
    update_interval: 60
    host: 192.168.x.xx
    mac: ‘34:EA:34:xx:xx:xx’
    monitored_conditions:
    • temperature