1
0
mirror of https://github.com/MarkParker5/STARK.git synced 2025-07-02 22:36:54 +02:00
Files
STARK/Features/SmartHome/alarmclock.py

26 lines
920 B
Python
Raw Normal View History

2021-02-27 14:21:28 +02:00
from .SmartHome import *
from ..Command import Response, Command
2021-02-27 15:04:33 +02:00
import Text2Speech
2021-02-27 14:31:09 +02:00
import os
2021-02-27 14:21:28 +02:00
################################################################################
def method(params):
2021-02-27 14:34:23 +02:00
text = voice = ''
2021-02-27 14:27:09 +02:00
Command.getCommand('tv on').start({})
Command.getCommand('window_open').start({})
shedule = Command.getCommand('Todays Shedule').start({}).voice
time = Command.getCommand('Current Time').start({}).voice
2021-03-01 23:39:24 +02:00
voice = f'Доброе утро! {time}.\n'
2021-02-27 14:21:28 +02:00
if shedule:
2021-03-01 23:39:24 +02:00
voice = voice + 'Сегодня у вас: \n' + shedule
2021-02-27 14:21:28 +02:00
while True:
2021-02-27 14:33:13 +02:00
if os.popen('echo \'pow 0.0.0.0\' | cec-client -s -d 1 |grep power').read() == 'power status: on\n':
2021-02-27 14:21:28 +02:00
break
2021-02-27 15:04:33 +02:00
Text2Speech.Engine().generate(voice).speak()
2021-02-27 14:21:28 +02:00
return Response(text = text, voice = voice)
keywords = {}
patterns = []
alarmclock = SmartHome('alarmclock', keywords, patterns)
alarmclock.setStart(method)