smarthome icon indicating copy to clipboard operation
smarthome copied to clipboard

[MQTT Generic Things] Homie define channel type

Open esdeboer opened this issue 6 years ago • 7 comments

It would be nice to be able to define the channel type for discovered homie things in paper ui.

At the moment you can't define percent value or rollershutter for homie integer data types, they will always be numbers. and I would like my dimmer to actually be a dimmer in Open Hab.

esdeboer avatar Jan 04 '19 20:01 esdeboer

I don't think that manually editing the channels is the right way to go. If you define a range via $format, the code should generate a percentage value.

If not, that's a bug then that will get fixed :)

davidgraeff avatar Jan 27 '19 01:01 davidgraeff

I've got this homie dimmer homie/crownstones/crownstone7/dimmer/$name Dimmer homie/crownstones/crownstone7/dimmer/$unit % homie/crownstones/crownstone7/dimmer/$datatype integer homie/crownstones/crownstone7/dimmer/$settable true homie/crownstones/crownstone7/dimmer/$format 0:100

this all gets set correctly in openHab 2.4, but as type number so I can't assign dimmer items to it.

I wonder if you can make an automatic distinction between number and dimmer based on the currently available input

esdeboer avatar Jan 27 '19 16:01 esdeboer

If there's a range the binding should create a dimmer channel instead. I don't know if there's any scenario where you would like to have a number channel when a range is given.

davidgraeff avatar Jan 27 '19 16:01 davidgraeff

Maybe if you want to display gauges, you would need to have a number and a range.

esdeboer avatar Jan 27 '19 20:01 esdeboer

If it should create a percentage value, it looks like a bug, as Property.java looks like it always sets value to NumberValue for floats and integers in createChannelFromAttribute

esdeboer avatar Jan 28 '19 21:01 esdeboer

Yup that need to be changed. I'd happily accept a patch if you want it done fast :)

Bonus would be another test case that checks if a min/max formatted homie property indeed creates a percentage value (so that this bug never appears again).

I haven't got time right now unfortunately.

davidgraeff avatar Jan 28 '19 22:01 davidgraeff

I might take a look at it if I can get openhab to build/test correctly

esdeboer avatar Feb 02 '19 11:02 esdeboer