How to use the appdaemon.appapi.AppDaemon function in appdaemon

To help you get started, we’ve selected a few appdaemon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github azogue / hass_appdaemon_apps / conf / apps / house_temperature.py View on Github external
from common import get_global, GLOBAL_DEFAULT_CHATID


# TODO evolution and trend -> notify
DEFAULT_DEAD_BAND = 0.5  # ºC
DEFAULT_DELTA_EVOLUTION = 5400  # 1.5h
DEFAULT_FREQ_SAMPLING_SEC = 300  # 300 (5min)

BINARY_SENSOR_NAME = 'binary_sensor.close_house'
SENSOR_NAME = 'sensor.house_delta_temperature'

LOGLEVEL = 'INFO'


# noinspection PyClassHasNoInit
class HouseTemps(appapi.AppDaemon):
    """App for publishing binary_sensors turned on as changed in X seconds."""
    _house_zones = None
    _exterior_sensors = None
    _exterior_estimated = None
    _deadband = None
    _open_house = None

    _sampling_freq = None
    _len_history = None
    _num_samples = None

    _temperatures_int = None
    _temperatures_ext = None
    _temperatures_estimated = None

    def initialize(self):
github home-assistant / appdaemon / appdaemon / plugins / dummy / dummyapi.py View on Github external
import appdaemon.appapi as appapi
import appdaemon.utils as utils


class Entities:

    def __get__(self, instance, owner):
        state = utils.StateAttrs(instance.ad.get_state(instance.namespace, None, None, None))
        return state


class Dummy(appapi.AppDaemon):

    entities = Entities()

    def __init__(self, ad, name, logger, error, args, config, app_config, global_vars,):

        super(Dummy, self).__init__(ad, name, logger, error, args, config, app_config, global_vars)

        self.namespace = "default"
        self.AD = ad
        self.name = name
        self._logger = logger
        self._error = error
        self.args = args
        self.config = config
        self.app_config = app_config
        self.global_vars = global_vars
github azogue / hass_appdaemon_apps / conf / apps / bot_event_listener.py View on Github external
' snapshot_cameras/{cam_filename} {img_url} {hass_pw}'
PIC_STATIC_URL = '{}/local/snapshot_cameras/{}'
MAIN_PLAYER = 'media_player.kodi'
BEDROOM_PLAYER = 'media_player.dormitorio_mopidy'

CLOUD_CONVERT_API_TOKEN = 'TXh-teNxR30jl1wgjfdMNH59yeaub8diSKiXUgqpNFa0Na2cRrFFaFDUlXqiaz9qN80ZgdCU2cm0N3d2o9QUwQ'


def _clean(telegram_text):
    """Remove markdown characters to prevent
    Telegram parser to fail ('_' & '*' chars)."""
    return telegram_text.replace('_', '\_').replace('*', '')


# noinspection PyClassHasNoInit
class EventListener(appapi.AppDaemon):
    """Event listener for ios actions and Telegram bot events."""

    _config = None
    _ha_key = None

    _lights_notif = None
    _lights_notif_state = None
    _lights_notif_st_attr = None
    _notifier = None

    _bot_notifier = 'telegram_bot'
    _bot_name = None
    _bot_wizstack = None
    _bot_chatids = None
    _bot_users = None
github azogue / hass_appdaemon_apps / conf / apps / motion_lights.py View on Github external
"""
Automation task as a AppDaemon App for Home Assistant

This little app controls some hue lights for turning them ON with motion detection,
only under some custom circunstances, like the media player is not running,
or there aren't any more lights in 'on' state in the room.

"""
import appdaemon.appapi as appapi


LOG_LEVEL = 'INFO'


# noinspection PyClassHasNoInit
class MotionLights(appapi.AppDaemon):
    """App for control lights with a motion sensor."""

    _pir = None
    _motion_light_timeout = None
    _lights_motion = None
    _lights_check_off = None
    _media_player = None
    _extra_constrain_input_boolean = None

    _handle_motion_on = None
    _handle_motion_off = None

    _motion_lights_running = False
    _extra_condition = True
    _media_player_active = False
    _lights_motion_active = None
github ReneTode / My-AppDaemon / apps / foscam_app_v2 / homeassistant0.55 / foscam.py View on Github external
#  args:                                                                                  #
#  see the readme on                                                                      #
#  https://github.com/ReneTode/My-AppDaemon/tree/master/apps/foscam_app_v2                #
#                                                                                         #
###########################################################################################

import appdaemon.appapi as appapi
import datetime
from urllib.request import urlopen
import urllib.request
from socket import timeout
import time
import xml.etree.ElementTree as ET
import requests

class foscam(appapi.AppDaemon):

  def initialize(self):

    runtime = datetime.datetime.now() + datetime.timedelta(seconds=5)
    self.loglevels = {
        "CRITICAL": 50,
        "ERROR": 40,
        "WARNING": 30,
        "INFO": 20,
        "DEBUG": 10,
        "NOTSET": 0
    }
    self.logsettings = self.args["logsettings"]
    if "loglevel" in self.logsettings:
      self.loglevel = self.logsettings["loglevel"]
    else: