Broadlink S3 Hub / LC1 Light Switches integration with HA

Hi All - I’m relatively new to HA, and trying to integrate a Broadlink LC1 Light switch (with S3 Hub). The hub is ‘unlocked’ within the app. I have HA os running on an rpi4. All os, addons, etc are the latest version.

I’m using the Appdameon add-on GitHub - mnayef95/broadlink-s3-hub-app-daemon.

However, when I go into the Appdaemon UI Interface, I see the switch but it says ‘initialize error’, andnothing appears on the dashboard (i.e. no 'switch is generated in HA)

My appdaemon.yaml is as follows

---
secrets: /config/secrets.yaml
appdaemon:
  latitude: 43.831260
  longitude: -7.003490
  elevation: 2
  time_zone: Europe/London
  plugins:
    HASS:
      type: hass
http:
  url: http://127.0.0.1:5050
admin:
api:
hadashboard:

My apps.yaml:

---
hello_world:
  module: hello
  class: HelloWorld

one_gang_switch:
  module: broadlink_s3_hub
  class: BroadlinkS3Hub
  hub_ip: "192.168.68.136"
  did: "00000000000000000000a043b0d06816"
  scan_interval: 0.5
  friendly_names:
    - Gang 1 name
  entity_ids:
    - light.gang_1

My logs indicate:

-----------------------------------------------------------
 Add-on: AppDaemon
 Python Apps and Dashboard using AppDaemon 4.x for Home Assistant
-----------------------------------------------------------
 Add-on version: 0.10.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.3  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2022.11.4
 Home Assistant Supervisor: 2022.10.2
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/appdaemon.sh
cont-init: info: /etc/cont-init.d/appdaemon.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun appdaemon (no readiness notification)
s6-rc: info: service legacy-services successfully started
[21:33:47] INFO: Starting AppDaemon...
2022-11-22 21:33:54.894348 INFO AppDaemon: AppDaemon Version 4.2.1 starting
2022-11-22 21:33:54.894782 INFO AppDaemon: Python version is 3.10.8
2022-11-22 21:33:54.896219 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2022-11-22 21:33:54.896752 INFO AppDaemon: Added log: AppDaemon
2022-11-22 21:33:54.897896 INFO AppDaemon: Added log: Error
2022-11-22 21:33:54.898602 INFO AppDaemon: Added log: Access
2022-11-22 21:33:54.899242 INFO AppDaemon: Added log: Diag
2022-11-22 21:33:55.204606 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2022-11-22 21:33:55.552885 INFO HASS: HASS Plugin Initializing
2022-11-22 21:33:55.553349 INFO HASS: HASS Plugin initialization complete
2022-11-22 21:33:55.554526 INFO AppDaemon: Initializing HTTP
2022-11-22 21:33:55.555435 INFO AppDaemon: Using 'ws' for event stream
2022-11-22 21:33:55.563496 INFO AppDaemon: Starting API
2022-11-22 21:33:55.570073 INFO AppDaemon: Starting Admin Interface
2022-11-22 21:33:55.571018 INFO AppDaemon: Starting Dashboards
2022-11-22 21:33:55.658138 INFO HASS: Connected to Home Assistant 2022.11.4
2022-11-22 21:33:55.683176 INFO AppDaemon: App 'hello_world' added
2022-11-22 21:33:55.687655 INFO AppDaemon: App 'one_gang_switch' added
2022-11-22 21:33:55.689567 INFO AppDaemon: Found 2 total apps
2022-11-22 21:33:55.690678 INFO AppDaemon: Starting Apps with 2 workers and 2 pins
2022-11-22 21:33:55.693038 INFO AppDaemon: Running on port 5050
2022-11-22 21:33:55.787741 INFO HASS: Evaluating startup conditions
2022-11-22 21:33:55.808298 INFO HASS: Startup condition met: hass state=RUNNING
2022-11-22 21:33:55.809064 INFO HASS: All startup conditions met
2022-11-22 21:33:55.835927 INFO AppDaemon: Got initial state from namespace default
2022-11-22 21:33:57.709483 INFO AppDaemon: Scheduler running in realtime
2022-11-22 21:33:57.718340 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2022-11-22 21:33:57.719321 INFO AppDaemon: Adding /config/appdaemon/apps/broadlink to module import path
2022-11-22 21:33:57.742768 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/broadlink_s3_hub.py
2022-11-22 21:33:57.778044 INFO AppDaemon: New client Admin Client connected
2022-11-22 21:33:57.998709 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello.py
2022-11-22 21:33:58.002708 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/helpers.py - ignoring
2022-11-22 21:33:58.006015 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/cover.py - ignoring
2022-11-22 21:33:58.009537 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/exceptions.py - ignoring
2022-11-22 21:33:58.013157 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/alarm.py - ignoring
2022-11-22 21:33:58.016681 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/device.py - ignoring
2022-11-22 21:33:58.020273 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/switch.py - ignoring
2022-11-22 21:33:58.023681 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/sensor.py - ignoring
2022-11-22 21:33:58.027298 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/climate.py - ignoring
2022-11-22 21:33:58.030652 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/__init__.py - ignoring
2022-11-22 21:33:58.034387 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/protocol.py - ignoring
2022-11-22 21:33:58.037563 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/remote.py - ignoring
2022-11-22 21:33:58.041076 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/hub.py - ignoring
2022-11-22 21:33:58.044328 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/light.py - ignoring
2022-11-22 21:33:58.047851 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/broadlink/const.py - ignoring
2022-11-22 21:33:58.050674 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2022-11-22 21:33:58.057054 INFO AppDaemon: Initializing app one_gang_switch using class BroadlinkS3Hub from module broadlink_s3_hub
2022-11-22 21:33:58.226383 INFO hello_world: Hello from AppDaemon
2022-11-22 21:33:58.229121 INFO hello_world: You are now ready to run Apps!
2022-11-22 21:34:08.237699 WARNING one_gang_switch: ------------------------------------------------------------
2022-11-22 21:34:08.239379 WARNING one_gang_switch: Unexpected error running initialize() for one_gang_switch
2022-11-22 21:34:08.240815 WARNING one_gang_switch: ------------------------------------------------------------
2022-11-22 21:34:08.250880 WARNING one_gang_switch: 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-22 21:34:08.251558 WARNING one_gang_switch: ------------------------------------------------------------
2022-11-22 21:34:08.253782 INFO AppDaemon: App initialization complete
2022-11-22 21:34:19.088756 INFO AppDaemon: New client Admin Client connected
2022-11-22 21:34:47.548466 INFO AppDaemon: Client disconnection from Admin Client
2022-11-22 21:34:48.168856 INFO AppDaemon: Client disconnection from Admin Client

If you can shed any light it would be appreciated.

(Have also found a HomeBridge plugin - installed HomeBridge within HA, added the plug-in and that automatically finds the switch, but toggling the switch in HB doesnt do anything!)

See https://github.com/mnayef95/broadlink-s3-hub-app-daemon/issues/3

I was running into a very similar issue and the link above had suggested adding the python package ‘cryptography’. I did that, and it’s all working now, so I’m hoping that helps you too.