Skip to content

Commit

Permalink
v1.4.0-beta.31
Browse files Browse the repository at this point in the history
- Added "context code" to c# programs where to declare constants, enums, classes and fields visible to both setup and main code.
- Added new ApiHelper class to perform custom API-related tasks
- Deprecated: "When.WebServiceCallReceived", "Program.ApiCall", "Program.ParseApiCall"
- Added "Program.Implements" method to declare implemented API interfaces (e.g. Chart Provider to create custom charts)
-Added example chart providers: Weekly energy statistics and a mocked Pie Chart statistics
- Added option to undo changes made to a system program and to upgrade programs when a new version is available
  • Loading branch information
genemars committed Mar 26, 2023
1 parent a0cdcb5 commit 46b5702
Show file tree
Hide file tree
Showing 45 changed files with 1,246 additions and 615 deletions.
2 changes: 1 addition & 1 deletion assets/build/all/app/assets/editor/homegenie-js-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SchedulerApi {
knx: any;
// SchedulerHelper
scheduler: SchedulerHelper;
// Events helper
// The scheduler event item
event: any;
// Miscellaneous functions
/**
Expand Down
32 changes: 29 additions & 3 deletions assets/build/all/app/assets/editor/homegenie-js-app-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ class ProgramApi {
knx: any;
// SchedulerHelper
scheduler: SchedulerHelper;
// Events helper
event: any;
// Events helper (hg.When)
on: EventsHelper;
// API Helper
api: ApiHelper;
// Miscellaneous functions
/**
* Pause for the given amount of seconds.
Expand All @@ -36,7 +38,29 @@ class ProgramApi {
* @param seconds
*/
delay(seconds: number); // alias of 'pause'
on: EventsHelper;
}

class EventsHelper {
// TODO: ...
}

class ApiHelper {
handle(apiCall: string, handler: function);

/**
* Parses the given (api call) string as a `MigInterfaceCommand` object.
* @returns The mig command.
* @param apiCall Api Command (eg. "HomeAutomation.X10/A5/Control.Level/50").
*/
parse(apiCall: string): MigInterfaceCommand;

/**
* Invoke an API command and get the result.
* @returns The API command response.
* @param apiCommand Any MIG/APP API command without the `/api/` prefix.
* @param data Data object.
*/
call(apiCommand: string, data?: any): any;
}

class ProgramHelper {
Expand Down Expand Up @@ -88,6 +112,7 @@ class ProgramHelper {
* Parses the given (api call) string as a `MigInterfaceCommand` object.
* @returns The mig command.
* @param apiCall Api Command (eg. "HomeAutomation.X10/A5/Control.Level/50").
* @deprecated Use $$.api.parse(..) instead
*/
parseApiCall(apiCall: string): MigInterfaceCommand;

Expand All @@ -96,6 +121,7 @@ class ProgramHelper {
* @returns The API command response.
* @param apiCommand Any MIG/APP API command without the `/api/` prefix.
* @param data Data object.
* @deprecated Use $$.api.call(..) instead
*/
apiCall(apiCommand: string, data?: any): any;

Expand Down
10 changes: 9 additions & 1 deletion assets/build/all/app/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,13 @@
"edit_data_source": "Edit data source",
"add_to_dashboard": "Add to dashboard",
"fill": "Fill",
"label": "Label"
"label": "Label",
"chart_type": "Chart type",
"line_chart": "Lines",
"bar_chart": "Bars",
"scatter_chart": "Scatter",
"data_monitor": "Data monitor",
"add_chart": "Add chart",
"restore_original": "Restore original",
"upgrade": "Upgrade"
}
2 changes: 2 additions & 0 deletions assets/build/all/app/assets/i18n/homegenie/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
"Setup",
"main_code":
"Main",
"context_code":
"Context",
"main_code_empty_note":
"\"Main\" code is empty.\n\nUse the \"Visual code\" editor to generate this code:\n- Open the category \"Program\" from the command palette on the left\n- Drag a block of type \"Main\" in the visual code workspace\n- Add inside it other code blocks to implement actions and logic of this program\n\nThe program \"Main\" can be either run manually or auto-started based on conditions eventually given in the Setup code.",
"setup_code_empty_note":
Expand Down
2 changes: 2 additions & 0 deletions assets/build/all/app/assets/i18n/homegenie/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
"Setup",
"main_code":
"Main",
"context_code":
"Context",
"main_code_empty_note":
"Il codice \"Main\" è vuoto.\n\nUsa l'editor di \"Codice visuale\" per generare questo codice:\n- Apri la categoria \"Programma\" dalla tavolozza dei comandi sulla sinistra\n- Trascina un blocco di tipo \"Main\" nell'area di lavoro del codice visuale\n- Aggiungi al suo interno altri blocchi di codice per implementare le azioni e la logica di questo programma\n\nIl programma \"Main\" può essere eseguito manualmente o avviato automaticamente sulla base delle condizioni eventualmente specificate nel codice \"Setup\".",
"setup_code_empty_note":
Expand Down
10 changes: 9 additions & 1 deletion assets/build/all/app/assets/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,13 @@
"edit_data_source": "Modifica sorgente dati",
"add_to_dashboard": "Agg. a dashboard",
"fill": "Riempi",
"label": "Etichetta"
"label": "Etichetta",
"chart_type": "Tipo grafico",
"line_chart": "Linee",
"bar_chart": "Barre",
"scatter_chart": "Scatter",
"data_monitor": "Monitor dati",
"add_chart": "Aggiungi grafico",
"restore_original": "Ripristina originale",
"upgrade": "Aggiorna"
}
4 changes: 3 additions & 1 deletion assets/build/all/app/assets/i18n/module/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@
"stats.twelve_hours":
"12 hours",
"stats.twentyfour_hours":
"24 hours"
"24 hours",
"stats.chart_provider":
"Chart provider"
}
4 changes: 3 additions & 1 deletion assets/build/all/app/assets/i18n/module/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@
"stats.twelve_hours":
"12 ore",
"stats.twentyfour_hours":
"24 ore"
"24 ore",
"stats.chart_provider":
"Chart provider"
}
2 changes: 1 addition & 1 deletion assets/build/all/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@

</div>

<script src="runtime.b92e2ca178ebbf4a.js" type="module"></script><script src="polyfills.710b144f4805f4b0.js" type="module"></script><script src="main.66eb1f14fa58fd63.js" type="module"></script>
<script src="runtime.b92e2ca178ebbf4a.js" type="module"></script><script src="polyfills.710b144f4805f4b0.js" type="module"></script><script src="main.e897d9a4a975eebf.js" type="module"></script>

</body></html>

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions assets/build/all/app/ngsw.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"configVersion": 1,
"timestamp": 1679334116147,
"timestamp": 1679848192944,
"index": "/app/index.html",
"assetGroups": [
{
Expand All @@ -15,7 +15,7 @@
"/app/613.16b9c52c0ae74833.js",
"/app/859.0f150be9c99a6b5a.js",
"/app/index.html",
"/app/main.66eb1f14fa58fd63.js",
"/app/main.e897d9a4a975eebf.js",
"/app/manifest.webmanifest",
"/app/polyfills.710b144f4805f4b0.js",
"/app/runtime.b92e2ca178ebbf4a.js",
Expand Down Expand Up @@ -395,8 +395,8 @@
"/app/assets/blockly/delete.mp3": "d4f2d4f6ce6ca428a479eeb76b9a8a59154d4eae",
"/app/assets/blockly/disconnect.wav": "dbf37dabda4f66c65f20d832ed84e99543c17ed1",
"/app/assets/blockly/sprites.png": "10d452001d13971bcdab151e029f1160e70b32f6",
"/app/assets/editor/homegenie-js-api.js": "d084ae169de19ac5937dd5d8b073f969c2c81886",
"/app/assets/editor/homegenie-js-app-api.js": "f72ea67a48a298b206abf4b51a2c78ac59dd7333",
"/app/assets/editor/homegenie-js-api.js": "e9260df8f266686f66a139f134b1c3b54270f0c3",
"/app/assets/editor/homegenie-js-app-api.js": "afc158ca5dfd4ecf73fb4f5abdf50d323fdfc804",
"/app/assets/editor/templates/scheduler/command.set-level.js": "b3ec73252b541b23694afeab76ecf1009b0906be",
"/app/assets/editor/templates/scheduler/command.thermostat-mode.js": "47e580a75d1cc5f83716b9a829e45fac8cd30904",
"/app/assets/editor/templates/scheduler/command.turn-off.js": "bb1bab852c09316ff93601c9a13567e78817298c",
Expand All @@ -410,12 +410,12 @@
"/app/assets/fonts/Roboto-Latin-300.woff": "fec6225507c70951797db15985fe0bf87195d6ee",
"/app/assets/fonts/Roboto-Latin-400.woff": "fec6225507c70951797db15985fe0bf87195d6ee",
"/app/assets/fonts/Roboto-Latin-500.woff": "7416b5d46c615d2786a604d71d334b605d41cc73",
"/app/assets/i18n/en.json": "372d1e3f979e394213b53c2fff0edb179d120bf4",
"/app/assets/i18n/homegenie/en.json": "d8ea4950b51f0db6dc54e1c7247e06dd9d1502be",
"/app/assets/i18n/homegenie/it.json": "45981bcdbaa0e57ce93621cd82d5329ad8fa834c",
"/app/assets/i18n/it.json": "b1b76b50da643c7662d1d2343649a768a5ebef81",
"/app/assets/i18n/module/en.json": "b91f73dda960b9c0cb26aeee6820019fc893b833",
"/app/assets/i18n/module/it.json": "02c2a0c1deab911e7e527548003afa717bd8d03e",
"/app/assets/i18n/en.json": "644ed274bcab8d94c23f1e116679103803a11667",
"/app/assets/i18n/homegenie/en.json": "4637f7a1e201357eaaede19b2674151d72240f8e",
"/app/assets/i18n/homegenie/it.json": "541769857050e56bada89d18d065335a4a402239",
"/app/assets/i18n/it.json": "0d9636df4cf8ce33f38f9ea45a7ab0ede019b8da",
"/app/assets/i18n/module/en.json": "bd1f58f6eeb2e8213bc5dbe316d1252db8aa436f",
"/app/assets/i18n/module/it.json": "35c4ef9b17591c0ef0283317a3f226c666d908f9",
"/app/assets/i18n/widgets/en.json": "81775f6536411948d4d4c6e054a768a21793ab24",
"/app/assets/i18n/widgets/it.json": "6435f9a7978c18e24fc8d79db404ac4d190fb50a",
"/app/assets/i18n/zigbee/en.json": "3353db6fb123f979e1811a724026886a9993fe14",
Expand Down Expand Up @@ -724,8 +724,8 @@
"/app/assets/widgets/weather/images_alt/weather.svg": "c719c09048977fd40688272316b35ddf1bdf89e8",
"/app/assets/widgets/weather/style.css": "1b70730e73885cc0ee83566eaf584008d34e2255",
"/app/assets/workers/typings-worker.js": "8df10d867c12d36cdebfb7e16caacd0020db301f",
"/app/index.html": "2e9c257ffa783ca0ac3d508bfa985cca3616bd1c",
"/app/main.66eb1f14fa58fd63.js": "2bb5e16b020745a7d51ca9dc66bd4aca28677dc2",
"/app/index.html": "2ba5fa14fa7392c9ca763dda770067f186a20839",
"/app/main.e897d9a4a975eebf.js": "e1567df4fc5752733af81b8df7fc3a0d706bbb77",
"/app/manifest.webmanifest": "d47bb07a495e27ddf072f8702df373f79b4eb183",
"/app/polyfills.710b144f4805f4b0.js": "594a5ea1b9d3f9cbc4f363eca84eda2c8bb8a901",
"/app/runtime.b92e2ca178ebbf4a.js": "b50d841a4c50d466c34aab3267d3fb4afe87dede",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"repository":"homegenie","id":"homegenie-base","version":"1.0.0","description":"HomeGenie base package. This should always be installed.","programs":[{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"111","id":"client-configs","required":true,"version":"1.0.1","checksum":"AC96494FCA5A5E953B728A669BAF7CA3","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"142","id":"e-mail-account","required":true,"version":"1.0.0","checksum":"8A42A1D70C35CF3C855AF8761795F5B7","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"95","id":"events-logging","required":true,"version":"1.0.0","checksum":"25467F93E2AA07645AE54E5D5BB9587E","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"77","id":"mqtt-network","required":true,"version":"1.0.1","checksum":"60A252D5988007FD051C58E78ACDDA5D","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"34","id":"openweathermap","required":true,"version":"1.0.0","checksum":"F22CC262E2D8B59CF3C97348D552398E","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"505","id":"remote-control","required":true,"version":"1.0.0","checksum":"3CCE84C3D6FAFC582974FA8A189B3665","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"900","id":"sine-wave-signal","required":false,"version":"1.0.0","checksum":"E399C55B9D64FCBD38E9B2254066159A","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"570","id":"time-series-filters","required":true,"version":"1.0.1","checksum":"CB0B3531765B9FEFD9E62D8FC8729EC0","installed":false}],"modules":null,"groups":[{"repository":null,"packageId":null,"packageVersion":null,"hid":"Dashboard","id":"0","required":false,"version":"0","checksum":null,"installed":false}],"schedules":[{"repository":null,"packageId":null,"packageVersion":null,"hid":"System.UpdateCheck","id":"0","required":false,"version":"0","checksum":null,"installed":false}]}
{"repository":"homegenie","id":"homegenie-base","version":"1.0.0","description":"HomeGenie base package. This should always be installed.","programs":[{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"111","id":"client-configs","required":true,"version":"1.0.2","checksum":"0BE01D06C8342351AC31E74439BA6022","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"570","id":"stats-data-monitor","required":true,"version":"1.0.3","checksum":"AE4B2FDE10AC697C6C1B1D227D0A6AD9","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"142","id":"e-mail-account","required":true,"version":"1.0.1","checksum":"DEFD8C14DEA9489EB027AB9C3C7CFAEF","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"571","id":"energy-use-statistics","required":false,"version":"1.0.1","checksum":"9E70AE138C65E2830D39139BB65DF36B","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"95","id":"events-logging","required":true,"version":"1.0.1","checksum":"45CFE6FF025BD92488BBDBE491C4C98D","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"77","id":"mqtt-network","required":true,"version":"1.0.2","checksum":"06086F482484213E85FF494C08B342D8","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"34","id":"openweathermap","required":true,"version":"1.0.1","checksum":"F93D3B0AEC9971C1C79D70FDE007888B","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"572","id":"pie-chart-stats-example","required":false,"version":"1.0.1","checksum":"763ECA79BE331FBA5AF3A75CF28C7BE7","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"505","id":"remote-control","required":true,"version":"1.0.1","checksum":"BDF7FC5E982D8A588267A989636AA6B6","installed":false},{"repository":"homegenie","packageId":"homegenie-base","packageVersion":"1.0.0","hid":"900","id":"sine-wave-signal","required":false,"version":"1.0.1","checksum":"7FB7ADAF989FC6DCE596C8218E10A80A","installed":false}],"modules":null,"groups":[{"repository":null,"packageId":null,"packageVersion":null,"hid":"Dashboard","id":"0","required":false,"version":"0","checksum":null,"installed":false}],"schedules":[{"repository":null,"packageId":null,"packageVersion":null,"hid":"System.UpdateCheck","id":"0","required":false,"version":"0","checksum":null,"installed":false}]}
Loading

0 comments on commit 46b5702

Please sign in to comment.