Broadlink S3 hub support

Bingo, you are a genius!
Who would have a thought thought.
Up and running now.
Knowing my luck they will release the integration in a few weeks!

No problem, happy to help.

I only worked this out myself today, itā€™s caught me out in the past but I think I resolved it more by chance than any kind of reasoning.

Glad youā€™re up and running, now I just have 10 more switches to install and set up :laughing:

Yes, I have six more to configure now!
many thanks again.!

Thank you very much for working on this - this is the kind of thing I really love about the HA community. I donā€™t suppose you have any insight on when this might be pushed out to HA in any upcoming updates? Presumably it would be the actual Broadlink integration which would be updated, and this is what weā€™d be looking for in the changelogs of any updates released soon?

Please excuse my noob-ness, but if Iā€™m running HAOS as a VM on Unraid (linux), can I still obtain the DID of my switches, using this docker container?

Iā€™ve installed the docker in Unraid already (add container > pasted in your repo) and it installed successfully; click on the docker > console. This opens a blank terminal window with a #.

From here, what exactly are the steps to obtain the DID of the switches?

Iā€™m lost following these steps as Iā€™ve installed the Docker, but canā€™t figure out what steps 5/6 mean or how I get my DIDs from here. Thank you in advance

not sure if itā€™s any use to you but I just downloaded the Broadlink app and added them in there via the QR codes. After that you can go onto the switch in the app, click on the menu button top right and view device info, the DID is listed in there.

Thank you very much for this - Iā€™ll try this when my switches arrive on Monday (getting everything ready in advance in HA for when they arrive). Presumably I need to keep them linked to the app through the hub, even after adding them into HA? (My understanding is that these still rely on the S3 hub and Broadlinkā€™s cloud, right?)

I canā€™t use the docker install method if Iā€™m running Home Assistant OS as a VM, right? Only works on Core/Supervised installs of HA?

Iā€™ve followed everything in this thread (AppsDeamon method) and have spent the best part of 2 hours troubleshooting. It is now working as expected, no errors in the logs. Here is what was causing me the errors, for anyone else who may have followed these steps to the letter, and is still seeing errors in their logs:

This isnā€™t quite 100% correct. ALL of the .py files INCLUDING __ init__.py must be in the broadlink folder. Itā€™s 14 .py files total which should be in the broadlink folder. ONLY the broadlink_s3_hub.py should be a level up, in config\appdaemon\apps\broadlink-s3-hub-app-daemon.

This was clarified in mnayef95ā€™s reply, but initially I missed it and still had my __ init__.py file in the wrong place:

Aside from that, nice job everyone and thanks for paving the way for a relatively smooth integration, for anyone stumbling upon this thread today!

Now to install the rest of the switchesā€¦

the docker image is ā€˜stand aloneā€™ it will work with any HA install but you need to host it somewhere

Hi All,

So do we have to do both guides or just the one?

i tried @mnayef95 guide but i keep getting ā€œcompile errorā€ in Appdaemon but i cant figure out what i have done wrong

  module: broadlink_s3_hub
  class: BroadlinkS3Hub
  hub_ip: "192.168.68.48"
  did: "00000000000000000000ec0bae38304f"
  scan_interval: 1
  friendly_names:
    - Bedroom1 Light
  entity_ids:
    - light.bedroom1_light

gbedroom:
  module: broadlink_s3_hub
  class: BroadlinkS3Hub
  hub_ip: "192.168.68.48"
  did: "00000000000000000000ec0bae384dc0"
  scan_interval: 1
  friendly_names:
    - Bedroom2 Light
  entity_ids:
    - light.bedroom2_light

and this is the AppDaemon log

[20:35:31] INFO: Starting AppDaemon...
2022-10-29 21:35:40.624623 INFO AppDaemon: AppDaemon Version 4.2.1 starting
2022-10-29 21:35:40.625103 INFO AppDaemon: Python version is 3.10.5
2022-10-29 21:35:40.625443 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2022-10-29 21:35:40.625888 INFO AppDaemon: Added log: AppDaemon
2022-10-29 21:35:40.626360 INFO AppDaemon: Added log: Error
2022-10-29 21:35:40.626828 INFO AppDaemon: Added log: Access
2022-10-29 21:35:40.627394 INFO AppDaemon: Added log: Diag
2022-10-29 21:35:40.977341 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2022-10-29 21:35:41.381464 INFO HASS: HASS Plugin Initializing
2022-10-29 21:35:41.381951 INFO HASS: HASS Plugin initialization complete
2022-10-29 21:35:41.383202 INFO AppDaemon: Initializing HTTP
2022-10-29 21:35:41.384245 INFO AppDaemon: Using 'ws' for event stream
2022-10-29 21:35:41.393825 INFO AppDaemon: Starting API
2022-10-29 21:35:41.401691 INFO AppDaemon: Starting Admin Interface
2022-10-29 21:35:41.402648 INFO AppDaemon: Starting Dashboards
2022-10-29 21:35:41.495314 INFO HASS: Connected to Home Assistant 2022.10.5
2022-10-29 21:35:41.543216 INFO AppDaemon: App 'mbedroom' added
2022-10-29 21:35:41.547345 INFO AppDaemon: App 'gbedroom' added
2022-10-29 21:35:41.550370 INFO AppDaemon: Found 2 total apps
2022-10-29 21:35:41.552356 INFO AppDaemon: Starting Apps with 2 workers and 2 pins
2022-10-29 21:35:41.556553 INFO AppDaemon: Running on port 5050
2022-10-29 21:35:41.631996 INFO HASS: Evaluating startup conditions
2022-10-29 21:35:41.653999 INFO HASS: Startup condition met: hass state=RUNNING
2022-10-29 21:35:41.655385 INFO HASS: All startup conditions met
2022-10-29 21:35:41.683292 INFO AppDaemon: Got initial state from namespace default
2022-10-29 21:35:43.288406 INFO AppDaemon: New client Admin Client connected
2022-10-29 21:35:43.573576 INFO AppDaemon: Scheduler running in realtime
2022-10-29 21:35:43.591752 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2022-10-29 21:35:43.593203 INFO AppDaemon: Adding /config/appdaemon/apps/broadlink-s3-hub-app-daemon to module import path
2022-10-29 21:35:43.622028 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hello.py - ignoring
2022-10-29 21:35:43.625282 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/helpers.py - ignoring
2022-10-29 21:35:43.629030 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/cover.py - ignoring
2022-10-29 21:35:43.632752 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/exceptions.py - ignoring
2022-10-29 21:35:43.636498 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/alarm.py - ignoring
2022-10-29 21:35:43.640126 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/device.py - ignoring
2022-10-29 21:35:43.643959 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/switch.py - ignoring
2022-10-29 21:35:43.647781 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/broadlink_s3_hub.py
2022-10-29 21:35:43.740852 WARNING Error: ------------------------------------------------------------
2022-10-29 21:35:43.741871 WARNING Error: Unexpected error loading module: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/broadlink_s3_hub.py:
2022-10-29 21:35:43.742800 WARNING Error: ------------------------------------------------------------
2022-10-29 21:35:43.748342 WARNING Error: Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/appdaemon/app_management.py", line 993, in check_app_updates
    await utils.run_in_executor(self, self.read_app, mod["name"], mod["reload"])
  File "/usr/lib/python3.10/site-packages/appdaemon/utils.py", line 337, in run_in_executor
    response = future.result()
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.10/site-packages/appdaemon/app_management.py", line 784, in read_app
    self.modules[module_name] = importlib.import_module(module_name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/appdaemon/apps/broadlink-s3-hub-app-daemon/broadlink_s3_hub.py", line 2, in <module>
    import broadlink
ModuleNotFoundError: No module named 'broadlink'
2022-10-29 21:35:43.750222 WARNING Error: ------------------------------------------------------------
2022-10-29 21:35:43.751107 WARNING AppDaemon: Removing associated apps:
2022-10-29 21:35:43.752372 WARNING AppDaemon: mbedroom
2022-10-29 21:35:43.754210 WARNING AppDaemon: gbedroom
2022-10-29 21:35:43.760015 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/sensor.py - ignoring
2022-10-29 21:35:43.767952 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/climate.py - ignoring
2022-10-29 21:35:43.771047 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/__init__.py - ignoring
2022-10-29 21:35:43.774569 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/protocol.py - ignoring
2022-10-29 21:35:43.777626 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/remote.py - ignoring
2022-10-29 21:35:43.781324 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/hub.py - ignoring
2022-10-29 21:35:43.784687 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/light.py - ignoring
2022-10-29 21:35:43.788501 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink-s3-hub-app-daemon/const.py - ignoring
2022-10-29 21:35:43.791386 INFO AppDaemon: App initialization complete

Thanks in advance

Hi @STUKguy

Did you download the files via HACS or manually?

Hi @Mjb1505
Via HACS, I donā€™t know how to do it manually

Thatā€™s fine.

Did you add the ā€œBroadlinkā€ folder?

Ah no I didnā€™t, where do I put this folder

Inside the main folder HACS downloads ā€œbroadlink-s3-hub-app-daemonā€, then put all the .py files except " broadlink_s3_hub.py" in there

Sorry do you mean in this location
/config/appdaemon/apps/broadlink-s3-hub-app-daemon/

sorry im very new to this and not the best at Linux OSā€™s

Hey @Mjb1505, thank you i figured what i was doing wrong (well i guessed and it worked) though i think some noob instructions may help the next person that comes across this.

2 Likes

Sorry, I donā€™t come on here often so didnā€™t see your messages. Well done getting it sorted.

I do agree, Iā€™ve not long started using home assistant myself and some of the principles with this can be a bit of a learning curve.

@Mjb1505 or anyone that might be able to help please :slight_smile:

Iā€™ve got some LC1 Broadlink light switches, all working well in the Broadlink ios app with the S3 Hub.

Iā€™m running the latest HA as standalone on a RaspberryPi4, and looking to get the switches into HA. Iā€™ve followed the instructions here: GitHub - mnayef95/broadlink-s3-hub-app-daemon

AppDaemon appears running ok as the ā€˜Hello Worldā€™ runs as expected.

However, the switches donā€™t appear in HA Dashboard, and when i go into the AppDaemon WebUI the switches all say ā€˜Initialize Errorā€™, and Iā€™m getting the following from the AppDaemon Log

2022-11-19 13:06:49.837590 WARNING bathroomswitch: ------------------------------------------------------------
2022-11-19 13:06:49.836396 WARNING bathroomswitch: Traceback (most recent call last): File "/config/appdaemon/apps/broadlink/__init__.py", line 209, in hello return next( StopIteration The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/app_management.py", line 165, in initialize_app await utils.run_in_executor(self, init) File "/usr/lib/python3.10/site-packages/appdaemon/utils.py", line 337, in run_in_executor response = future.result() File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/appdaemon/apps/broadlink_s3_hub.py", line 15, in initialize self.device = broadlink.hello(self.args["hub_ip"]) File "/config/appdaemon/apps/broadlink/__init__.py", line 213, in hello raise e.NetworkTimeoutError( broadlink.exceptions.NetworkTimeoutError: [Errno -4000] Network timeout: No response received within 10s
2022-11-19 13:06:49.833713 WARNING bathroomswitch: ------------------------------------------------------------
2022-11-19 13:06:49.832223 WARNING bathroomswitch: Unexpected error running initialize() for bathroomswitch
2022-11-19 13:06:49.830747 WARNING bathroomswitch: ------------------------------------------------------------

My appdaemon.yaml

secrets: /config/secrets.yaml
appdaemon:
  latitude: 52.379189
  longitude: 4.899431
  elevation: 2
  time_zone: Europe/London
  plugins:
    HASS:
      type: hass
      ha_url: http://192.168.0.140:8123
      token: <HIDDEN>
http:
  url: http://192.168.0.140:5050
hadashboard:
admin:
api:

My apps.yaml

toiletswitch:
  module: broadlink_s3_hub
  class: BroadlinkS3Hub
  hub_ip: "192.168.68.136"
  did: "00000000000000000000a043b0d06816"
  scan_interval: 0.5
  friendly_names:
    - Toilet Light
  entity_ids:
    - light.toiletlightswitch
    
ensuiteswitch:
  module: broadlink_s3_hub
  class: BroadlinkS3Hub
  hub_ip: "192.168.68.136"
  did: "00000000000000000000a043b0d07deb"
  scan_interval: 0.5
  friendly_names:
    - Ensuite Extractor
    - Ensuite Spots
  entity_ids:
    - light.ensuiteextractor
    - light.ensuitespots