Created
July 26, 2021 08:16
-
-
Save ozkansen/c97784c56b0e695e04cf5739fc425f73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
from dataclasses import dataclass | |
@dataclass | |
class ArduinoStatus: | |
sicaklik : float | |
battery : float | |
isik_sens : int | |
isik_role : int | |
kasa_kapak : int | |
cpu_fan : int | |
sc_relay : int | |
buzzer : int | |
busy : int | |
elevator : int | |
ups_on : int | |
nets_on : int | |
on_charge : int | |
standby : int | |
state : int | |
battery_error: int | |
zaman : datetime.time | |
tarih : datetime.datetime | |
ups_kapat : int | |
raw = "<sicaklik=-47.99&battery=43.36&isik_sens=0&isik_role=0&kasa_kapak=0&cpu_fan=1&sc_relay=0&buzzer=0&busy=0&elevator=0&ups_on=1,nets_on=1&on_charge=0&standby=1&state=2&battery_error=0&zaman=14:26:46&tarih=01.02.2021&ups_kapat=0>" | |
raw = raw.replace("<", "") | |
raw = raw.replace(">", "") | |
raw_status = {} | |
for r in raw.split("&"): | |
if r.startswith("sicaklik="): | |
raw_status["sicaklik"] =r[9:] | |
print(raw_status) |
YusufEminDemirci
commented
Jul 26, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment