water action fixes
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import appdaemon.plugins.hass.hassapi as hass
|
||||
from notification import send_notification
|
||||
import datetime
|
||||
import sys, locale
|
||||
import logging
|
||||
#import unicode
|
||||
# from automation import Automation # type: ignore
|
||||
|
||||
"""
|
||||
Monitor events and output changes to the verbose_log. Nice for debugging purposes.
|
||||
Arguments:
|
||||
- events: List of events to monitor
|
||||
"""
|
||||
class Test(hass.Hass):
|
||||
def initialize(self) -> None:
|
||||
root_logger= logging.getLogger()
|
||||
root_logger.setLevel(logging.DEBUG) # or whatever
|
||||
handler = logging.FileHandler('test.log', 'w', 'utf-8') # or whatever
|
||||
formatter = logging.Formatter('%(name)s %(message)s') # or whatever
|
||||
handler.setFormatter(formatter) # Pass handler as a parameter, not assign
|
||||
root_logger.addHandler(handler)
|
||||
UTF8Writer = codecs.getwriter('utf8')
|
||||
sys.stdout = UTF8Writer(sys.stdout.buffer)
|
||||
self.log(u"Привет")
|
||||
self.log(str(u'ô'))
|
||||
# id = send_notification(
|
||||
# self, targets="telegram_monster", message="Repeated message", title="title", when=datetime.datetime.now(), interval=10, iterations=2
|
||||
# )
|
||||
# self.log("id:{}".format(id))
|
||||
# id = send_notification(
|
||||
# self, targets="telegram_monster", message="Dummy", title="title"
|
||||
# )
|
||||
|
||||
def terminate(self):
|
||||
self.log('terminate')
|
||||
# for listen_event_handle in self.listen_event_handle_list:
|
||||
# self.cancel_listen_event(listen_event_handle)
|
||||
|
||||
Reference in New Issue
Block a user