Fix for warning import
This commit is contained in:
parent
6e9bc517a3
commit
b181478258
@ -1,6 +1,6 @@
|
|||||||
from module import mqtt_test_client, init_state, state_change_by_mqtt
|
from module import mqtt_test_client, init_state, state_change_by_mqtt
|
||||||
from devices import my_powerplug as test_device
|
from devices import my_powerplug as test_device
|
||||||
from devices import warning
|
from devices.base import warning
|
||||||
from mqtt import mqtt_client
|
from mqtt import mqtt_client
|
||||||
import pytest
|
import pytest
|
||||||
import time
|
import time
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from module import mqtt_test_client, init_state, state_change_by_mqtt
|
from module import mqtt_test_client, init_state, state_change_by_mqtt
|
||||||
from devices import shelly as test_device
|
from devices import shelly_sw1 as test_device
|
||||||
from devices import warning
|
from devices.base import warning
|
||||||
from mqtt import mqtt_client
|
from mqtt import mqtt_client
|
||||||
import pytest
|
import pytest
|
||||||
import time
|
import time
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from module import mqtt_test_client, init_state, state_change_by_mqtt
|
from module import mqtt_test_client, init_state, state_change_by_mqtt
|
||||||
from devices import silvercrest_motion_sensor as test_device
|
from devices import silvercrest_motion_sensor as test_device
|
||||||
from devices import warning
|
from devices.base import warning
|
||||||
from mqtt import mqtt_client
|
from mqtt import mqtt_client
|
||||||
import pytest
|
import pytest
|
||||||
import time
|
import time
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from module import mqtt_test_client, init_state, state_change_by_mqtt
|
from module import mqtt_test_client, init_state, state_change_by_mqtt
|
||||||
from devices import silvercrest_powerplug as test_device
|
from devices import silvercrest_powerplug as test_device
|
||||||
from devices import warning
|
from devices.base import warning
|
||||||
from mqtt import mqtt_client
|
from mqtt import mqtt_client
|
||||||
import pytest
|
import pytest
|
||||||
import time
|
import time
|
||||||
|
@ -100,24 +100,3 @@ class group(object):
|
|||||||
return getattr(self[0], name)
|
return getattr(self[0], name)
|
||||||
else:
|
else:
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
|
|
||||||
class warning(dict):
|
|
||||||
TYPE_BATTERY_LOW = 1
|
|
||||||
TYPE_OVERTEMPERATURE = 2
|
|
||||||
#
|
|
||||||
KEY_ID = 'id'
|
|
||||||
KEY_TYPE = 'type'
|
|
||||||
KEY_TEXT = 'text'
|
|
||||||
KEY_TM = 'tm'
|
|
||||||
|
|
||||||
def __init__(self, identification, type, text, args):
|
|
||||||
super().__init__({
|
|
||||||
self.KEY_ID: identification,
|
|
||||||
self.KEY_TYPE: type,
|
|
||||||
self.KEY_TEXT: text % args,
|
|
||||||
self.KEY_TM: time.localtime(),
|
|
||||||
})
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return time.asctime(self.get(self.KEY_TM)) + ": " + self[self.KEY_TEXT] + " - " + self[self.KEY_ID]
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
from base import mqtt_base
|
from base import mqtt_base
|
||||||
from base import videv_base
|
from base import videv_base
|
||||||
import json
|
import json
|
||||||
|
import time
|
||||||
|
|
||||||
BATTERY_WARN_LEVEL = 10
|
BATTERY_WARN_LEVEL = 10
|
||||||
|
|
||||||
@ -102,3 +103,24 @@ class base(mqtt_base):
|
|||||||
self.mqtt_client.send('/'.join([self.topic, key, self.TX_TOPIC] if len(self.TX_TOPIC) > 0 else [self.topic, key]), data)
|
self.mqtt_client.send('/'.join([self.topic, key, self.TX_TOPIC] if len(self.TX_TOPIC) > 0 else [self.topic, key]), data)
|
||||||
else:
|
else:
|
||||||
self.logger.error("Unknown tx toptic. Set TX_TOPIC of class to a known value")
|
self.logger.error("Unknown tx toptic. Set TX_TOPIC of class to a known value")
|
||||||
|
|
||||||
|
|
||||||
|
class warning(dict):
|
||||||
|
TYPE_BATTERY_LOW = 1
|
||||||
|
TYPE_OVERTEMPERATURE = 2
|
||||||
|
#
|
||||||
|
KEY_ID = 'id'
|
||||||
|
KEY_TYPE = 'type'
|
||||||
|
KEY_TEXT = 'text'
|
||||||
|
KEY_TM = 'tm'
|
||||||
|
|
||||||
|
def __init__(self, identification, type, text, args):
|
||||||
|
super().__init__({
|
||||||
|
self.KEY_ID: identification,
|
||||||
|
self.KEY_TYPE: type,
|
||||||
|
self.KEY_TEXT: text % args,
|
||||||
|
self.KEY_TM: time.localtime(),
|
||||||
|
})
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return time.asctime(self.get(self.KEY_TM)) + ": " + self[self.KEY_TEXT] + " - " + self[self.KEY_ID]
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
from devices.base import base
|
from devices.base import base
|
||||||
from devices.base import BATTERY_WARN_LEVEL
|
from devices.base import BATTERY_WARN_LEVEL
|
||||||
|
from devices.base import warning
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
from devices.base import base
|
from devices.base import base
|
||||||
|
from devices.base import warning
|
||||||
import logging
|
import logging
|
||||||
import task
|
import task
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
from devices.base import base
|
from devices.base import base
|
||||||
|
from devices.base import warning
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
from devices.base import base
|
from devices.base import base
|
||||||
from devices.base import BATTERY_WARN_LEVEL
|
from devices.base import BATTERY_WARN_LEVEL
|
||||||
|
from devices.base import warning
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user