DanielOgorchock / OmniThing

OmniThing turns your ESP32, ESP8266, Raspberry Pi, Linux Computer, or Windows Computer into a SmartThings composite Device. It is being developed as a cross-platform successor to ST_Anything.
GNU General Public License v3.0
64 stars 16 forks source link

CommandExecuterSwitch parameter passing #14

Open sfalvey opened 5 years ago

sfalvey commented 5 years ago

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.

DanielOgorchock commented 5 years ago

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?

sfalvey commented 5 years ago

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!

DanielOgorchock commented 5 years ago

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).

sfalvey commented 5 years ago

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.

DanielOgorchock commented 5 years ago

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?

sfalvey commented 5 years ago

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 commented 5 years ago

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?