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