Skip to content

Commit

Permalink
Merged develop to create v1.8.0
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'origin/develop'

# Conflicts:
#	__init__.py
  • Loading branch information
msinn committed Jan 15, 2021
2 parents 9db8580 + 1738dad commit cd72128
Show file tree
Hide file tree
Showing 625 changed files with 70,900 additions and 25,739 deletions.
17 changes: 10 additions & 7 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,23 @@ LINKS="smarthome/plugins/plugins"

# Get the current repository which is processed
REPOSITORY="$(basename $TRAVIS_REPO_SLUG)"
REPO_OWNER="$(dirname $TRAVIS_REPO_SLUG)"
REPOSITORY_ORIGIN="$REPOSITORY_ORIGIN"

# Find out on which branch to work
if [ "$TRAVIS_BRANCH" = "master" ] ; then
REPOSITORY_BRANCH="master"
else
REPOSITORY_BRANCH="develop"
fi
#if [ "$TRAVIS_BRANCH" = "master" ] ; then
# REPOSITORY_BRANCH="master"
#else
# REPOSITORY_BRANCH="develop"
#fi

REPOSITORY_BRANCH=$TRAVIS_BRANCH
echo -e "Current branch for $REPOSITORY is $REPOSITORY_BRANCH"

#######################################################################
# 1. Checkout all repositories

echo -e "travis_fold:start:Checkout\nChecking out repositories with $REPOSITORY_BRANCH branch"
echo -e "travis_fold:start:Checkout\nChecking out additional repositories with $REPOSITORY_BRANCH branch"

# Change to root directory since script is started in checkout
cd $TRAVIS_BUILD_DIR/..
Expand All @@ -53,7 +56,7 @@ cd $TRAVIS_BUILD_DIR/..
for REPO in $REPOSITORIES ; do
if [ "$REPO" != "$REPOSITORY_ORIGIN" ] ; then
echo "Checking out $REPO ..."
git clone https://github.com/smarthomeNG/$REPO.git $REPO
git clone https://github.com/$REPO_OWNER/$REPO.git $REPO
cd $REPO
git checkout $REPOSITORY_BRANCH
cd ..
Expand Down
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
os: linux
language: python
cache: pip

jobs:
include:
- python: 3.5
dist: xenial
- python: 3.6
dist: bionic
- python: 3.7
dist: bionic
- python: 3.8
dist: focal
env:
- REPOSITORY_ORIGIN=plugins
YARN_GPG=no

before_install:
- sudo apt-get update
- sudo apt-get install libudev-dev
- sudo apt-get install librrd-dev libpython3-dev
- sudo apt-get install gcc --only-upgrade
install:
- pip install tox-travis virtualenv
- pip install tox-travis virtualenv>=20.0.8 --upgrade
- pip install sphinx sphinx_rtd_theme recommonmark

script:
- sh .travis.sh
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def plugin_release():
return '1.7.2'
return '1.8.0'


def plugin_branch():
Expand Down
16 changes: 7 additions & 9 deletions alexa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,19 @@ This plugin/s service *does not offer any ssl or authentication*! It is strongly

## Configuration

### plugin.conf
### plugin.yaml
basic configuration
```
[alexa]
class_name = Alexa
class_path = plugins.alexa
alexa:
plugin_name: alexa
```

you may change host/ip and port of the web-service
```
[alexa]
class_name = Alexa
class_path = plugins.alexa
service_host = "0.0.0.0"
service_port = 9000
alexa:
plugin_name: alexa
service_host: '0.0.0.0'
service_port: 9000
```

### items.conf
Expand Down
2 changes: 1 addition & 1 deletion alexa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from . import actions_lock

class Alexa(SmartPlugin):
PLUGIN_VERSION = "1.3.0.9.0"
PLUGIN_VERSION = "1.3.1"
ALLOW_MULTIINSTANCE = False

def __init__(self, sh, service_host='0.0.0.0', service_port=9000, service_https_certfile=None, service_https_keyfile=None):
Expand Down
2 changes: 1 addition & 1 deletion alexa/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugin:
# documentation: https://github.com/smarthomeNG/smarthome/wiki/CLI-Plugin # url of documentation (wiki) page
support: https://knx-user-forum.de/forum/supportforen/smarthome-py/1021150-amazon-alexa-plugin

version: 1.3.0.9.0 # Plugin version
version: 1.3.1 # Plugin version
sh_minversion: 1.3 # minimum shNG version to use this plugin
# sh_maxversion: # maximum shNG version to use this plugin (leave empty if latest)
multi_instance: False # plugin supports multi instance
Expand Down
23 changes: 18 additions & 5 deletions alexa4p3/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Alexa4PayloadV3
# alexa4p3

Alexa4PayloadV3

## Table of Content

1. [Generell](#generell)
2. [Change Log](#changelog)
3. [Requrirements](#requirements)
3. [Requrirements](#requirements)<br>
[Einrichtung Amazon-Skill / Lambda-Funktion](#Skill)<sup><span style="color:red"> **Neu**</sup></span>
4. [Icon / Display Categories](#Icons)<sup><span style="color:blue"> **Update**</sup></span>
5. [Entwicklung / Einbau von neuen Skills](#Entwicklung)
6. [Alexa-ThermostatController](#ThermostatController) + [Thermosensor](#Thermostatsensor)
Expand All @@ -23,6 +26,7 @@
19. [Web-Interface](#webinterface) <sup><span style="color:red"> **Neu**</sup></span>



## [Beispiel-Konfigurationen](#Beispiel) <sup><span style="color:red"> **Neu**</sup></span>


Expand Down Expand Up @@ -52,8 +56,7 @@ Das ursprünglich Plugin kann deaktiviertwerden :

<pre><code>
#alexa:
# class_name: Alexa
# class_path: plugins.alexa
# plugin_name: alexa4p3
# service_port: 9000
</code></pre>

Expand All @@ -73,6 +76,9 @@ Die Actions unterscheiden sich zwischen Payload V2 und V3 oft nur durch Gross/Kl

## Change Log <a name="changelog"/></a>

### 20.10.2020
- Doku von Schuma für die Einrichtung des Skills bei Amazon ergänzt - eingefügt bei Requirements

### 11.04.2020
- Version auf 1.0.2 für shNG Release 1.7 erhöht

Expand Down Expand Up @@ -138,6 +144,13 @@ Die Actions unterscheiden sich zwischen Payload V2 und V3 oft nur durch Gross/Kl

Das Plugin benötigt Modul Python-Requests. Dies sollte mit dem Core immer auf dem aktuellen Stand mitkommen.

<a name="Skill"/></a>
## Amazon Skill / Lambda

Es muss ein funktionierender Skill in der Amazon Developer Konsole / AWS Lambda erstellt werden.
Eine ausführliche Dokumentation unter ./assets/Alexa_V3_plugin.pdf zu finden.
Vielen Dank @schuma für die ausführliche Dokumentation

Ansonsten keine Requirements.

## Icons / Catagories<a name="Icons"/></a>
Expand Down Expand Up @@ -1259,4 +1272,4 @@ if myAlexa != None:
sh.OG.Wohnzimmer.Spots_Nord(triggerValue)
sh.OG.Wohnzimmer.Spots_Sued(triggerValue)
```
```
8 changes: 4 additions & 4 deletions alexa4p3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@




class protocoll(object):

log = []
Expand Down Expand Up @@ -85,17 +86,16 @@ def __init__(self, sh, *args, **kwargs):
self.service_https_keyfile = None
self.service_host='0.0.0.0'

self.devices = AlexaDevices()
self.actions = AlexaActions(self.sh, self.logger, self.devices)

self._proto = protocoll()

self.devices = AlexaDevices()
self.actions = AlexaActions(self.sh, self.logger, self.devices,self._proto)

self.service = AlexaService(self._proto,self.logger, self.PLUGIN_VERSION, self.devices, self.actions,
self.service_host, int(self.service_port), self.service_https_certfile, self.service_https_keyfile)
self.action_count_v2 = 0
self.action_count_v3 = 0


self.init_webinterface()

def run(self):
Expand Down
8 changes: 5 additions & 3 deletions alexa4p3/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ def store_metadata(func):


class AlexaActions(object):
def __init__(self, sh, logger, devices):
def __init__(self, sh, logger, devices, proto):
self.actions = {}
self.actions_by_directive = {}
for func in action_func_registry:
logger.debug("Alexa: initializing action {}".format(func.alexa_action_name))
action = AlexaAction(sh, logger, devices, func, func.alexa_action_name, func.alexa_directive_type, func.alexa_response_type,func.alexa_namespace, func.alexa_properties,func.alexa_payload_version)
action = AlexaAction(sh, logger, devices, func, func.alexa_action_name, func.alexa_directive_type, func.alexa_response_type,func.alexa_namespace, func.alexa_properties,func.alexa_payload_version,proto)
self.actions[action.name] = action
self.actions_by_directive[action.directive_type] = action

Expand All @@ -45,7 +45,7 @@ def for_directive(self, directive):


class AlexaAction(object):
def __init__(self, sh, logger, devices, func, action_name, directive_type, response_type, namespace,properties,payload_version):
def __init__(self, sh, logger, devices, func, action_name, directive_type, response_type, namespace,properties,payload_version,proto):
self.sh = sh
self.logger = logger
self.devices = devices
Expand All @@ -58,6 +58,8 @@ def __init__(self, sh, logger, devices, func, action_name, directive_type, respo
self.response_Value = None
self.properties = properties
self.payload_version = payload_version

self._proto = proto

def __call__(self, payload):
return self.func(self, payload)
Expand Down
Binary file added alexa4p3/assets/Alexa_V3_plugin.pdf
Binary file not shown.
48 changes: 48 additions & 0 deletions alexa4p3/locale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
plugin_translations:
# Translations for the plugin specially for the web interface
'allowed IP': {'de': 'erlaubte IP', 'en': '=', 'fr': ''}
'last Session': {'de': 'letzte Sitzung', 'en': '=', 'fr': ''}
'Stream-Modifiers': {'de': 'Stream-Modikatoren', 'en': '=', 'fr': ''}
'last Session duration': {'de': 'letzte Sitzungs- dauer', 'en': '=', 'fr': ''}
'Sessions total': {'de': 'Sitzungen gesamt', 'en': '=', 'fr': ''}
'Settings': {'de': 'Einstellungen', 'en': '=', 'fr': ''}
'Credentials:': {'de': 'Zugangsdaten:', 'en': '=', 'fr': ''}
'delete Protocol': {'de': 'Protokoll löschen:', 'en': '=', 'fr': ''}
'Real-URL': {'de': 'tatsächliche URL', 'en': '=', 'fr': ''}
'Commit Changes': {'de': 'Änderungen speichern', 'en': '=', 'fr': ''}
'Store to Config': {'de': 'in Konfiguration speichern', 'en': '=', 'fr': ''}
'Settings / Cam-Info': {'de': 'Einstellungen / Kamera-Infos', 'en': '=', 'fr': ''}
'Communication-Log': {'de': 'Kommunikations-Log', 'en': '=', 'fr': ''}
'active Camera Threads': {'de': 'aktive Kamera-Threads', 'en': '=', 'fr': ''}
'SSL Certificate Info': {'de': 'SSL Zertifikas Info', 'en': '=', 'fr': ''}
'Proxy-Credentials': {'de': 'Proxy-Zugangsdaten', 'en': '=', 'fr': ''}
'Proxy-Authorization': {'de': 'Proxy-Authorisierungs-Typ', 'en': '=', 'fr': ''}
'Video-Buffer-Size :': {'de': 'Video-Puffer-Grösse', 'en': '=', 'fr': ''}
'Authorization :': {'de': 'Authorisierungs-Typ', 'en': '=', 'fr': ''}
'Encode': {'de': 'enkodieren', 'en': '=', 'fr': ''}
'encoded Cred.:': {'de': 'enkodierte Zugangsdaten', 'en': '=', 'fr': ''}
'Result :': {'de': 'Ergebnis', 'en': '=', 'fr': ''}
'Value': {'de': 'Wert', 'en': '=', 'fr': ''}
'Property': {'de': 'Eigenschaft', 'en': '=', 'fr': ''}
'Threads existing ...': {'de': 'existierende Threads', 'en': '=', 'fr': ''}
'Auto Update ( 2 sec.)': {'de': 'Auto Update ( 2 Sek.)', 'en': '=', 'fr': ''}
'last/next Auto-Login' : {'de': 'letztes/nächstes Auto-Login', 'en': '=', 'fr': ''}
'selected Device' : {'de': 'gwähltes Gerät', 'en': '=', 'fr': ''}
'No. of Alexa-Devices': {'de': 'Anzahl Alexa-Geräte', 'en': '=', 'fr': ''}
'LogOff': {'de': 'Ausloggen', 'en': '=', 'fr': ''}
'LogIn': {'de': 'Einloggen', 'en': '=', 'fr': ''}
'Store Cookie': {'de': 'Cookie speichern', 'en': '=', 'fr': ''}
'Paste the Cookie-File here': {'de': 'Cookie File hier einfügen', 'en': '=', 'fr': ''}
'existing Commands': {'de': 'existierende Kommandos', 'en': '=', 'fr': ''}
'Command-Name': {'de': 'Kommando-Name', 'en': '=', 'fr': ''}


# '': {'de': 'Proxy-Authorisierungs-Typ', 'en': '=', 'fr': ''}








5 changes: 2 additions & 3 deletions alexa4p3/p3_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def SetRangeValue(self, directive):
oldValue=str(item())
item_range = self.item_range(item, DEFAULT_RANGE)
item_new = calc_percentage(new_percentage, item_range)
self.sh.Alexa4P3._proto.addEntry('INFO ','Changed item :{} from {} to {}'.format(item.property.name,oldValue,newValue))
self._proto.addEntry('INFO ','Changed item :{} from {} to {}'.format(item.property.name,oldValue,newValue))
self.logger.info("Alexa P3: SetRangeValue({}, {:.1f})".format(item.id(), item_new))
item( item_new, "alexa4p3" )
self.response_Value = None
Expand Down Expand Up @@ -273,14 +273,13 @@ def SetTargetTemperature(self, directive):
def TurnOn(self, directive):
device_id = directive['endpoint']['endpointId']
items = self.items(device_id)

for item in items:
on, off = self.item_range(item, DEFAULT_RANGE_LOGIC)
self.logger.info("Alexa: turnOn({}, {})".format(item.id(), on))
if on != None:
item( on, "alexa4p3" )
self.response_Value = 'ON'
self.sh.Alexa4P3._proto.addEntry('INFO ', 'Changed item :{} to {}'.format(item.property.name,self.response_Value))
self._proto.addEntry('INFO ', 'Changed item :{} to {}'.format(item.property.name,self.response_Value))
myValue = self.p3_respond(directive)
return myValue

Expand Down
25 changes: 15 additions & 10 deletions alexa4p3/user_doc.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.. index:: Plugins; Alexa4P3 (Unterstützung von Amazon Echo/Alexa Geräten)
.. index:: Alexa4P3


========
alexa4p3
========
Expand All @@ -14,6 +13,10 @@ Konfiguration

Die Informationen zur Konfiguration des Plugins sind unter :doc:`/plugins_doc/config/alexa4p3` beschrieben.

Es muss ein funktionierender Skill in der Amazon Developer Konsole / AWS Lambda erstellt werden.

Hier ist eine ausführliche Dokumentation als PDF :download:`Alexa_V3_plugin </plugins/alexa4p3/assets/Alexa_V3_plugin.pdf>`


.. important::

Expand All @@ -22,7 +25,7 @@ Die Informationen zur Konfiguration des Plugins sind unter :doc:`/plugins_doc/co


Webinterface
------------------------
------------

Das Alexa4P3-Plugin verfügt über ein Webinterface, mit dessen Hilfe die Items die das Plugin nutzt übersichtlich dargestellt werden.
Das Web-Interface enthält ein selbst rotierendes Protokoll für die Kommunikation mit dem Amazon-Servern.
Expand All @@ -34,27 +37,29 @@ Beispielfunktionen

Beleuchtung einschalten :

**Alexa, schalte das Küchenlicht ein**
**Alexa, dimme das Küchenlicht um 10 Prozent**
**Alexa, stelle das Küchenlicht auf 40 Prozent**
- **Alexa, schalte das Küchenlicht ein**
- **Alexa, dimme das Küchenlicht um 10 Prozent**
- **Alexa, stelle das Küchenlicht auf 40 Prozent**


Temperatur einstellen:

**Alexa, stelle die Temperatur in der Küche auf 25 Grad**
**Alexa, erhöhe die Temperatur in der Küche um 2 Grad**
- **Alexa, stelle die Temperatur in der Küche auf 25 Grad**
- **Alexa, erhöhe die Temperatur in der Küche um 2 Grad**

Temperatur abfragen :

**Alexa, wie ist die Temperatur in der Küche**
- **Alexa, wie ist die Temperatur in der Küche**


Farben an RGB und HSV-Leuchten einstellen:

**Alexa, stelle das Licht im Wohnzimmer auf rosa**
- **Alexa, stelle das Licht im Wohnzimmer auf rosa**


Kameras zeigen (nur Show / Spot / FireTV-Geräte)

**Alexa, zeige die Türkamera**
- **Alexa, zeige die Türkamera**



Expand Down
Loading

0 comments on commit cd72128

Please sign in to comment.