Hi, I’m a consumer attempting to edit the presentation of a Zigbee light switch I’ve bought to better suit my needs - I’m new to Smartthings stuff so apologies if my questions are rudimentary, but I’m hoping someone here can help me out because I’ve hit a bit of a roadblock.
I originally attempted to do this via DTHs but the other day discovered I can no longer access the Groovy IDE and DTHs have been deprecated, so I have now migrated my switch to this Edge driver (successfully).
The actual JSON presentation change is very simple, I just want a few push buttons added under the slider in the detail view which shortcut to preset dimmer levels; I have no issues adding these into the presentation JSON file (I was unable to find the exact original JSON for the stock presentation anywhere online but this apparently unofficial, user-published copy did show on Google and looks fairly faithful so I’m using that as a base), but my confusion is then how to change the driver I linked above to use this presentation file instead of the default, stock one.
What I have tried:
As far as I can tell I can’t just slot in the new presentation to the original capability and see it changed just for my user account:
smartthings capabilities:presentation:update switchLevel 1 --input switch-level-presentation.json
returns a 403 so I assume it’s trying to change it globally, which understandably I’m denied access to do (Question 1: Is my interpretation of this error correct?)
So I’ve resorted to duplicating the entire capability JSON just to associate a custom presentation with it, which I’ve done by running
smartthings capabilities:create -i switch-level.json
where the switch-level.json
file was obtained from the documentation site for Smartthings production capabilities at h ttps://developer-preview.smartthings.com/capabilities/switchLevel (I can’t post a 3rd link in my post because of forum rules). Bizarrely though, despite being the official source for the capabilitiy, when I tried creating this with the JSON as-is I got an error that setLevel
can only accept one argument and I had to delete the rate
parameter for it to work. (Question 2: How can it be that the official capability JSON isn’t accepted as valid in the Smartthings CLI? Is it out of date?)
Anyway I created this new capability, renaming it to switchLevelCustom
in the JSON before I ran the command, and I can see from the output it gave me that Smartthings further renamed the capability to give it the ID greenoption21184.switchLevelCustom
. Not sure why, but fine. So now I run
smartthings capabilities:presentation:update greenoption21184.switchLevelCustom 1 --input switch-level-presentation.json
using the modified unofficial presentation JSON I referenced towards the top of the post and that works fine.
Now all the references to the capability in the Edge driver are still pointing to switchLevel
rather than greenoption21184.switchLevelCustom
, so I do a find-replace in all the Lua files in the driver from capabilities.switchLevel
to capabilities['greenoption21184.switchLevelCustom']
, and change the device profile it’ll use (switch-level.yml
) to point to greenoption21184.switchLevelCustom
instead too. I install the modified driver using
smartthings edge:drivers:package zigbee-switch -I
and I can see in the Smartthings app that it’s using this new version, but when I try and move the dimmer slider I just get “A network or server error occurred. Try again later.”
So something’s not right. My assumption is the Lua code failed at run-time but I don’t know any detail how.
Question 3: Anyone know to hand what I’ve done wrong?
Question 4: Is there anywhere I can self-serve diagnostics on the error? Somewhere I can access logs?
Question 5: Even better, I don’t suppose there are any resources around that could guide me to an actual debugging experience with the drivers? I’m using VS Code.
Question 6: Am I really choosing the path of least resistance here to simply adding a few buttons to the app? I feel like it should be less work, not sure if I missed a simpler alternative method.
Happy to also provide the exact files I’m using on GitHub if it would help. Information on any of my questions or just on the post generally is much appreciated. Thanks.