Added Watch Battery transmission

Added a background service to send the watch battery level to Home Assistant.
Changed the Glance View as requested by a user.
Updated to new HA icon using SVG in stead of PNG.
This commit is contained in:
Philip Abbey
2023-12-31 15:22:21 +00:00
parent b2461a09e6
commit 56155f5f5c
96 changed files with 1152 additions and 260 deletions

View File

@ -24,8 +24,7 @@ using Toybox.Graphics;
(:glance)
class HomeAssistantGlanceView extends WatchUi.GlanceView {
private static const scLeftMargin = 20; // in pixels
private static const scLeftIndent = 10; // Left Indent "_text:" in pixels
private static const scLeftMargin = 5; // in pixels
private static const scMidSep = 10; // Middle Separator "text:_text" in pixels
private var mApp as HomeAssistantApp;
private var mTitle as WatchUi.Text or Null;
@ -58,8 +57,8 @@ class HomeAssistantGlanceView extends WatchUi.GlanceView {
:text => "API:",
:color => Graphics.COLOR_WHITE,
:font => Graphics.FONT_XTINY,
:justification => Graphics.TEXT_JUSTIFY_RIGHT | Graphics.TEXT_JUSTIFY_VCENTER,
:locX => scLeftMargin + scLeftIndent + tw,
:justification => Graphics.TEXT_JUSTIFY_LEFT | Graphics.TEXT_JUSTIFY_VCENTER,
:locX => scLeftMargin,
:locY => 3 * h / 6
});
mApiStatus = new WatchUi.Text({
@ -67,15 +66,15 @@ class HomeAssistantGlanceView extends WatchUi.GlanceView {
:color => Graphics.COLOR_WHITE,
:font => Graphics.FONT_XTINY,
:justification => Graphics.TEXT_JUSTIFY_LEFT | Graphics.TEXT_JUSTIFY_VCENTER,
:locX => scLeftMargin + scLeftIndent + scMidSep + tw,
:locX => scLeftMargin + scMidSep + tw,
:locY => 3 * h / 6
});
mMenuText = new WatchUi.Text({
:text => strGlanceMenu + ":",
:color => Graphics.COLOR_WHITE,
:font => Graphics.FONT_XTINY,
:justification => Graphics.TEXT_JUSTIFY_RIGHT | Graphics.TEXT_JUSTIFY_VCENTER,
:locX => scLeftMargin + scLeftIndent + tw,
:justification => Graphics.TEXT_JUSTIFY_LEFT | Graphics.TEXT_JUSTIFY_VCENTER,
:locX => scLeftMargin,
:locY => 5 * h / 6
});
mMenuStatus = new WatchUi.Text({
@ -83,7 +82,7 @@ class HomeAssistantGlanceView extends WatchUi.GlanceView {
:color => Graphics.COLOR_WHITE,
:font => Graphics.FONT_XTINY,
:justification => Graphics.TEXT_JUSTIFY_LEFT | Graphics.TEXT_JUSTIFY_VCENTER,
:locX => scLeftMargin + scLeftIndent + scMidSep + tw,
:locX => scLeftMargin + scMidSep + tw,
:locY => 5 * h / 6
});
}
@ -95,7 +94,7 @@ class HomeAssistantGlanceView extends WatchUi.GlanceView {
}
dc.setColor(
Graphics.COLOR_WHITE,
Graphics.COLOR_BLUE
Graphics.COLOR_TRANSPARENT
);
dc.clear();
mTitle.draw(dc);