Skip to content

Writing analog values doesn't work #2

@MH-EQ

Description

@MH-EQ

The problem is caused by this method:

private static Encodable encodeFloat(Type type){
    if(type instanceof DecimalType){
        return new Real(((PercentType)type).floatValue());
    }
    throw new IllegalArgumentException("Cannot convert openHAB type " + type + " to integer");
}

The cast is wrong. As the if has proven, the value is of class DecimalType, not of class PercentType. Casting to DecimalType makes writing work again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions