Remove warnings

This commit is contained in:
2023-10-16 00:30:15 +02:00
parent c217602b28
commit 0ed813515a

35
run.py
View File

@@ -1,7 +1,8 @@
"""Fake script simulating Domoticz"""
#pylint: disable=line-too-long
import os import os
import time import time
import Domoticz import Domoticz
import plugin
def function_read_properties(filename:str, sep:str='=', comment_char:str='#')->dict: def function_read_properties(filename:str, sep:str='=', comment_char:str='#')->dict:
"""Convert a .properties file into a dictionary""" """Convert a .properties file into a dictionary"""
@@ -18,32 +19,32 @@ def function_read_properties(filename:str, sep:str='=', comment_char:str='#')->d
return dictionary return dictionary
"""Read Parameter file? Format should be: # """Read Parameter file? Format should be:
Address=xxx # Address=xxx
Port=xxx # Port=xxx
Username=xxx # Username=xxx
Password=xxx # Password=xxx
Mode1=xxx # Mode1=xxx
Mode2=xxx # Mode2=xxx
Mode3=xxx # Mode3=xxx
Mode4=xxx # Mode4=xxx
Mode5=xxx # Mode5=xxx
Mode6=xxx # Mode6=xxx
""" # """
Parameters = function_read_properties(os.path.join(os.path.dirname(__file__), "parameters.properties")) Parameters = function_read_properties(os.path.join(os.path.dirname(__file__), "parameters.properties"))
Images = Domoticz.Images Images = Domoticz.Images
Devices = Domoticz.Devices Devices = Domoticz.Devices
with open("./plugin.py", 'rb') as fileobj: with open("./plugin.py", 'rb') as fileobj:
exec(compile(fileobj.read(), "plugin.py", 'exec'), globals(), globals()) exec(compile(fileobj.read(), "plugin.py", 'exec'), globals(), globals()) #pylint: disable=exec-used
onStart() onStart() #pylint: disable=undefined-variable # type: ignore
try: try:
while True: while True:
Domoticz.Log("## Plugin Heartbeat ##") Domoticz.Log("## Plugin Heartbeat ##")
onHeartbeat() onHeartbeat() #pylint: disable=undefined-variable # type: ignore
time.sleep(Domoticz.domo.GetHeartbeat()) time.sleep(Domoticz.domo.GetHeartbeat())
finally: finally:
onStop() onStop() #pylint: disable=undefined-variable # type: ignore