2021-11-01 13:51:35 +02:00
|
|
|
from .SmartHome import SmartHome
|
2021-10-24 22:26:09 +03:00
|
|
|
from ArchieCore import Response, Command
|
2021-02-27 15:04:33 +02:00
|
|
|
import Text2Speech
|
2021-02-27 14:31:09 +02:00
|
|
|
import os
|
2021-11-01 13:51:35 +02:00
|
|
|
|
2021-02-27 14:21:28 +02:00
|
|
|
################################################################################
|
|
|
|
|
2021-11-01 13:51:35 +02:00
|
|
|
@Command.new(primary = False)
|
|
|
|
def alarmclock(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)
|