Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

[Homematic] Slightly incorrect values for dimmers and other datapoints #6841

Open
sidamos opened this issue Jan 12, 2019 · 6 comments
Open

Comments

@sidamos
Copy link

sidamos commented Jan 12, 2019

I am using openHAB 2.4.0 stable and a CCU3 with the newest firmware. Devices are all HM IP. Everything has been configured with PaperUI.

Values often differ by 1 between CCU3 and openHAB.

I cannot set a dimmer to 100%. I see the command in the logs, but the CCU3 does nothing. I can set it to 0% - 99% without problems.

The reported dimmer value from the CCU3 is often one less in openHAB. For example, the dimmer is at 20% but it’s 19% in openHAB. 100% is 99%.
Setting to 60% in openHAB sets it to 60.5% in the CCU3.

Same thing for level (valve) of a thermostat. When it’s 53% in the CCU3, it is 52% in openHAB.

With debug logging, I see that the binding is sending 1.005 to the CCU3 for a dimmer value of 100. This may be the cause. I think I read somewhere in a forum, that the CCU needs this value (or factor?) for actually setting to 100%, but this may not be true anymore in current firmwares.

The Android App TinyMatic is working correctly in all these cases.

2 other minor things:
The formatted SetPointTemperature of a thermostat has 2 decimal points. 1 would be enough.

The formatted ActualTemperature of a thermostat has 0 decimal points. It should have 1.

@sidamos
Copy link
Author

sidamos commented Jan 14, 2019

Forgot to mention which devices exactly:

  • Thermostat: HmIP-eTRV
  • Dimmer: HmIP-PDT

@c--r
Copy link

c--r commented Jan 18, 2019

Same problem here (same environment):

Setting decimal values to a Homematic Item works fine, but when receiving Updates from the Homematic binding, values get rounded to integer values:

BL_AZ_temp in my case is defined as a Rollershutter Item (for a HM-LC-Bl1PBU-FM), but I also tried Dimmer with the same results unfortunately.

Setting 99.5 to item works fine and gets send to Homematic as 0.005 correctly (Homematic uses different value range):

2019-01-18 10:28:21.110 [DEBUG] [ommunicator.AbstractHomematicGateway] - Received new (String) value 'CCU3' for 'CENTRAL:0#PONG' from gateway with id 'CCU3'
2019-01-18 10:28:23.207 [DEBUG] [rest.core.internal.item.ItemResource] - Received HTTP POST request at 'items/BL_AZ_temp' with value '99.5'.
2019-01-18 10:28:23.239 [DEBUG] [ntime.internal.engine.RuleEngineImpl] - Executing rule 'Test1'
2019-01-18 10:28:23.235 [DEBUG] [nternal.profiles.ProfileCallbackImpl] - Delegating command '99.5' for item 'BL_AZ_temp' to handler for channel 'homematic:HM-LC-Bl1PBU-FM:CCU3:OEQxxxxxxx:1#LEVEL'
2019-01-18 10:28:23.253 [DEBUG] [nternal.common.InvocationHandlerSync] - Already in a safe-call context, executing 'ThingHandler.handleCommand()' directly on 'org.eclipse.smarthome.binding.homematic.handler.HomematicThingHandler@a642e5'.
2019-01-18 10:28:23.259 [DEBUG] [ematic.handler.HomematicThingHandler] - Received command '99.5' for channel 'homematic:HM-LC-Bl1PBU-FM:CCU3:OEQxxxxxxx:1#LEVEL'
2019-01-18 10:28:23.268 [DEBUG] [ommunicator.AbstractHomematicGateway] - Sending datapoint 'OEQxxxxxxx:1#LEVEL' with value '0.005' to gateway with id 'CCU3' using rxMode 'DEFAULT'
2019-01-18 10:28:23.288 [DEBUG] [se.smarthome.model.script.main.rules] - BL_AZ_temp.state: 99.5

But when the update is received from the Homematic item (also correctly as 0.005), it gets converted/rounded to 100:

2019-01-18 10:28:25.895 [DEBUG] [ommunicator.AbstractHomematicGateway] - Received new (Double) value '0.005' for 'OEQxxxxxxx:1#LEVEL' from gateway with id 'CCU3'
2019-01-18 10:28:25.906 [DEBUG] [ommunicator.AbstractHomematicGateway] - Received new (Boolean) value 'false' for 'OEQxxxxxxx:1#WORKING' from gateway with id 'CCU3'
2019-01-18 10:28:25.912 [DEBUG] [ntime.internal.engine.RuleEngineImpl] - Executing rule 'Test1'
2019-01-18 10:28:25.917 [DEBUG] [ommunicator.AbstractHomematicGateway] - Received new (Integer) value '0' for 'OEQxxxxxxx:1#DIRECTION' from gateway with id 'CCU3'
2019-01-18 10:28:25.953 [DEBUG] [se.smarthome.model.script.main.rules] - BL_AZ_temp.state: 100

fyi, The rule "Test1" looks like this:

rule "Test1"
when 
    Item BL_AZ_temp received update
then
    logDebug("main.rules", "BL_AZ_temp.state: " + BL_AZ_temp.state)
end

The same behaviour can be observed using the REST API.

For me this is a problem, because:
a) I cannot control my blinds (Jalousie/Raffstore) exactly enough (tilting angle needs such exact control)
b) there is a mismatch between the value in Openhab (100) and the real world (99.5), which makes writing proper rules nearly impossible

@c--r
Copy link

c--r commented Jan 18, 2019

TRACE debug level shows further information:

2019-01-18 12:03:19.097 [TRACE] [converter.type.AbstractTypeConverter] - Converting FLOAT value '0.005' with PercentTypeConverter for 'OEQxxxxxxx:1#LEVEL'

So this code snippet seems to be causing the problem:
PercentTypeConverter.java

    @Override
    protected PercentType fromBinding(HmDatapoint dp) throws ConverterException {
        Double number = ((Number) dp.getValue()).doubleValue();
        int percent = (int) ((100 / dp.getMaxValue().doubleValue()) * number);

        if (MetadataUtils.isRollerShutter(dp)) {
            percent = 100 - percent;
        }
        return new PercentType(percent);
    }

Changing "percent" to a double value would probably solve the issue. I am not a software engineer myself, so hofully someone else can make the change.

@c--r
Copy link

c--r commented Jan 18, 2019

With Homematic1.x binding (in openhab2.4.0), it is possible to use a Number Item, which seems to work due to the different Converter applied:

2019-01-18 17:39:24.495 [DEBUG] [l.communicator.HomematicCommunicator] - Received new (Double) value '0.15' for DatapointConfig[address=LEQxxxxxxx,channel=1,parameter=LEVEL]
2019-01-18 17:39:24.499 [DEBUG] [onverter.state.AbstractTypeConverter] - Converting (Double) value '0.15' with DecimalTypeConverter for HmDatapoint[address=LEQxxxxxxx,channel=1,parameter=LEVEL]

Number Item does not work with Homematic 2.x add-on due to a conversion problem:

2019-01-18 11:48:43.584 [DEBUG] [.thing.internal.CommunicationManager] - Received not accepted type 'DecimalType' for channel 'homematic:HM-LC-Bl1PBU-FM:CCU1:OEQxxxxxx:1#LEVEL'
2019-01-18 11:48:43.592 [DEBUG] [.thing.internal.CommunicationManager] - Received event '99.5' (DecimalType) could not be converted to any type accepted by item 'BL_AZ_temp' (Number)

@FaHuSchmidt
Copy link

+1

@sidamos
Copy link
Author

sidamos commented Dec 26, 2019

Migrated to openhab/openhab-addons#6688.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants