DeCONZ Hue Dimmer Switch app with smooth dimming functionality

Can you please post the logs of the AppDaemon add-on? Wanna make sure that AppDaemon works.

[09:56:09] INFO: Starting AppDaemon...
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 384, in main
    admain.main()
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 216, in main
    if "secrets" in config:
TypeError: argument of type 'NoneType' is not iterable
[09:56:11] INFO: Starting AppDaemon...
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 384, in main
    admain.main()
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 216, in main
    if "secrets" in config:
TypeError: argument of type 'NoneType' is not iterable
[09:56:12] INFO: Starting AppDaemon...
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 384, in main
    admain.main()
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 216, in main
    if "secrets" in config:
TypeError: argument of type 'NoneType' is not iterable
[09:56:14] INFO: Starting AppDaemon...
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 384, in main
    admain.main()
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 216, in main
    if "secrets" in config:
TypeError: argument of type 'NoneType' is not iterable
[09:56:16] INFO: Starting AppDaemon...
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 384, in main
    admain.main()
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 216, in main
    if "secrets" in config:
TypeError: argument of type 'NoneType' is not iterable
[09:56:17] INFO: Starting AppDaemon...
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 384, in main
    admain.main()
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 216, in main
    if "secrets" in config:
TypeError: argument of type 'NoneType' is not iterable
[09:56:19] INFO: Starting AppDaemon...
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 384, in main
    admain.main()
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 216, in main
    if "secrets" in config:
TypeError: argument of type 'NoneType' is not iterable
[09:56:21] INFO: Starting AppDaemon...
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 384, in main
    admain.main()
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 216, in main
    if "secrets" in config:
TypeError: argument of type 'NoneType' is not iterable
[09:56:23] INFO: Starting AppDaemon...
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 384, in main
    admain.main()
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 216, in main
    if "secrets" in config:
TypeError: argument of type 'NoneType' is not iterable
[09:56:24] INFO: Starting AppDaemon...
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 384, in main
    admain.main()
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 216, in main
    if "secrets" in config:
TypeError: argument of type 'NoneType' is not iterable
[09:56:26] INFO: Starting AppDaemon...
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 384, in main
    admain.main()
  File "/usr/lib/python3.8/site-packages/appdaemon/__main__.py", line 216, in main
    if "secrets" in config:
TypeError: argument of type 'NoneType' is not iterable
[09:56:28] INFO: Starting AppDaemon...

Can you please show your appdaemon.yaml file as well?

it’s empty, I probably got it wrong but it says in the installation part, that everything will be preconfigured.

https://github.com/hassio-addons/addon-appdaemon/blob/v0.2.5/README.md#installation

Installation
The installation of this add-on is pretty straightforward and not different in comparison to installing any other Home Assistant add-on.

Search for the "AppDaemon 4" add-on in the Supervisor add-on store and install it.
Start the "AppDaemon 4" add-on
Check the logs of the "AppDaemon 4" add-on to see if everything went well.
ℹ️ Please note, the add-on is pre-configured to connect with Home Assistant. There is no need to create access tokens or to set your Home Assistant URL in the AppDaemon configuration.

This automatic handling of the URL and token conflicts with the AppDaemon official documentation. The official documentation will state ha_url and token options are required. For the add-on, however, this isn't needed.

Can you please try putting the following into your appdaemon.yaml file?

appdaemon:
  latitude: 52.379189
  longitude: 4.899431
  elevation: 2
  time_zone: Europe/Amsterdam
  plugins:
    HASS:
      type: hass
http:
  url: http://127.0.0.1:5050
hadashboard:
admin:
api:

With your details for latitude, longitude etc.

I think normally it should automatically create an appdaemon.yaml file during install, but I’m not sure as I’m not using the add-on myself.

i added the config, here is the new log

[10:13:35] INFO: Starting AppDaemon...
2020-04-26 10:13:37.163165 INFO AppDaemon: AppDaemon Version 4.0.3 starting
2020-04-26 10:13:37.163725 INFO AppDaemon: Python version is 3.8.2
2020-04-26 10:13:37.164196 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2020-04-26 10:13:37.164602 INFO AppDaemon: Added log: AppDaemon
2020-04-26 10:13:37.165030 INFO AppDaemon: Added log: Error
2020-04-26 10:13:37.165440 INFO AppDaemon: Added log: Access
2020-04-26 10:13:37.165814 INFO AppDaemon: Added log: Diag
2020-04-26 10:13:37.211821 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2020-04-26 10:13:37.254531 INFO HASS: HASS Plugin Initializing
2020-04-26 10:13:37.255103 INFO HASS: HASS Plugin initialization complete
2020-04-26 10:13:37.256116 INFO AppDaemon: Initializing HTTP
2020-04-26 10:13:37.256948 INFO AppDaemon: Using 'ws' for event stream
2020-04-26 10:13:37.292301 INFO AppDaemon: Starting API
2020-04-26 10:13:37.306920 INFO AppDaemon: Starting Admin Interface
2020-04-26 10:13:37.308365 INFO AppDaemon: Starting Dashboards
2020-04-26 10:13:37.346482 INFO HASS: Connected to Home Assistant 0.108.9
2020-04-26 10:13:37.413064 INFO AppDaemon: App 'dimmer_all_lifx' added
2020-04-26 10:13:37.414780 INFO AppDaemon: Found 1 total apps
2020-04-26 10:13:37.415677 INFO AppDaemon: Starting Apps with 1 workers and 1 pins
2020-04-26 10:13:37.418837 INFO AppDaemon: Running on port 5050
2020-04-26 10:13:37.484846 INFO HASS: Evaluating startup conditions
2020-04-26 10:13:37.530409 INFO AppDaemon: Got initial state from namespace default

Here are two screen shots, one of the appdaemon.yaml and one off my config for the dimmer switch.

Unfortunately it’s still now working.

there is an update for appdaemon, i’ll do it and restart homeassistant.

I just checked how HA is receiving the deconz_event and noticed that the name of the switch (dimmer_switch) was wrong.
I updated it but with no success.

Listening form deconz_event:

New config in apps folder:

Oke this looks good, can you please show the log again after you added the yaml config for the dimmer switch?

here is the log again:

Log
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 

-----------------------------------------------------------
 Add-on: AppDaemon 4
 Python Apps and Dashboard using AppDaemon 4.x for Home Assistant
-----------------------------------------------------------
 Add-on version: 0.2.5
 You are running the latest version of this add-on.
 System: Raspbian GNU/Linux 10 (buster)  (armv7 / raspberrypi4)
 Home Assistant Core: 0.108.9
 Home Assistant Supervisor: 219
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] appdaemon.sh: executing... 
[cont-init.d] appdaemon.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[11:52:14] INFO: Starting AppDaemon...
2020-04-26 11:52:15.818200 INFO AppDaemon: AppDaemon Version 4.0.3 starting
2020-04-26 11:52:15.818636 INFO AppDaemon: Python version is 3.8.2
2020-04-26 11:52:15.819003 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2020-04-26 11:52:15.819345 INFO AppDaemon: Added log: AppDaemon
2020-04-26 11:52:15.819746 INFO AppDaemon: Added log: Error
2020-04-26 11:52:15.820089 INFO AppDaemon: Added log: Access
2020-04-26 11:52:15.820398 INFO AppDaemon: Added log: Diag
2020-04-26 11:52:15.869856 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2020-04-26 11:52:15.929713 INFO HASS: HASS Plugin Initializing
2020-04-26 11:52:15.930515 INFO HASS: HASS Plugin initialization complete
2020-04-26 11:52:15.931805 INFO AppDaemon: Initializing HTTP
2020-04-26 11:52:15.932841 INFO AppDaemon: Using 'ws' for event stream
2020-04-26 11:52:15.964704 INFO AppDaemon: Starting API
2020-04-26 11:52:15.975094 INFO AppDaemon: Starting Admin Interface
2020-04-26 11:52:15.976034 INFO AppDaemon: Starting Dashboards
2020-04-26 11:52:15.999544 INFO HASS: Connected to Home Assistant 0.108.9
2020-04-26 11:52:16.036978 INFO AppDaemon: App 'dimmer_all_lifx' added
2020-04-26 11:52:16.039080 INFO AppDaemon: Found 1 total apps
2020-04-26 11:52:16.040269 INFO AppDaemon: Starting Apps with 1 workers and 1 pins
2020-04-26 11:52:16.042267 INFO AppDaemon: Running on port 5050
2020-04-26 11:52:16.095617 INFO HASS: Evaluating startup conditions
2020-04-26 11:52:16.135956 INFO AppDaemon: Got initial state from namespace default
2020-04-26 11:52:18.059062 INFO AppDaemon: Scheduler running in realtime
2020-04-26 11:52:18.071438 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2020-04-26 11:52:18.073628 INFO AppDaemon: Adding /config/appdaemon/apps/Hue_Dimmer_Deconz to module import path
2020-04-26 11:52:18.084024 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/Hue_Dimmer_Deconz/hue_dimmer_switch_deconz.py - ignoring
2020-04-26 11:52:18.089641 INFO AppDaemon: App initialization complete

If I’m right it is correct, that the “dimmer_switch” entity is not showing up here, due to the event handling of HA?

The event id seems to be correct.

I just saw that the module name in the dimmer config is incorrect. It should be like this:

dimmer_all_lifx:
  module: hue_dimmer_switch_deconz
  class: HueDimmerSwitch
  entities:
    switch: dimmer_switch
    light: light.all_lifx

Just for your information, the smooth dimming works only with lights integrated with Deconz, the smooth dimming will not work for your Lifx bulbs, the rest will work like turn on/off, calling service etc

unzz, thx.

I would’ve probably never found it.

sad, that i cant do dimming for the lifx bulbs, that was actually my main intension.

https://github.com/Burningstone91/Hue_Dimmer_Deconz

FYI: In your advanced example config the “deconz” is missing too for the module.

Take a look at ControllerX, it’s also an AppDaemon app, but more sophisticated than mine. I don’t know how smooth the dimming is there, you need to check yourself.

Yeah, I just saw that after I corrected your code, thanks for the info.
The thing is, I probably won’t continue with this app (I’ll continue to use it in my system however), because it only supports Deconz and from the feedback I read, people are quite happy qith Cobtroller X, that I mentioned above.

I just tried it and it works quite well, the dimming is not as smooth as i was hoping for but still great and more than enough for daily use. Thx for the tipp.

1 Like

Just a question i probably already know the answer to; the Hue Tab (zigbee green power) won’t be able to do this, right? You need a battery powered switch for this?

Do you use deconz? What kind of lights do you use and are they connected through deconz as well?