Modbus thermostat : stepper don't work (

OK, in my “lab test” I actually used Magic thing which is not exactly the same. I think I found the root cause for the behaviour

I debugged live instance of 4.x series (4.1.1, I suspect the same happens with newer version), Number:Temperature linked to modbus:data number channel and found out the spot where the quantity command is stripped from its unit

So with 4.x, openHAB no longer passes the quantity with “plain Number” channels, even when the item might have the quantity configured. Modbus gain offset profile was banking on receiving the original command, so that it can do unit-aware conversion to raw number.

The PR that introduced this was [uom] Add `unit` metadata for NumberItem by J-N-K · Pull Request #3481 · openhab/openhab-core · GitHub from @J-N-K . It’s straight in the PR description:

  • The CommunicationManager strips the unit and sends DecimalType if the channel has the accepted item-type Number, it adds the item-unit if the dimension of the item and the channel are the same. Commands with incompatible dimension are rejected. “Guessing” a unit based on the channel type when the item is dimensionless has been removed as it is confusing.

This is once again perhaps issue to bindings like modbus, mqtt etc which work with these “generic” channels, not having specialized Number channels for all the dimensions…

I can see how the intent is good but it also works against the idea where one uses profile to make things “compatible”. In this case, the profile is converting scaled modbus data (e.g. value of 35 encoded as 16bit Two’s complement) to numbers with unit (3.5 Celsius).


On related note, it reminds me of similar web-ui issue Number channel cannot be linked to Switch Item (with profile) · Issue #1478 · openhab/openhab-webui · GitHub, (UI does not allow linking Number channel with Switch item) and comment from @rlkoshak Number channel cannot be linked to Switch Item (with profile) · Issue #1478 · openhab/openhab-webui · GitHub

There are a number of new things that recent changes to Profiles have made possible that are not accounted for in MainUI. In particular the ability to change the type of the Item from a Number to a Switch (for example) which, prior to 3.2 (maybe even as recent as 3.3) was not possible.

@florian-h05

1 Like