smarthomej / addons

SmartHome/J addons for openHAB
Eclipse Public License 2.0
59 stars 23 forks source link

[tuya] Separate Power / Switch channel for lights #339

Closed jimtng closed 2 years ago

jimtng commented 2 years ago

I noticed that for a lightbulb item, the binding creates color and dimmer channels that have dp2 linked to on/off. However, there's no separate on/off channel by itself to allow me to turn the light on/off without changing the color/dimmer value.

Would you create a separate channel for this please?

BigGeorgeTx commented 2 years ago

I will let the developers respond to your programming request. I have found that I can manually at the on/off channel by finding the switch DP in the dimmer channel and then creating a new switch channel and giving it that DP. It works well. I agree it would be great if the binding did it automatically.

J-N-K commented 2 years ago

In general openHAB tried to avoid unnecessary channels. You can send ON or OFF commands via a switch to the color/dimmer channel and only on/off is transmitted to the device, so the stored brightness/color of the device stays unchanged.

Adding the channel would be inconsistent with all other bindings, which do not provide such a channel in the same situation (like hue, deconz, etc.).

If you really need an addition switch channel, you can use the workaround suggested by @BigGeorgeTx.

jimtng commented 2 years ago

I didn't know that a Dimmer item would send a separate ON/OFF. I thought ON is translated to 0 and ON to 100, and therefore it would lose its brightness setting. This is how it is with mqtt (afaik) and tasmota, the Dimmer channel is dimmer (0-100) and power is on/off. Sending OFF to dimmer simply sends 0 to Tasmota's dimmer value.

If the Tuya binding actually sends ON/OFF on the dimmer, I guess I could just link the channel to two items: one a SwitchItem for on/off and one Dimmer, and then it would work the way I'm accustomed to, without even having to use the workaround suggested by @BigGeorgeTx. WDYT?

I haven't used the Tuya binding and I have reverted back to using tuya-mqtt because the binding hasn't been stable for me, and I haven't had a chance to troubleshoot all the issues.

J-N-K commented 2 years ago

Yes, it should be possible to link two items to the channel. If you experience problems, please open an issue for that. Thanks.