openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

[exec] ON/OFF not mapped properly to a switch item #5886

Closed Flole998 closed 3 years ago

Flole998 commented 5 years ago

I have a script that is getting the Status of an Item. Unfortunately the ON/OFF returned by the script is not mapped properly to my switch. The Debug Logs show:

23:01:07.948 [DEBUG] [nhab.binding.exec.handler.ExecHandler] - Exec [OUTPUT]: 'ON'
23:01:07.961 [DEBUG] [nhab.binding.exec.handler.ExecHandler] - Transformed response is 'ON'

Still the item stays OFF

I am not entirely sure when this broke, it seems to affect others aswell since 2016 (in German).

I will investigate this further and come up with a PR soon.

udo1toni commented 5 years ago

Afaik Exec Binding does only support String Items.

Flole998 commented 5 years ago

Yes that is the case at the moment, however the openhab1 binding supports all items, so the openhab2 binding should aswell.

Rossko57 commented 5 years ago

Perhaps a more general utility would be a profile type that could map/parse a string type channel to a switch type item

cweitkamp commented 5 years ago

@Rossko57 A draft is already WIP: https://github.com/openhab/openhab-core/pull/744

J-N-K commented 3 years ago

This can be solved with rules.

Flole998 commented 3 years ago

@J-N-K That might be true, but every binding can be implemented using exec, so you are going to close all requests related to other bindings aswell now? All transformations can be implemented using exec, so all other transformations can be removed? In general, transformations can be replaced with rules, so there's no need for transformations at all? Its a regression as OpenHAB1 had rules aswell but allowed to map to a switch.

Rules are not a replacement for proper bindings, not at all. If you would maintain a 500-1000 item installation you would know what I'm talking about and why rules are bad (they stop working randomly sometimes). Also having 500 lines of rules for is absolutely no fun and is also bad for maintainability. Not to mention that the amount of items gets doubled for all the proxy items needed.

J-N-K commented 3 years ago

I think it‘s 18 month and nobody came up with a proposal how to solve that. And there is a working solution. But if you wish, I can re-open a dead issue.

Flole998 commented 3 years ago

The problem is that openHAB 1 addons will be deprecated when openHAB 3 is introduced, so then it's mandatory to use the limited openHAB 2/3 addon. My solution is currently just using the openHAB 1 binding, but that won't last forever.

Thanks for bringing up that this issue is not fixed though, I honestly forgot about it. As the exec-binding is correctly listed as "non-feature-compatible" in #6179 this should be adressed at some point, as this is one of the reasons for that.

Rossko57 commented 3 years ago

See my earlier comment. So far as I know, the transform profile in OH3 is now capable of porting any binding channel type to any Item type (if you get the transformed data format correct).

This profile can be used to link Exec binding string-type output channel to any Item type - Switch, Number, DateTime - with your suitable transform. More functionality than OH1 Exec binding.

hmerk commented 3 years ago

closed due to inactivity