Skip to content

Is UnitPrefix implemented in the best way? #33

@flatsiedatsie

Description

@flatsiedatsie

I don't know what I'm talking about, but currently the "UnitPrefix" data type seems a bit strange. Right now it can be a property of a thing. This results in something like "pressure" being displayed as a separate string in the interface (in the cases that a MySensors device actually sends a prefix along)

When I looked at set.rs I noticed that there actually is a way to set the pre/postfix of a device.

    pub fn unit(&self) -> &'static str {
        match *self {
            SetReqType::Temp => "celsius",
            SetReqType::Percentage => "%",
            _ => "",
        }
    }

Shouldn't the UnitPrefix data (if MySensors sends it at all) end up in that list?

From my limited understanding, for a device that measures barometric pressure it should send the string "mBar" as the V_UNIT_PREFIX.

V_UNIT_PREFIX is only sent once I think, when the device starts. It has the same child ID as the actual sensor data that will be coming in after it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions