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
I came to HA to disconnect it from China.
Working good for me on my prime day Dot and Harmony Elite via emulated_hue
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
you think USA is better then China about privacy?
Not sure about that …
Try removing the name in both cases as that’s what it’s complaining about I think.
Try without name on both configs
OK, I’ll rephrase that “to disconnect it from the web”, better?
Does the RMPro definitely have a temp sensor, the spec makes no claims and all I get is ‘unknown °C’ ?
Yes, I have two of them and both show temp normaly on HASS
Hmm, this is my config…
sensor:
- platform: broadlink
update_interval: 60
host: ip of rmpro
mac: 'mac of rmpro'
monitored_conditions:
- temperature
Anything else needed?
Thanks oliverdog, keithh666… unfortunately no change after removing the ‘name’ lines in the config, this is in the log:
2017-07-26 18:47:09 ERROR (MainThread) [homeassistant.components.switch] 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/switch/broadlink.py”, line 121, in setup_platform
broadlink_device = broadlink.rm((ip_addr, 80), mac_addr)
AttributeError: ‘module’ object has no attribute ‘rm’
Can you reformat the code with code blocks so we can see the formatting and spacing? Also what platform are you using (PI1-3, windows, etc)?
Sorted, my friend found that somehow my /etc/hosts/ file had 127.0.1.1 rather than 127.0.0.1 for localhost Thanks keithh666!