Custom Commands. Doesn't Show My Lux Device For setLux()

Hi @bravenel, @bobbyD, @mike.maxwell
I'm trying to create a custom command to manually set a Virtual Lux Device.
I go into custom commands, select the virtual lux device to test against and select the command setLux(0.5).
Save all the way out and I can see the command in the RM app list.
image
When I now go into a rule and in actions select 'Run custom commands' I can select the saved custom command.
When I click on the 'select devices to run the command on' option, there is noting in the list.
image
Am I doing something glaringly wrong or there an issue here.
Thanks.

Did you create the command with the same device you are trying to access now? Have you confirmed that the device has the command setLux on the device edit page? Also, you created the custom command without any parameters. You won't be able to set those in the rule, you would have to do it in the custom command creation. For example, setLux (30) or setLux (60) would be two separate custom commands. You should see either a pass or fail when you create the custom command. Make sure it succeeds before you try and save it.

Thanks for the reply.

Yes. It appears and is selectable when I set up the custom command but not when I set up a rule.

Yes.
image

That's also a weird thing. When I set the parameter and save it, it saves it with no text. I decided to move on from this and just get things saved without the parameter.

I get the message that is has succeeded.

All very strange.

The custom command should be displayed as setLux (30) for example instead of just setLux().

I appreciate what you are saying but it doesn't explain why when selecting the custom command it doesn't display any devices.
Something funny is afoot me thinks.........

I will try and get the command saved with a parameter though.

Because it's not a valid command without the parameter. That's why I suspect no devices are showing up. You can't just issue setLux to the device. That's just a theory....which is easy enough to test by getting the custom command to save with a parameter.

OK. Progress of sorts.
Managed to get setLux saved with a parameter. I was trying decimal and integer and it wouldn't save properly. Tried using string and putting in 0.5 and it now saves OK.
In the logs I can see that the setLux('0.5') was sent OK and indeed the virtual lux sensor value has also changed to 0.5.
image
image
This proves it is now working and doing what it should with the device.

Unfortunately I still cannot select any devices. :rage:
image

Does the device accept a string for the lux setting? What are the parameters for setLux? Does it have to be a number? An integer?

Number, integer or string.
Number and integer do not save properly when used. String does.
Logs show that string works and does set the lux sensor.
Think I will raise a support ticket.

No no...in the device's driver...what is the driver written to accept?

The driver accepts decimal.

command "setLux", ["decimal"]

Let me try adding string.

EDIT: No joy.

Select sensor for the device type in the custom command

Hi @mike.maxwell I must be missing something here but I don't know what you mean. I have selected a sensor to test against but thats all I see.

I think Mike meant select the capability sensor not illuminance.

@mike.maxwell Unfortunately there is not an option for 'sensor'.

Ticket 11669 raised.

I've received notification that a fix has been identified and will be in a future release.
Thanks HE team.

1 Like

Just loaded 2.0.5 update and can confirm this issue has been resolved.
Thanks Hubitat Team.

1 Like