Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
msinn committed Mar 31, 2023
2 parents c4ec71e + 8f117bd commit 5c96886
Show file tree
Hide file tree
Showing 210 changed files with 10,962 additions and 14,952 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "Unittests Plugins"
name: "Unittests Plugins for PRs (disabled)"
#on: [workflow_dispatch, push]
on:
workflow_dispatch:
pull_request:
branches:
- 'develop'
- '!develop'

jobs:
build:
Expand Down
36 changes: 29 additions & 7 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:
branches:
- '*'
- '!release_doc'

pull_request:
branches:
- 'develop'
jobs:
build:
runs-on: ubuntu-20.04 #latest
Expand All @@ -24,17 +26,37 @@ jobs:
sudo apt-get install gcc --only-upgrade
- name: Get branch name
run: |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
echo ${GITHUB_REF#refs/heads/}
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
id: extract_branch

- name: Checkout core from ${{steps.extract_branch.outputs.branch}} branch
- name: Workflow Information
run: |
echo github.event_name '${{ github.event_name }}'
echo github.workflow '${{ github.workflow }}'
echo github.action_repository '${{ github.action_repository }}'
echo github.actor '${{ github.actor }}'
echo github.ref_name '${{ github.ref_name }}'
echo github.ref '${{ github.ref }}'
echo github.base_ref '${{ github.base_ref }}'
echo github.head_ref '${{ github.head_ref }}'
echo github.pull_request.base.ref '${{ github.pull_request.base.ref }}'
echo steps.extract_branch.outputs.branch '${{ steps.extract_branch.outputs.branch }}'
- name: Checkout core from branch '${{ steps.extract_branch.outputs.branch }}' (for push)
if: github.event_name != 'pull_request'
uses: actions/checkout@v3
with:
repository: smarthomeNG/smarthome
ref: ${{steps.extract_branch.outputs.branch}}
- name: Checkout plugins from ${{steps.extract_branch.outputs.branch}} branch
ref: ${{ steps.extract_branch.outputs.branch }}

- name: Checkout core from branch 'develop' (for pull request)
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
repository: smarthomeNG/smarthome
ref: develop

- name: Checkout plugins from branch '${{steps.extract_branch.outputs.branch}}'
uses: actions/checkout@v3
with:
repository: smarthomeNG/plugins
Expand Down
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.9.4'
return '1.9.5'

def plugin_branch():
return 'master'
Expand Down
92 changes: 81 additions & 11 deletions alexarc4shng/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AlexaRc4shNG

#### Version 1.0.2
#### Version 1.0.3

The plugin gives the possibilty to control an Alexa-Echo-Device remote by smartHomeNG. So its possible to switch on an TuneIn-Radio Channel, send some messages via Text2Speech when an event happens on the knx-bus or on the Visu. On the Web-Interface you can define your own commandlets (functions). The follwing functions are available on the Web-Interface :

Expand Down Expand Up @@ -38,7 +38,7 @@ Special thanks to Jonofe from the [Edomi-Forum](https://knx-user-forum.de/forum/
- Pause (pauses the actual media)
- Text2Speech (sends a Text to the echo, echo will speak it)
- StartTuneInStation (starts a TuneInRadiostation with the guideID you send)
- SSML (Speak to Text with[Speech Synthesis Markup Language](https://developer.amazon.com/docs/custom-skills/speech-synthesis-markup-language-ssml-reference.html))
- SSML (Speak to Text with [Speech Synthesis Markup Language](https://developer.amazon.com/docs/custom-skills/speech-synthesis-markup-language-ssml-reference.html))
- VolumeAdj (adjusts the volume during playing some media not working from webinterface test functions)
- VolumeSet (sets the volume to value from 0-100 percent)

Expand All @@ -47,7 +47,7 @@ Special thanks to Jonofe from the [Edomi-Forum](https://knx-user-forum.de/forum/
```yaml
<mValue> = Value to send as alpha
<nValue> = Value to send as numeric
#item.path/# = item-path of the value that should be inserted into text or ssml
"#item.path/#" = item-path of the value that should be inserted into text or ssml
<serialNumber> = SerialNo. of the device where the command should go to
<familiy> = device family
<deviceType> = deviceType
Expand All @@ -57,6 +57,14 @@ Special thanks to Jonofe from the [Edomi-Forum](https://knx-user-forum.de/forum/

## ChangeLog<a name="changelog"/>

#### 2021.02.10 Version 1.0.3

- added MFA for Auto-Login
- <strong>added new Parameter (mfa_secret) in the etc/plugin.yaml</strong>
- added Step by Step Setup in Web-IF for MFA
- added public function to get the ToDo-List
- added public function to get the Shopping-List

#### 2020.03.20 Version 1.0.2

- <strong>changed public function "send_cmd_by_curl" to "send_cmd"</strong>
Expand Down Expand Up @@ -160,7 +168,7 @@ Item2EnableAlexaRC->Item controlled by UZSU or something else which enables the
alexa_credentials-> user:pwd (base64 encoded)<br>
item_2_enable_alexa_rc -> Item to allow smarthomeNG to send Commands to Echo's<br>
login_update_cycle->seconds to wait for automatic Login in to refresh the cookie

mfa_secret-> The MFA-Secret you got from Amazon-Website (fill it out with the Web-Interface)


```yaml
Expand All @@ -171,6 +179,7 @@ AlexaRc4shNG:
item_2_enable_alexa_rc: Item_to_enable_Alexaremote
alexa_credentials: <USER>:<PWD>
login_update_cycle: 432000
mfa_secret: <YOUR MFA-Secret>
```
Expand Down Expand Up @@ -203,12 +212,15 @@ alexa_cmd_01: True:EchoDotKueche:StartTuneInStation:s96141
Value = <20.0 - send command when value of the item becomes less then 20.0
EchodotKueche = Devicename where the Command should be send to
Text2Speech = Name of the Commandlet
Value_to_Send = Die Temperatur in der Kueche ist niedriger als 20 Grad Die Temperatur ist jetzt #test.testzimmer.temperature.actual/# Grad #test.testzimmer.temperature.actual/# = item-path of the value that should be inserted
Value_to_Send = Die Temperatur in der Kueche ist niedriger als 20 Grad Die Temperatur ist jetzt #test.testzimmer.temperature.actual/# Grad
```

```yaml
#test.testzimmer.temperature.actual/# = item-path of the value that should be inserted
```
<strong>example:<br></strong>
`
alexa_cmd_01: <20.0:EchoDotKueche:Text2Speech:Die Temperatur in der Kueche ist niedriger als 20 Grad Die Temperatur ist jetzt \#test.testzimmer.temperature.actual/\# Grad
alexa_cmd_01: <20.0:EchoDotKueche:Text2Speech:Die Temperatur in der Kueche ist niedriger als 20 Grad Die Temperatur ist jetzt #test.testzimmer.temperature.actual/# Grad
`

You can find the paths of the items on the backend-WebInterface - section items.
Expand Down Expand Up @@ -266,12 +278,13 @@ Example for settings in an item.conf file :
alexa_cmd_01 = '"True:EchoDotKueche:StartTuneInStation:s96141"
alexa_cmd_02 ="True:EchoDotKueche:Text2Speech:Hallo das Licht im Buero ist eingeschalten"
alexa_cmd_03 = "False:EchoDotKueche:Text2Speech:Hallo das Licht im Buero ist aus"
alexa_cmd_04 = "False:EchoDotKueche:Pause: "
alexa_cmd_04 = "False:EchoDotKueche:Pause:"
visu_acl = rw
knx_dpt = 1
knx_listen = 1/1/105
knx_send = 1/1/105
enforce_updates = truey_attr: setting
enforce_updates = true

```

### logic.yaml
Expand All @@ -282,7 +295,7 @@ Right now no logics are implemented. But you can trigger the functions by your o

The plugin provides the following publich functions. You can use it for example in logics.

### send_cmd(dvName, cmdName, mValue)
### send_cmd(dvName:str, cmdName:str, mValue:str)

example how to use in logics:

Expand All @@ -293,7 +306,7 @@ sh.AlexaRc4shNG.send_cmd('Kueche','Text2Speech','Der Sensor der Hebenlage signal
```
Sends a command to the device. "dvName" is the name of the device, "cmdName" is the name of the CommandLet, mValue is the value you would send.
You can find all this informations on the Web-Interface.
You can also user the [placeholders](#placeholders)
You can also use the [placeholders](#placeholders)

- the result will be the HTTP-Status of the request as string (str)

Expand All @@ -305,11 +318,68 @@ This function returns the Device-Name of the last Echo Device which got a voice
myLastDevice = sh.AlexaRc4shNG.get_last_alexa()

```

### get_list(type:str)

This function returns the ToDo or the Shopping list - depending on "type" as dict<br>

valid types are :
```yaml
'SHOPPING_LIST'
'TO_DO'
```


```yaml
sh.AlexaRc4shNG.get_list(type:str)
```
## Example logic to fill Items with List-Infos

<pre>
<code>
from datetime import datetime
# get the Todo-List
myList=sh.AlexaRc4shNG.get_list('TO_DO')
for entry in myList:
if entry['completed'] == True:
entry['icon'] = 'control_clear'
else:
entry['icon'] = 'control_home'
entry['date'] = datetime.fromtimestamp((entry['updatedDateTime']/1000)).strftime("%d.%m.%Y, %H:%M:%S")
# Write list to Item - type should be list
sh.Alexa_Lists.list.todo(myList)
# get the shopping-List
myList=sh.AlexaRc4shNG.get_list('SHOPPING_LIST')
for entry in myList:
if entry['completed'] == True:
entry['icon'] = 'control_clear'
else:
entry['icon'] = 'jquery_shop'
entry['date'] = datetime.fromtimestamp((entry['updatedDateTime']/1000)).strftime("%d.%m.%Y, %H:%M:%S")
# Write list to Item - type should be list
sh.Alexa_Lists.list.shopping(myList)
</code>
</pre>

## Example to show lists in smartVisu with status.activelist
<pre>
<code>
status.activelist('','Alexa_Lists.list.todo','value','date','value','info')

status.activelist('','Alexa_Lists.list.shopping','value','date','value','info')
</code>
</pre>

### Ergebnis :
![PlaceHolder](./assets/Alexa_lists.jpg "jpg")



# Web-Interface <a name="webinterface"/></a>

The Webinterface is reachable on you smarthomeNG server here :<br>

<strong>yourserver:8383/alexarc4shng/</strong>
<strong>http://yourserver:8383/plugins/alexarc4shng/</strong>

## Cookie-Handling

Expand Down
Loading

0 comments on commit 5c96886

Please sign in to comment.