OmniThing icon indicating copy to clipboard operation
OmniThing copied to clipboard

CommandExecuterSwitch parameter passing

Open sfalvey opened this issue 5 years ago • 7 comments

If I have a script that takes a numeric value as a parameter 0-255 such as for a dimmer switch or fan controller, is it possible to get this parameter via ST into OmniThing and onto the command line parameter for a switch output?

I'm working on a tuya smartlife script for my devices that I would like to use with omnithing as i can't get ty-connector to work for me and my devices are too new to be able to load tasmota through tuya ota.

sfalvey avatar Jul 08 '19 11:07 sfalvey

I've just released version 0.8.0 which adds CommandExecuterFloat. It prepends the command with setting an environment variable called OMNITHING_FLOAT_VAL to the OutputFloat value. This can be used either with SwitchLevel or the new DimmerSwitch device types.

Does this address your use case?

DanielOgorchock avatar Jul 09 '19 04:07 DanielOgorchock

It certainly sounds like it. I'll give it a shot. Does the ST UI provide some kind of slider or up/down to facilitate its use?

Thanks!

sfalvey avatar Jul 09 '19 04:07 sfalvey

Yes. The app has a slider for the SwitchLevel device. It has both a slider and an on/off button for the DimmerSwitch device (off sets the level to 0, and on sets it to what it was prior to turning it off).

DanielOgorchock avatar Jul 09 '19 04:07 DanielOgorchock

Thanks it seems to work but, it needs an input command too. If I change the dimmer value on the light switch this doesn't get updated in the UI. If its also possible to add on/off that would be useful but not essential.

sfalvey avatar Jul 10 '19 02:07 sfalvey

I just released 0.8.2 which adds an optional InputFloat to DimmerSwitch and SwitchLevel. You should be able to use the CommandParser to run a script that prints the level value to stdout (make sure it's scaled 0-100).

What do you mean by adding on/off? DimmerSwitch allows you to toggle on/off. Or do you mean a separate output/input pair that's a digital on/off like the Switch device has?

DanielOgorchock avatar Jul 10 '19 03:07 DanielOgorchock

Wow you are quick with those updates. I've just finished putting all my lights on and its working well after a little debugging at my end. I'll give 0.8.2 a go later today or tomorrow.

Yes with regard to on/off. In the native smart life control app there is an on/off selector plus a % level. This allows the light to come on at its previous setting and turn off without taking the brightness to zero.

sfalvey avatar Jul 10 '19 03:07 sfalvey

I'm having some problems with the dimmer light status. I have the status script returning 0-100 on stdout to indicate the dimmer level and return code 1=off 0=on. When the lights are off "0" gets printed and return code 1. But ST thinks the light is switched on with the dimmer set to 0. Am I returning the expected values correctly?

sfalvey avatar Jul 15 '19 10:07 sfalvey