Skip to content

1a86:5523 TEMPerX232_V2.1 with external sensor show no humidity - review regexp #27

@marulinko

Description

@marulinko

Regexp parsing outer sensor is not properly handling external sensor.
Here is output which should be parsed:

Temp-Outer:27.11 [C],36.72 [%RH]<Temp-Inner:28.15 [C],34.80 [%RH]<

Working regexp (should be review)

>>> m = re.search(r'Temp-Outer:([0-9]{1,2}.[0-9]{1,2}).{4},([0-9][0-9].[0-9][0-9]).*' , 'Temp-Outer:26.89 [C],36.23 [%RH]<Temp-Inner:28.17 [C],34.87 [%RH]<')
>>> m.group(1)
'26.89'
>>> m.group(2)
'36.23'
 and add line to show it, like
info['external temperature'] = float(k.group(1))
info['external humidity'] = float(k.group(2))

Working example:
Temp-Outer:27.11 [C],36.35 [%RH]<Temp-Inner:28.16 [C],34.64 [%RH]<
[
    {
        "vendorid": 6790,
        "productid": 21795,
        "manufacturer": "",
        "product": "",
        "busnum": 1,
        "devnum": 14,
        "devices": [
            "ttyUSB0"
        ],
        "firmware": "TEMPerX232_V2.1",
        "internal temperature": 28.16,
        "internal humidity": 34.64,
        "external temperature": 27.11,
        "external humidity": 36.35
    }
]

OR:
Temp-Outer:27.11 [C],37.33 [%RH]<Temp-Inner:28.18 [C],34.93 [%RH]<

Bus 001 Dev 014 1a86:5523 TEMPerX232_V2.1 28.18C 82.72F 34% 27.11C 80.80F 37%

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