Hi all,
Sorry to bump this thread again. I’m trying to connect my SP3S (with power sensor) to my HA, but i ran into issues. First, let me inform you my running system :
- Home Assistant 0.74.0 (Hass.io) running on Ubuntu server 18.04 virtual machine (vmware) under Windows 10
- The virtual machine is bridged to the network
I can use the SP3S perfectly under Broadlink’s IHC app.
I also can add the SP3S as switch in configuration.yaml using broadlink platform. It works perfectly as switch, meaning I can turn on/off the switch from HA and the status will update in both HA and IHC. However, using this as switch won’t show any power usage information.
I then use your custom component, upload it under /usr/share/hassio/homeassistant/custom-components/sensor/broadlink_power.py change the platform type to broadlink_power and put it under sensor like this :
sensor:
- platform: yr
- platform: broadlink_power
host: 192.168.0.140
mac: '34:ea:34:75:c2:53'
friendly_name: 'Water Heater'
After HA restart, I get following error in the dev-info page :
Testing configuration at /config ERROR:homeassistant.scripts.check_config:BURB Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/scripts/check_config.py", line 207, in check res['components'] = check_ha_config_file(hass) File "/usr/local/lib/python3.6/site-packages/homeassistant/scripts/check_config.py", line 372, in check_ha_config_file platform = loader.get_platform(hass, domain, p_name) File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 59, in get_platform return get_component(hass, PLATFORM_FORMAT.format(domain, platform)) File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 87, in get_component module = importlib.import_module(path) File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 674, in exec_module File "<frozen importlib._bootstrap_external>", line 781, in get_code File "<frozen importlib._bootstrap_external>", line 741, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/config/custom_components/sensor/broadlink_power.py", line 7 <!DOCTYPE html> ^ SyntaxError: invalid syntax Fatal error while loading config: invalid syntax (broadlink_power.py, line 7) Failed config General Errors: - invalid syntax (broadlink_power.py, line 7) Successful config (partial)
8:31 AM components/hassio/__init__.py (ERROR)
Log Details (ERROR)
Tue Jul 31 2018 08:31:55 GMT+0700 (Western Indonesia Time)
Testing configuration at /config
ERROR:homeassistant.scripts.check_config:BURB
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/scripts/check_config.py", line 207, in check
res['components'] = check_ha_config_file(hass)
File "/usr/local/lib/python3.6/site-packages/homeassistant/scripts/check_config.py", line 372, in check_ha_config_file
platform = loader.get_platform(hass, domain, p_name)
File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 59, in get_platform
return get_component(hass, PLATFORM_FORMAT.format(domain, platform))
File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 87, in get_component
module = importlib.import_module(path)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 781, in get_code
File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/config/custom_components/sensor/broadlink_power.py", line 7
<!DOCTYPE html>
^
SyntaxError: invalid syntax
Fatal error while loading config: invalid syntax (broadlink_power.py, line 7)
Failed config
General Errors:
- invalid syntax (broadlink_power.py, line 7)
Successful config (partial)
I am new to both HA and linux environments, and so I suspect there’s something wrong with the file/folder location. Then I browse to /usr/local/lib/python3.6/ where I can’t found the site-package folder and only dist-package folder (which is empty).
Do you think this is the cause of my problem? If yes, how do I install the site-package to correct location?
FYI, I’ve also tried replacing init.py from https://github.com/mjg59/python-broadlink/blob/master/broadlink/init.py to /usr/share/hassio/homeassistant/deps/python-broadlink/broadlink but the error is still the same.
Please give me a clue on what’s wrong with the method, or how should I do it in order to make the power consumption appear in HA.
Thank you in advance, and sorry for my English!