Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
marulinko opened this issue Dec 9, 2020 · 0 comments

Comments

@marulinko
Copy link

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%

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

No branches or pull requests

1 participant