Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
2ZZ committed Jun 2, 2023
1 parent d2464be commit 4db5cbf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-pc-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: pip install -r requirements.txt

- name: Run PyInstaller
run: pyinstaller --onefile --name alexa-ifttt-pc-notification.exe app.py
run: pyinstaller --onefile --name alexa-ifttt-pc-notification.exe app.pyw

- name: Upload artifacts
uses: actions/upload-artifact@v2
Expand Down
6 changes: 4 additions & 2 deletions pc-app/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
Place .exe in `%appdata%\Microsoft\Windows\Start Menu\Programs\Startup`

```
python -m venv .venv
pip-compile
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python app.py
pyinstaller --onefile --name alexa-ifttt-pc-notification.exe app.py
python app.pyw
pyinstaller --onefile --name alexa-ifttt-pc-notification.exe app.pyw
```
14 changes: 11 additions & 3 deletions pc-app/app.py → pc-app/app.pyw
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
import threading
import winsound
import paho.mqtt.client as mqtt
from win10toast import ToastNotifier
import winsound

MQTT_BROKER = os.environ.get('MQTT_BROKER', '192.168.1.61')
MQTT_PORT = int(os.environ.get('MQTT_PORT', '1883'))
Expand All @@ -21,8 +22,15 @@ def on_connect(client, userdata, flags, rc):


def on_message(client, userdata, msg):
print("Message received, showing toast.")
winsound.PlaySound(SOUND_EFFECT_PATH, winsound.SND_FILENAME)
print("Message received")

def play_sound():
print("Playing sound")
winsound.PlaySound(SOUND_EFFECT_PATH, winsound.SND_FILENAME)
sound_thread = threading.Thread(target=play_sound)
sound_thread.start()

print("Showing toast")
toaster.show_toast(
title=POPUP_TITLE,
msg=POPUP_MESSAGE,
Expand Down

0 comments on commit 4db5cbf

Please sign in to comment.