Maker API setLevel doesn't work with double-digits

If I issue a setLevel command to a Maker-enabled device (examples below are using the stock Virtual Dimmer driver), it works with 0-9 but not with any double-digit values. Same issue using both local and cloud endpoints.

Using the following URL, I can successfully send a setLevel command for 0 thru 9%:
http://192.168.0.118/apps/api/1462/devices/706/setLevel/2?access_token=xxxxxxxxxxxxxx

Using double or triple-digit numbers gives the following error:
http://192.168.0.118/apps/api/1462/devices/706/setLevel/40?access_token=xxxxxxxxxxxxxx

Tagging @patrick

I was able to get it to work with 100, 70, 20...

http://192.168.1.12/apps/api/56/devices/1089/setLevel/100?access_token=TOKEN

http://192.168.1.12/apps/api/56/devices/1089/setLevel/70?access_token=TOKEN

And the light dimmed to the correct level.
17-20-26-27

I'm actually not able to get it to work with setLevel at all if the url corrects to "setlevel" instead. Would that have to be corrected to not care about capitalization or would only the properly formatted command be accepted? I ask because browsers will always autocorrect the URL.

[app:56](http://192.168.1.12/logs#app56)2018-12-17 08:16:50.441 pm [error](http://192.168.1.12/installedapp/configure/56)java.lang.IllegalArgumentException: Command 'setlevel' is not supported by device. (sendDeviceCommandSecondary)

@Ryan780 what version are you on? I'm on 2.0.2.111

Same
That error you are posting is from the device not from the Maker API. Wouldn't that mean a problem in the driver not the Maker API? What does the Maker API log say?

You are correct...testing now with a real dimmer instead of virtual...one sec

**edit - getting the same error with a real dimmer. Here's the full logs

"Office Lamp" is just a generic zigbee bulb. I just test with a HueBridgeRGBW bulb and setLevel from the maker API doesn't work at all. Nothing at all shows up in the bulbs logs even though the command is accepted by the maker API with no problem.

So, it looks like it's device specific. And with some, setLevel doesn't work if it's a single digit either. So, is this really a Maker API issue or a driver issue? I don't know enough about those errors to determine that...

1 Like

Not sure what driver you were using for your Virtual but I tried with the built in driver and I get a different error than you were getting.

Then I tried sending the 100 in quotes. After that I got the same error as you, even when I removed the quotes. So, there is definitely something up with the way the Maker API is accepting the second component.

1 Like

My initial testing was also with the stock Virtual Dimmer driver. The actual device I tried is using Generic Z-Wave Smart Dimmer driver.

Could Generic Zigbee Bulb be the only one to work?!? What are the odds of that? Now I want to go through and try it with all the different dimmers in my system.... hehe.

2 Likes

So it turns out its inconsistent in how drivers handle a string vs a number for setLevel. Maker API sends it as a string.

The simple answer is to fix Maker API to check if the scondary parameter is a number and send it to the device as an integer at this point and have submitted a ticket.

5 Likes

Thanks @patrick!

Somehow this got fixed in one of the previous released but I didn't see it any of the release notes. Just tried it for one of my lights and it works now. Just thought I'd close the loop.

2 Likes