1
0
Fork 0

자동검색 추가

This commit is contained in:
Sangbum Kim 2017-10-22 18:33:48 +09:00
parent 27f5c49aec
commit 8e0beec40f
1 changed files with 4 additions and 3 deletions

View File

@ -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',