자동검색 추가
This commit is contained in:
parent
27f5c49aec
commit
8e0beec40f
7
main.py
7
main.py
|
@ -1,11 +1,12 @@
|
|||
from miio.airpurifier import AirPurifier, OperationMode, LedBrightness
|
||||
from miio.discovery import create_device
|
||||
from collections import namedtuple
|
||||
from datetime import datetime
|
||||
import time
|
||||
from influxdb import InfluxDBClient
|
||||
import json
|
||||
from systemd import daemon
|
||||
|
||||
import socket
|
||||
|
||||
class Message(namedtuple('Message', ('measurement', 'time', 'tags', 'fields'))):
|
||||
__slots__ = ()
|
||||
|
@ -34,8 +35,8 @@ if __name__ == '__main__':
|
|||
try:
|
||||
metric = InfluxDBClient('db', database='core',
|
||||
use_udp=True, udp_port=8089)
|
||||
|
||||
dev = AirPurifier('air', '6e1e05b87d9f7cd10a3f8f43616896fa')
|
||||
air_addr=socket.gethostbyname("air")
|
||||
dev = create_device(air_addr,AirPurifier)
|
||||
tags = {
|
||||
'source': 'mi_air_2',
|
||||
'position': 'center_room',
|
||||
|
|
Loading…
Reference in New Issue