updating configuration

This commit is contained in:
Your Name
2026-03-10 07:08:59 +00:00
commit 9498a076ee
238 changed files with 18119 additions and 0 deletions
@@ -0,0 +1,44 @@
import appdaemon.plugins.hass.hassapi as hass
import globals
import time
#
# Home and away report
# Send report about home state after presence_actions was done.
#
# Args:
# entity - group of entities to send state report
# notify - notify entity to send message
#
# Release Notes
#
# Version 1.0:
# Initial Version
class AliceIntents(hass.Hass):
entity_id = None
def initialize(self):
self.listen_event(self.yandex_intent, "yandex_intent")
def yandex_intent(self, event_id, event_args, kwargs):
self.log("{} {}".format(event_id, event_args))
text = event_args['text']
room = event_args['room']
alice = event_args['entity_id']
if text == 'Как дела':
self.entity_id = alice
self.run_in(self.run_in_say, 10, command="Кто здесь в {}?".format(room))
def run_in_say(self, kwargs):
if 'command' not in kwargs:
return
text = kwargs['command']
self.say(text)
def command(self, command):
self.call_service('yandex_station/send_command', command='sendText', text=command)
def say(self, command):
self.log('command = {}'.format(command))
self.call_service('media_player/play_media', entity_id=self.entity_id, media_content_type='text', media_content_id=command)
@@ -0,0 +1,8 @@
#################################
# HOME PRESENSE #
#################################
alice_intents:
module: alice_intents
class: AliceIntents
global_dependencies:
- globals
@@ -0,0 +1,49 @@
import appdaemon.plugins.hass.hassapi as hass
import globals
import time
#
# Home and away report
# Send report about home state after presence_actions was done.
#
# Args:
# entity - group of entities to send state report
# notify - notify entity to send message
#
# Release Notes
#
# Version 1.0:
# Initial Version
class PresenceAction(hass.Hass):
report_delay = 15
def initialize(self):
if 'alice' not in self.args:
self.error("Please provide alice in config!")
return
self.listen_event(self.away_mode, "away_mode")
self.listen_event(self.return_home_mode, "return_home_mode")
def away_mode(self, event_id, event_args, kwargs):
if 'constraint' in self.args and not self.constrain_input_boolean(self.args['constraint']):
return
self.command('стоп')
def return_home_mode(self, event_id, event_args, kwargs):
if 'constraint' in self.args and not self.constrain_input_boolean(self.args['constraint']):
return
command = 'Добро пожаловать домой.'
self.run_in(self.run_in_say, 59, command=command)
def run_in_say(self, kwargs):
if 'command' not in kwargs:
return
text = kwargs['command']
self.say(text)
def command(self, command):
self.call_service('yandex_station/send_command', command='sendText', text=command)
def say(self, command):
self.log('command = {}'.format(command))
self.call_service('media_player/play_media', entity_id=self.args['alice'], media_content_type='text', media_content_id=command)
@@ -0,0 +1,9 @@
#################################
# HOME PRESENSE #
#################################
presence_action:
module: presence_action
class: PresenceAction
alice: media_player.yandex_station_m00r46000m53db
global_dependencies:
- globals