diff --git a/.vscode/launch.json b/.vscode/launch.json
index 070367e..a93993a 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -4,6 +4,14 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
+ {
+ "name": "Python: Current File",
+ "type": "python",
+ "request": "launch",
+ "program": "${file}",
+ "console": "integratedTerminal",
+ "justMyCode": true
+ },
{
"type": "monkeyc",
"request": "launch",
diff --git a/iconResize.py b/iconResize.py
new file mode 100644
index 0000000..ca4d82f
--- /dev/null
+++ b/iconResize.py
@@ -0,0 +1,91 @@
+####################################################################################
+#
+# Distributed under MIT Licence
+# See https://github.com/house-of-abbey/GarminHomeAssistant/blob/main/LICENSE.
+#
+####################################################################################
+#
+# GarminHomeAssistant is a Garmin IQ application written in Monkey C and routinely
+# tested on a Venu 2 device. The source code is provided at:
+# https://github.com/house-of-abbey/GarminHomeAssistant.
+#
+# J D Abbey & P A Abbey, 28 December 2022
+#
+#
+# Description:
+#
+# Python script to automatically resize the application icons from the original
+# 48x48 pixel width to something more appropriate for different screen sizes.
+#
+# Python installation:
+# pip install BeautifulSoup
+# NB. For XML formatting:
+# pip install lxml
+#
+# References:
+# * https://www.crummy.com/software/BeautifulSoup/bs4/doc/
+# * https://realpython.com/beautiful-soup-web-scraper-python/
+# * https://www.crummy.com/software/BeautifulSoup/bs4/doc/#parsing-xml
+# * https://www.crummy.com/software/BeautifulSoup/bs4/doc/#xml
+#
+####################################################################################
+
+from bs4 import BeautifulSoup, Comment
+import os
+import shutil
+
+output_dir_prefix = 'resources-icons-'
+input_dir = output_dir_prefix + '48'
+
+Doub = 0
+Sing = 1
+Half = 2
+
+# Original icons for 416x416 screen size with 48x48 icons
+original = (96, 48, 24)
+
+# Convert icons to different screen sizes by these parameters
+lookup = {
+ # Doub Sing Half
+ # 0 1 2
+# 416: (96, 48, 24),
+ 390: (90, 46, 23),
+ 360: (84, 42, 21),
+ 320: (74, 38, 19),
+ 280: (64, 32, 16),
+ 260: (60, 30, 15),
+ 240: (56, 28, 14),
+ 218: (50, 26, 13),
+}
+
+# Delete all but the original 48x48 icon directories
+for entry in os.listdir("."):
+ if entry.startswith(output_dir_prefix) and entry != input_dir:
+ shutil.rmtree(entry)
+
+# (Re-)Create the resized icon directories
+for screen_size, icon_sizes in lookup.items():
+ output_dir = output_dir_prefix + str(icon_sizes[Sing])
+ print("\nCreate directory:", output_dir)
+ os.makedirs(output_dir)
+ for entry in os.listdir(input_dir):
+ if entry.endswith(".svg"):
+ print("Create file: ", entry.ljust(40) + " SVG - Change file")
+ with open(input_dir + "/" + entry, "r") as f:
+ soup = BeautifulSoup(f.read(), features="xml")
+ svg: BeautifulSoup = list(soup.children)[0]
+ h = int(svg.attrs["height"])
+ if (h == original[Doub]):
+ svg.attrs["width"] = lookup[screen_size][Doub]
+ svg.attrs["height"] = lookup[screen_size][Doub]
+ elif (h == original[Sing]):
+ svg.attrs["width"] = lookup[screen_size][Sing]
+ svg.attrs["height"] = lookup[screen_size][Sing]
+ elif (h == original[Half]):
+ svg.attrs["width"] = lookup[screen_size][Half]
+ svg.attrs["height"] = lookup[screen_size][Half]
+ with open(output_dir + "/" + entry, "wb") as o:
+ o.write(svg.encode("utf-8"))
+ elif entry.endswith(".xml"):
+ print("Create file: ", entry.ljust(40) + " XML - Copy file")
+ shutil.copyfile(input_dir + "/" + entry, output_dir + "/" + entry)
diff --git a/manifest.xml b/manifest.xml
index eb86c81..4bfbed6 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -27,7 +27,46 @@
"Monkey C: Edit Products" - Lets you add or remove any product
-->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ara
+ bul
+ zhs
+ zht
+ hrv
+ ces
+ dan
+ dut
+ deu
+ gre
eng
+ est
+ fin
+ fre
+ heb
+ hun
+ ind
+ ita
+ jpn
+ kor
+ lav
+ lit
+ zsm
+ nob
+ pol
+ por
+ slo
+ ron
+
+ slv
+ spa
+ swe
+ tha
+ tur
+ ukr
+ vie
+
+
+
+
+ HomeAssistant
+
+
+
+
+ لا يوجد اتصال بالإنترنت
+
+
\ No newline at end of file
diff --git a/resources-bul/strings/strings.xml b/resources-bul/strings/strings.xml
new file mode 100644
index 0000000..e019e5f
--- /dev/null
+++ b/resources-bul/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Няма интернет връзка
+
+
\ No newline at end of file
diff --git a/resources-ces/strings/strings.xml b/resources-ces/strings/strings.xml
new file mode 100644
index 0000000..e98a5d1
--- /dev/null
+++ b/resources-ces/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Žádné internetové připojení
+
+
\ No newline at end of file
diff --git a/resources-dan/strings/strings.xml b/resources-dan/strings/strings.xml
new file mode 100644
index 0000000..5e8f9c0
--- /dev/null
+++ b/resources-dan/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Ingen internetforbindelse
+
+
\ No newline at end of file
diff --git a/resources-deu/strings/strings.xml b/resources-deu/strings/strings.xml
new file mode 100644
index 0000000..2d4df9c
--- /dev/null
+++ b/resources-deu/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Keine Internetverbindung
+
+
\ No newline at end of file
diff --git a/resources-dut/strings/strings.xml b/resources-dut/strings/strings.xml
new file mode 100644
index 0000000..1474a83
--- /dev/null
+++ b/resources-dut/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Geen internet verbinding
+
+
\ No newline at end of file
diff --git a/resources-est/strings/strings.xml b/resources-est/strings/strings.xml
new file mode 100644
index 0000000..2d11174
--- /dev/null
+++ b/resources-est/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Interneti-ühendus puudub
+
+
\ No newline at end of file
diff --git a/resources-fin/strings/strings.xml b/resources-fin/strings/strings.xml
new file mode 100644
index 0000000..720acbe
--- /dev/null
+++ b/resources-fin/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Ei Internet-yhteyttä
+
+
\ No newline at end of file
diff --git a/resources-fre/strings/strings.xml b/resources-fre/strings/strings.xml
new file mode 100644
index 0000000..e6e906a
--- /dev/null
+++ b/resources-fre/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Pas de connexion Internet
+
+
\ No newline at end of file
diff --git a/resources-gre/strings/strings.xml b/resources-gre/strings/strings.xml
new file mode 100644
index 0000000..4463bc1
--- /dev/null
+++ b/resources-gre/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Δεν υπάρχει σύνδεση στο διαδίκτυο
+
+
\ No newline at end of file
diff --git a/resources-heb/strings/strings.xml b/resources-heb/strings/strings.xml
new file mode 100644
index 0000000..a2ac598
--- /dev/null
+++ b/resources-heb/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ אין חיבור אינטרנט
+
+
\ No newline at end of file
diff --git a/resources-hrv/strings/strings.xml b/resources-hrv/strings/strings.xml
new file mode 100644
index 0000000..d922ee2
--- /dev/null
+++ b/resources-hrv/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Nema internetske veze
+
+
\ No newline at end of file
diff --git a/resources-hun/strings/strings.xml b/resources-hun/strings/strings.xml
new file mode 100644
index 0000000..6f6419f
--- /dev/null
+++ b/resources-hun/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Nincs internetkapcsolat
+
+
\ No newline at end of file
diff --git a/resources-icons-26/drawables.xml b/resources-icons-26/drawables.xml
new file mode 100644
index 0000000..320d05b
--- /dev/null
+++ b/resources-icons-26/drawables.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/resources-icons-26/error.svg b/resources-icons-26/error.svg
new file mode 100644
index 0000000..26e38d6
--- /dev/null
+++ b/resources-icons-26/error.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources-icons-28/drawables.xml b/resources-icons-28/drawables.xml
new file mode 100644
index 0000000..320d05b
--- /dev/null
+++ b/resources-icons-28/drawables.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/resources-icons-28/error.svg b/resources-icons-28/error.svg
new file mode 100644
index 0000000..a66bb50
--- /dev/null
+++ b/resources-icons-28/error.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources-icons-30/drawables.xml b/resources-icons-30/drawables.xml
new file mode 100644
index 0000000..320d05b
--- /dev/null
+++ b/resources-icons-30/drawables.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/resources-icons-30/error.svg b/resources-icons-30/error.svg
new file mode 100644
index 0000000..80de13d
--- /dev/null
+++ b/resources-icons-30/error.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources-icons-32/drawables.xml b/resources-icons-32/drawables.xml
new file mode 100644
index 0000000..320d05b
--- /dev/null
+++ b/resources-icons-32/drawables.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/resources-icons-32/error.svg b/resources-icons-32/error.svg
new file mode 100644
index 0000000..3e1eff5
--- /dev/null
+++ b/resources-icons-32/error.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources-icons-38/drawables.xml b/resources-icons-38/drawables.xml
new file mode 100644
index 0000000..320d05b
--- /dev/null
+++ b/resources-icons-38/drawables.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/resources-icons-38/error.svg b/resources-icons-38/error.svg
new file mode 100644
index 0000000..b7e88e9
--- /dev/null
+++ b/resources-icons-38/error.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources-icons-42/drawables.xml b/resources-icons-42/drawables.xml
new file mode 100644
index 0000000..320d05b
--- /dev/null
+++ b/resources-icons-42/drawables.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/resources-icons-42/error.svg b/resources-icons-42/error.svg
new file mode 100644
index 0000000..4fe488b
--- /dev/null
+++ b/resources-icons-42/error.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources-icons-46/drawables.xml b/resources-icons-46/drawables.xml
new file mode 100644
index 0000000..320d05b
--- /dev/null
+++ b/resources-icons-46/drawables.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/resources-icons-46/error.svg b/resources-icons-46/error.svg
new file mode 100644
index 0000000..7e52e6d
--- /dev/null
+++ b/resources-icons-46/error.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources-icons-48/drawables.xml b/resources-icons-48/drawables.xml
new file mode 100644
index 0000000..320d05b
--- /dev/null
+++ b/resources-icons-48/drawables.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/resources-icons-48/error.svg b/resources-icons-48/error.svg
new file mode 100644
index 0000000..c864600
--- /dev/null
+++ b/resources-icons-48/error.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources-ind/strings/strings.xml b/resources-ind/strings/strings.xml
new file mode 100644
index 0000000..03b8937
--- /dev/null
+++ b/resources-ind/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Tidak ada koneksi internet
+
+
\ No newline at end of file
diff --git a/resources-ita/strings/strings.xml b/resources-ita/strings/strings.xml
new file mode 100644
index 0000000..43bbc2a
--- /dev/null
+++ b/resources-ita/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Nessuna connessione internet
+
+
\ No newline at end of file
diff --git a/resources-jpn/strings/strings.xml b/resources-jpn/strings/strings.xml
new file mode 100644
index 0000000..0b1318d
--- /dev/null
+++ b/resources-jpn/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ インターネット接続なし
+
+
\ No newline at end of file
diff --git a/resources-kor/strings/strings.xml b/resources-kor/strings/strings.xml
new file mode 100644
index 0000000..cfcfbe3
--- /dev/null
+++ b/resources-kor/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ 인터넷에 연결되지 않음
+
+
\ No newline at end of file
diff --git a/resources/drawables/drawables.xml b/resources-launcher-30-30/drawables.xml
similarity index 86%
rename from resources/drawables/drawables.xml
rename to resources-launcher-30-30/drawables.xml
index 7cd1cca..d8b5369 100644
--- a/resources/drawables/drawables.xml
+++ b/resources-launcher-30-30/drawables.xml
@@ -13,5 +13,5 @@
-->
-
+
diff --git a/resources-launcher-30-30/launcher.png b/resources-launcher-30-30/launcher.png
new file mode 100644
index 0000000..6ee0210
Binary files /dev/null and b/resources-launcher-30-30/launcher.png differ
diff --git a/resources-launcher-35-35/drawables.xml b/resources-launcher-35-35/drawables.xml
new file mode 100644
index 0000000..d8b5369
--- /dev/null
+++ b/resources-launcher-35-35/drawables.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
diff --git a/resources-launcher-35-35/launcher.png b/resources-launcher-35-35/launcher.png
new file mode 100644
index 0000000..1d51ea4
Binary files /dev/null and b/resources-launcher-35-35/launcher.png differ
diff --git a/resources-launcher-36-36/drawables.xml b/resources-launcher-36-36/drawables.xml
new file mode 100644
index 0000000..d8b5369
--- /dev/null
+++ b/resources-launcher-36-36/drawables.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
diff --git a/resources-launcher-36-36/launcher.png b/resources-launcher-36-36/launcher.png
new file mode 100644
index 0000000..f1fbe43
Binary files /dev/null and b/resources-launcher-36-36/launcher.png differ
diff --git a/resources-launcher-40-40/drawables.xml b/resources-launcher-40-40/drawables.xml
new file mode 100644
index 0000000..d8b5369
--- /dev/null
+++ b/resources-launcher-40-40/drawables.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
diff --git a/resources-launcher-40-40/launcher.png b/resources-launcher-40-40/launcher.png
new file mode 100644
index 0000000..2bfe588
Binary files /dev/null and b/resources-launcher-40-40/launcher.png differ
diff --git a/resources-launcher-60-60/drawables.xml b/resources-launcher-60-60/drawables.xml
new file mode 100644
index 0000000..d8b5369
--- /dev/null
+++ b/resources-launcher-60-60/drawables.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
diff --git a/resources-launcher-60-60/launcher.png b/resources-launcher-60-60/launcher.png
new file mode 100644
index 0000000..3a2d836
Binary files /dev/null and b/resources-launcher-60-60/launcher.png differ
diff --git a/resources-launcher-61-61/drawables.xml b/resources-launcher-61-61/drawables.xml
new file mode 100644
index 0000000..d8b5369
--- /dev/null
+++ b/resources-launcher-61-61/drawables.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
diff --git a/resources-launcher-61-61/launcher.png b/resources-launcher-61-61/launcher.png
new file mode 100644
index 0000000..4b0ac64
Binary files /dev/null and b/resources-launcher-61-61/launcher.png differ
diff --git a/resources-launcher-70-70/drawables.xml b/resources-launcher-70-70/drawables.xml
new file mode 100644
index 0000000..d8b5369
--- /dev/null
+++ b/resources-launcher-70-70/drawables.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
diff --git a/resources-launcher-70-70/launcher.png b/resources-launcher-70-70/launcher.png
new file mode 100644
index 0000000..ec89b58
Binary files /dev/null and b/resources-launcher-70-70/launcher.png differ
diff --git a/resources-lav/strings/strings.xml b/resources-lav/strings/strings.xml
new file mode 100644
index 0000000..75b66ca
--- /dev/null
+++ b/resources-lav/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Nav interneta savienojuma
+
+
\ No newline at end of file
diff --git a/resources-lit/strings/strings.xml b/resources-lit/strings/strings.xml
new file mode 100644
index 0000000..88d1bb1
--- /dev/null
+++ b/resources-lit/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Nėra interneto ryšio
+
+
\ No newline at end of file
diff --git a/resources-nob/strings/strings.xml b/resources-nob/strings/strings.xml
new file mode 100644
index 0000000..cb80be2
--- /dev/null
+++ b/resources-nob/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Ingen Internett-tilkobling
+
+
\ No newline at end of file
diff --git a/resources-pol/strings/strings.xml b/resources-pol/strings/strings.xml
new file mode 100644
index 0000000..236d5d5
--- /dev/null
+++ b/resources-pol/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Brak połączenia z internetem
+
+
\ No newline at end of file
diff --git a/resources-por/strings/strings.xml b/resources-por/strings/strings.xml
new file mode 100644
index 0000000..3f93633
--- /dev/null
+++ b/resources-por/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Sem conexão com a Internet
+
+
\ No newline at end of file
diff --git a/resources-ron/strings/strings.xml b/resources-ron/strings/strings.xml
new file mode 100644
index 0000000..2920cf6
--- /dev/null
+++ b/resources-ron/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Fără conexiune internet
+
+
\ No newline at end of file
diff --git a/resources-slo/strings/strings.xml b/resources-slo/strings/strings.xml
new file mode 100644
index 0000000..ebe1983
--- /dev/null
+++ b/resources-slo/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Žiadne internetové pripojenie
+
+
\ No newline at end of file
diff --git a/resources-slv/strings/strings.xml b/resources-slv/strings/strings.xml
new file mode 100644
index 0000000..258cfd2
--- /dev/null
+++ b/resources-slv/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Ni internetne povezave
+
+
\ No newline at end of file
diff --git a/resources-spa/strings/strings.xml b/resources-spa/strings/strings.xml
new file mode 100644
index 0000000..fb8ef21
--- /dev/null
+++ b/resources-spa/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Sin conexión a Internet
+
+
\ No newline at end of file
diff --git a/resources-swe/strings/strings.xml b/resources-swe/strings/strings.xml
new file mode 100644
index 0000000..bf32799
--- /dev/null
+++ b/resources-swe/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Ingen internetanslutning
+
+
\ No newline at end of file
diff --git a/resources-tha/strings/strings.xml b/resources-tha/strings/strings.xml
new file mode 100644
index 0000000..aa06e0f
--- /dev/null
+++ b/resources-tha/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ ไม่มีการเชื่อมต่ออินเทอร์เน็ต
+
+
\ No newline at end of file
diff --git a/resources-tur/strings/strings.xml b/resources-tur/strings/strings.xml
new file mode 100644
index 0000000..d8574bf
--- /dev/null
+++ b/resources-tur/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ İnternet bağlantısı yok
+
+
\ No newline at end of file
diff --git a/resources-ukr/strings/strings.xml b/resources-ukr/strings/strings.xml
new file mode 100644
index 0000000..aa0ecd7
--- /dev/null
+++ b/resources-ukr/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Немає підключення до Інтернету
+
+
\ No newline at end of file
diff --git a/resources-vie/strings/strings.xml b/resources-vie/strings/strings.xml
new file mode 100644
index 0000000..0386be7
--- /dev/null
+++ b/resources-vie/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Không có kết nối Internet
+
+
\ No newline at end of file
diff --git a/resources-zhs/strings/strings.xml b/resources-zhs/strings/strings.xml
new file mode 100644
index 0000000..42f14d9
--- /dev/null
+++ b/resources-zhs/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ 没有网络连接
+
+
\ No newline at end of file
diff --git a/resources-zht/strings/strings.xml b/resources-zht/strings/strings.xml
new file mode 100644
index 0000000..308aaf4
--- /dev/null
+++ b/resources-zht/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ 沒有網路連線
+
+
\ No newline at end of file
diff --git a/resources-zsm/strings/strings.xml b/resources-zsm/strings/strings.xml
new file mode 100644
index 0000000..96a62b4
--- /dev/null
+++ b/resources-zsm/strings/strings.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ HomeAssistant
+
+
+
+
+ Tiada sambungan internet
+
+
\ No newline at end of file
diff --git a/resources/drawables/launcher.png b/resources/drawables/launcher.png
new file mode 100644
index 0000000..2d74c0f
Binary files /dev/null and b/resources/drawables/launcher.png differ
diff --git a/resources/drawables/launcher_icon.png b/resources/drawables/launcher_icon.png
deleted file mode 100644
index 8e302cc..0000000
Binary files a/resources/drawables/launcher_icon.png and /dev/null differ
diff --git a/resources/strings/strings.xml b/resources/strings/strings.xml
index ba10b15..5296ac1 100644
--- a/resources/strings/strings.xml
+++ b/resources/strings/strings.xml
@@ -14,4 +14,10 @@
HomeAssistant
+
+
+
+
+ No Internet connection
+
diff --git a/source/ErrorView.mc b/source/ErrorView.mc
new file mode 100644
index 0000000..7432076
--- /dev/null
+++ b/source/ErrorView.mc
@@ -0,0 +1,88 @@
+//-----------------------------------------------------------------------------------
+//
+// Distributed under MIT Licence
+// See https://github.com/house-of-abbey/GarminHomeAssistant/blob/main/LICENSE.
+//
+//-----------------------------------------------------------------------------------
+//
+// GarminHomeAssistant is a Garmin IQ application written in Monkey C and routinely
+// tested on a Venu 2 device. The source code is provided at:
+// https://github.com/house-of-abbey/GarminHomeAssistant.
+//
+// J D Abbey & P A Abbey, 28 December 2022
+//
+//
+// Description:
+//
+// ErrorView provides a means to present application errors to the user. These
+// should not happen of course... but they do, so best make sure errors can be
+// reported.
+//
+//-----------------------------------------------------------------------------------
+
+using Toybox.Graphics;
+using Toybox.Lang;
+using Toybox.WatchUi;
+using Toybox.Communications;
+
+class ErrorView extends ScalableView {
+ hidden const settings as Lang.Dictionary = {
+ :errorIconMargin => 7f
+ };
+ // Vertical spacing between the top of the face and the error icon
+ hidden var errorIconMargin;
+ hidden var text as Lang.String;
+ hidden var errorIcon;
+ hidden var textArea;
+
+ function initialize(text as Lang.String) {
+ ScalableView.initialize();
+ self.text = text;
+ // Convert the settings from % of screen size to pixels
+ errorIconMargin = pixelsForScreen(settings.get(:errorIconMargin) as Lang.Float);
+ }
+
+ // Load your resources here
+ function onLayout(dc as Graphics.Dc) as Void {
+ errorIcon = Application.loadResource(Rez.Drawables.ErrorIcon) as Graphics.BitmapResource;
+
+ var w = dc.getWidth();
+ var h = dc.getHeight();
+
+ textArea = new WatchUi.TextArea({
+ :text => text,
+ :color => Graphics.COLOR_WHITE,
+ :font => Graphics.FONT_XTINY,
+ :justification => Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER,
+ :locX => 0,
+ :locY => 83,
+ :width => w,
+ :height => h - 166
+ });
+ }
+
+ // Update the view
+ function onUpdate(dc as Graphics.Dc) as Void {
+ var w = dc.getWidth();
+ var hw = w/2;
+ var bg = 0x3B444C;
+ if(dc has :setAntiAlias) {
+ dc.setAntiAlias(true);
+ }
+ dc.setColor(Graphics.COLOR_WHITE, bg);
+ dc.clear();
+ dc.drawBitmap(hw - errorIcon.getWidth()/2, errorIconMargin, errorIcon);
+ textArea.draw(dc);
+ }
+
+}
+
+class ErrorDelegate extends WatchUi.BehaviorDelegate {
+ function initialize() {
+ WatchUi.BehaviorDelegate.initialize();
+ }
+ function onBack() {
+ WatchUi.popView(WatchUi.SLIDE_DOWN);
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/source/Globals.mc b/source/Globals.mc
index 5e8e393..10c699a 100644
--- a/source/Globals.mc
+++ b/source/Globals.mc
@@ -25,5 +25,6 @@ class Globals {
// as the messages can't be read from a watch!)
static const debug = false;
static const updateInterval = 5; // seconds
- static const alertTimeout = 1000; // ms
+ static const alertTimeout = 2000; // ms
+ static const tapTimeout = 1000; // ms
}
diff --git a/source/HomeAssistantApp.mc b/source/HomeAssistantApp.mc
index 8a23631..d93ce2a 100644
--- a/source/HomeAssistantApp.mc
+++ b/source/HomeAssistantApp.mc
@@ -26,11 +26,15 @@ using Toybox.Timer;
class HomeAssistantApp extends Application.AppBase {
hidden var haMenu;
+ hidden var strNoInternet as Lang.String;
+ hidden var strNoMenu as Lang.String;
hidden var timer as Timer.Timer;
function initialize() {
AppBase.initialize();
- timer = new Timer.Timer();
+ strNoInternet = WatchUi.loadResource($.Rez.Strings.NoInternet);
+ strNoMenu = WatchUi.loadResource($.Rez.Strings.NoMenu);
+ timer = new Timer.Timer();
}
// onStart() is called on application start up
@@ -69,13 +73,7 @@ class HomeAssistantApp extends Application.AppBase {
if (Globals.debug) {
System.println("HomeAssistantApp Note - onReturnFetchMenuConfig(): Configuration not found or potential validation issue.");
}
- new Alert({
- :timeout => Globals.alertTimeout,
- :font => Graphics.FONT_SYSTEM_MEDIUM,
- :text => "onReturnFetchMenuConfig Error " + responseCode,
- :fgcolor => Graphics.COLOR_RED,
- :bgcolor => Graphics.COLOR_BLACK
- }).pushView(WatchUi.SLIDE_IMMEDIATE);
+ WatchUi.pushView(new ErrorView(strNoMenu + " code=" + responseCode ), new ErrorDelegate(), WatchUi.SLIDE_UP);
}
}
@@ -98,7 +96,7 @@ class HomeAssistantApp extends Application.AppBase {
new Alert({
:timeout => Globals.alertTimeout,
:font => Graphics.FONT_SYSTEM_MEDIUM,
- :text => "No Internet connection",
+ :text => strNoInternet,
:fgcolor => Graphics.COLOR_RED,
:bgcolor => Graphics.COLOR_BLACK
}).pushView(WatchUi.SLIDE_IMMEDIATE);
diff --git a/source/HomeAssistantMenuItem.mc b/source/HomeAssistantMenuItem.mc
index 91b64c4..a60986b 100644
--- a/source/HomeAssistantMenuItem.mc
+++ b/source/HomeAssistantMenuItem.mc
@@ -25,6 +25,7 @@ using Toybox.Application.Properties;
class HomeAssistantMenuItem extends WatchUi.MenuItem {
hidden var api_key = Properties.getValue("api_key");
+ hidden var strNoInternet as Lang.String;
function initialize(
label as Lang.String or Lang.Symbol,
@@ -35,6 +36,7 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
:icon as Graphics.BitmapType or WatchUi.Drawable or Lang.Symbol
} or Null
) {
+ strNoInternet = WatchUi.loadResource($.Rez.Strings.NoInternet);
WatchUi.MenuItem.initialize(
label,
subLabel,
@@ -58,7 +60,7 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
System.println("HomeAssistantMenuItem Note - onReturnExecScript(): Correct script executed.");
}
new Alert({
- :timeout => Globals.alertTimeout,
+ :timeout => Globals.tapTimeout,
:font => Graphics.FONT_SYSTEM_MEDIUM,
:text => (d[i].get("attributes") as Lang.Dictionary).get("friendly_name"),
:fgcolor => Graphics.COLOR_WHITE,
@@ -96,7 +98,7 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
new Alert({
:timeout => Globals.alertTimeout,
:font => Graphics.FONT_SYSTEM_MEDIUM,
- :text => "No Internet connection",
+ :text => strNoInternet,
:fgcolor => Graphics.COLOR_RED,
:bgcolor => Graphics.COLOR_BLACK
}).pushView(WatchUi.SLIDE_IMMEDIATE);
diff --git a/source/HomeAssistantToggleMenuItem.mc b/source/HomeAssistantToggleMenuItem.mc
index 1c85d53..82c3393 100644
--- a/source/HomeAssistantToggleMenuItem.mc
+++ b/source/HomeAssistantToggleMenuItem.mc
@@ -25,6 +25,7 @@ using Toybox.Application.Properties;
class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
hidden var api_key = Properties.getValue("api_key");
+ hidden var strNoInternet as Lang.String;
function initialize(
label as Lang.String or Lang.Symbol,
@@ -39,6 +40,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
:icon as Graphics.BitmapType or WatchUi.Drawable or Lang.Symbol
} or Null
) {
+ strNoInternet = WatchUi.loadResource($.Rez.Strings.NoInternet);
WatchUi.ToggleMenuItem.initialize(label, subLabel, identifier, enabled, options);
api_key = Properties.getValue("api_key");
}
@@ -100,7 +102,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
new Alert({
:timeout => Globals.alertTimeout,
:font => Graphics.FONT_SYSTEM_MEDIUM,
- :text => "No Internet connection",
+ :text => strNoInternet,
:fgcolor => Graphics.COLOR_RED,
:bgcolor => Graphics.COLOR_BLACK
}).pushView(WatchUi.SLIDE_IMMEDIATE);
@@ -164,7 +166,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
new Alert({
:timeout => Globals.alertTimeout,
:font => Graphics.FONT_SYSTEM_MEDIUM,
- :text => "No Internet connection",
+ :text => strNoInternet,
:fgcolor => Graphics.COLOR_RED,
:bgcolor => Graphics.COLOR_BLACK
}).pushView(WatchUi.SLIDE_IMMEDIATE);
diff --git a/source/HomeAssistantView.mc b/source/HomeAssistantView.mc
index d63d49e..5d2fdc6 100644
--- a/source/HomeAssistantView.mc
+++ b/source/HomeAssistantView.mc
@@ -23,6 +23,7 @@ using Toybox.Graphics;
using Toybox.WatchUi;
class HomeAssistantView extends WatchUi.Menu2 {
+ hidden var strMenuItemTap as Lang.String;
function initialize(
definition as Lang.Dictionary,
@@ -32,9 +33,10 @@ class HomeAssistantView extends WatchUi.Menu2 {
:theme as WatchUi.MenuTheme or Null
} or Null
) {
+ strMenuItemTap = WatchUi.loadResource($.Rez.Strings.MenuItemTap);
var toggle_obj = {
- :enabled => "On",
- :disabled => "Off"
+ :enabled => WatchUi.loadResource($.Rez.Strings.MenuItemOn) as Lang.String,
+ :disabled => WatchUi.loadResource($.Rez.Strings.MenuItemOff) as Lang.String
};
if (options == null) {
@@ -66,7 +68,7 @@ class HomeAssistantView extends WatchUi.Menu2 {
addItem(
new HomeAssistantMenuItem(
name,
- "Tap",
+ strMenuItemTap,
entity,
null
)
@@ -115,6 +117,9 @@ class HomeAssistantView extends WatchUi.Menu2 {
}
+//
+// Reference: https://developer.garmin.com/connect-iq/core-topics/input-handling/
+//
class HomeAssistantViewDelegate extends WatchUi.Menu2InputDelegate {
function initialize() {
diff --git a/source/HomeAssistantViewMenuItem.mc b/source/HomeAssistantViewMenuItem.mc
index 39b72c3..7a5ec4a 100644
--- a/source/HomeAssistantViewMenuItem.mc
+++ b/source/HomeAssistantViewMenuItem.mc
@@ -28,7 +28,7 @@ class HomeAssistantViewMenuItem extends WatchUi.MenuItem {
// definitions.get(...) are Strings here as they have been checked by HomeAssistantView first
WatchUi.MenuItem.initialize(
definition.get("name") as Lang.String,
- "Menu",
+ WatchUi.loadResource($.Rez.Strings.MenuItemMenu) as Lang.String,
definition.get("entity") as Lang.String,
null
);
diff --git a/source/ScalableView.mc b/source/ScalableView.mc
new file mode 100644
index 0000000..9b93c1b
--- /dev/null
+++ b/source/ScalableView.mc
@@ -0,0 +1,48 @@
+//-----------------------------------------------------------------------------------
+//
+// Distributed under MIT Licence
+// See https://github.com/house-of-abbey/GarminHomeAssistant/blob/main/LICENSE.
+//
+//-----------------------------------------------------------------------------------
+//
+// GarminHomeAssistant is a Garmin IQ application written in Monkey C and routinely
+// tested on a Venu 2 device. The source code is provided at:
+// https://github.com/house-of-abbey/GarminHomeAssistant.
+//
+// J D Abbey & P A Abbey, 28 December 2022
+//
+//
+// Description:
+//
+// A view with added methods to scale from percentages of scrren size to pixels.
+//
+//-----------------------------------------------------------------------------------
+
+using Toybox.Lang;
+using Toybox.WatchUi;
+using Toybox.Math;
+
+class ScalableView extends WatchUi.View {
+ hidden var screenWidth;
+
+ function initialize() {
+ View.initialize();
+ }
+
+ // Convert a fraction expressed as a percentage (%) to a number of pixels for the
+ // screen's dimensions.
+ //
+ // Parameters:
+ // * dc - Device context
+ // * pc - Percentage (%) expressed as a number in the range 0.0..100.0
+ //
+ // Uses screen width rather than screen height as rectangular screens tend to have
+ // height > width.
+ //
+ function pixelsForScreen(pc as Lang.Float) as Lang.Number {
+ if (screenWidth == null) {
+ screenWidth = System.getDeviceSettings().screenWidth;
+ }
+ return Math.round(pc * screenWidth) / 100;
+ }
+}
diff --git a/translate.py b/translate.py
new file mode 100644
index 0000000..d4592a5
--- /dev/null
+++ b/translate.py
@@ -0,0 +1,115 @@
+####################################################################################
+#
+# Distributed under MIT Licence
+# See https://github.com/house-of-abbey/GarminThermoNest/blob/main/LICENSE.
+#
+####################################################################################
+#
+# ThermoNest is a Garmin IQ application written in Monkey C and routinely tested on
+# a Venu 2 device. The source code is provided at:
+# https://github.com/house-of-abbey/GarminThermoNest.
+#
+# J D Abbey & P A Abbey, 28 December 2022
+#
+#
+# Description:
+#
+# Python script to automatically translate the strings.xml file to each supported
+# language using Google Translate.
+#
+# Python installation:
+# pip install BeautifulSoup
+# pip install deep-translator
+# NB. For XML formatting:
+# pip install lxml
+#
+# References:
+# * https://www.crummy.com/software/BeautifulSoup/bs4/doc/
+# * https://realpython.com/beautiful-soup-web-scraper-python/
+# * https://www.crummy.com/software/BeautifulSoup/bs4/doc/#parsing-xml
+# * https://www.crummy.com/software/BeautifulSoup/bs4/doc/#xml
+#
+####################################################################################
+
+from deep_translator import GoogleTranslator
+from bs4 import BeautifulSoup, Comment
+import os
+
+# List of tuples in the form os:
+# * Garmin IQ language three letter mnemonic,
+# * Google Translate language mnemonic,
+# * Language familiar name (mainly for reference)
+languages: list[tuple[str, str, str]] = [
+ ("ara", "ar", "Arabic"),
+ ("bul", "bg", "Bulgarian"),
+ ("zhs", "zh-CN", "Chinese (Simplified)"),
+ ("zht", "zh-TW", "Chinese (Traditional)"),
+ ("hrv", "hr", "Croatian"),
+ ("ces", "cs", "Czech"),
+ ("dan", "da", "Danish"),
+ ("dut", "nl", "Dutch"),
+ ("deu", "de", "German"),
+ ("gre", "el", "Greek"),
+ # ("eng", "en", "English"),
+ ("est", "et", "Estonian"),
+ ("fin", "fi", "Finnish"),
+ ("fre", "fr", "French"),
+ ("heb", "iw", "Hebrew"),
+ ("hun", "hu", "Hungarian"),
+ ("ind", "id", "Indonesian"),
+ ("ita", "it", "Italian"),
+ ("jpn", "ja", "Japanese"),
+ ("kor", "ko", "Korean"),
+ ("lav", "lv", "Latvian"),
+ ("lit", "lt", "Lithuanian"),
+ ("zsm", "ms", "Standard (Bahasa) Malay"),
+ ("nob", "no", "Norwegian"),
+ ("pol", "pl", "Polish"),
+ ("por", "pt", "Portuguese"),
+ ("ron", "ro", "Romanian"),
+ # ("rus", "ru", "Russian"),
+ ("slo", "sk", "Slovak"),
+ ("slv", "sl", "Slovenian"),
+ ("spa", "es", "Spanish"),
+ ("swe", "sv", "Swedish"),
+ ("tha", "th", "Thai"),
+ ("tur", "tr", "Turkish"),
+ ("ukr", "uk", "Ukrainian"),
+ ("vie", "vi", "Vietnamese")
+]
+
+langLength = len(languages)
+
+exceptionIds: list[str] = ["AppName", "AppVersionTitle"]
+titleIds: list[str] = ["setMode", "tapIcon"]
+
+i = 1
+with open("./resources/strings/strings.xml") as f:
+ c = f.read().replace('\r', '')
+ for l in languages:
+ print(f"{i} of {langLength}: Translating English to {l[2]}")
+ soup = BeautifulSoup(c, features="xml")
+ soup.find(name="strings").insert_before("\n\n")
+ soup.find(name="strings").insert_before(
+ Comment(f"\n Generated by Google Translate: English to {l[2]}\n " +
+ GoogleTranslator(source='en', target=l[1]).translate("Generated by Google Translate from English") +
+ "\n")
+ )
+ soup.find(name="strings").insert_before("\n\n")
+
+ for s in soup.find(name="strings").findAll(name="string"):
+ s.insert_before(" ")
+ if s["id"] not in exceptionIds:
+ a = GoogleTranslator(source='en', target=l[1]).translate(s.string)
+ if s["id"] in titleIds:
+ s.string = a.title()
+ else:
+ s.string = a
+ for s in soup.find(name="strings").findAll(text=lambda text:isinstance(text, Comment)):
+ s.insert_before(" ")
+ s.replace_with(Comment(" " + GoogleTranslator(source='en', target=l[1]).translate(s) + " "))
+ #print(str(soup))
+ os.makedirs(f"./resources-{l[0]}/strings/", exist_ok=True)
+ with open(f"./resources-{l[0]}/strings/strings.xml", "wb") as w:
+ w.write(soup.encode("utf-8"))
+ i += 1