Json safe float/power control hub app start#192
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an initial .NET MAUI client app for PowerControlHub (relay control + sensor dashboard + OTA banner + settings/theme), and hardens firmware JSON output for floating-point values while adding a voltage sensor handler.
Changes:
- Introduces MAUI UI: Dashboard + Settings pages with sensor DataTemplates and a DataTemplateSelector.
- Adds app services/viewmodels for device communication, in-app logging, OTA banner state, and theme switching.
- Updates firmware to emit JSON-safe floats (
nullfor non-finite) and adds/updates sensor handlers (Voltage, GPS, DHT11) to use it.
Reviewed changes
Copilot reviewed 70 out of 77 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| PowerControlHubApp/Views/Templates/WaterSensorTemplate.xaml.cs | Code-behind for water sensor DataTemplate resource dictionary. |
| PowerControlHubApp/Views/Templates/WaterSensorTemplate.xaml | Water sensor card DataTemplate (level + avg). |
| PowerControlHubApp/Views/Templates/VoltageSensorTemplate.xaml.cs | Code-behind for voltage sensor DataTemplate resource dictionary. |
| PowerControlHubApp/Views/Templates/VoltageSensorTemplate.xaml | Voltage sensor card DataTemplate (instant + rolling avg). |
| PowerControlHubApp/Views/Templates/SystemSensorTemplate.xaml.cs | Code-behind for system sensor DataTemplate resource dictionary. |
| PowerControlHubApp/Views/Templates/SystemSensorTemplate.xaml | System sensor card DataTemplate (CPU + free RAM). |
| PowerControlHubApp/Views/Templates/SensorTemplateSelector.cs | Selects the correct sensor card template by sensor type. |
| PowerControlHubApp/Views/Templates/LightSensorTemplate.xaml.cs | Code-behind for light sensor DataTemplate resource dictionary. |
| PowerControlHubApp/Views/Templates/LightSensorTemplate.xaml | Light sensor card DataTemplate (day/night + analog fields). |
| PowerControlHubApp/Views/Templates/GpsSensorTemplate.xaml.cs | Code-behind for GPS sensor DataTemplate resource dictionary. |
| PowerControlHubApp/Views/Templates/GpsSensorTemplate.xaml | GPS sensor card DataTemplate (fix + speed/course + coordinates). |
| PowerControlHubApp/Views/Templates/GenericSensorTemplate.xaml.cs | Code-behind for generic sensor fallback DataTemplate resource dictionary. |
| PowerControlHubApp/Views/Templates/GenericSensorTemplate.xaml | Generic sensor fallback template (ValueSummary). |
| PowerControlHubApp/Views/Templates/Dht11SensorTemplate.xaml.cs | Code-behind for DHT11 sensor DataTemplate resource dictionary. |
| PowerControlHubApp/Views/Templates/Dht11SensorTemplate.xaml | DHT11 sensor card DataTemplate (temp/humidity + derived values). |
| PowerControlHubApp/Views/Templates/BinaryPresenceSensorTemplate.xaml.cs | Code-behind for binary presence sensor DataTemplate resource dictionary. |
| PowerControlHubApp/Views/Templates/BinaryPresenceSensorTemplate.xaml | Binary presence sensor card DataTemplate (state icon/label). |
| PowerControlHubApp/Views/SettingsPage.xaml.cs | Settings page code-behind (navigation back to dashboard). |
| PowerControlHubApp/Views/SettingsPage.xaml | Settings UI (IP/port/theme picker + save/connect + help text). |
| PowerControlHubApp/Views/DashboardPage.xaml.cs | Dashboard page code-behind (refresh loop start/stop, UI handlers). |
| PowerControlHubApp/Views/DashboardPage.xaml | Dashboard UI (relays grid, sensors grid, status bar, OTA banner, log panel). |
| PowerControlHubApp/ViewModels/SettingsViewModel.cs | Settings state + persistence + ThemeService integration. |
| PowerControlHubApp/ViewModels/DashboardViewModel.cs | Dashboard state, polling/refresh loop, OTA banner state, relay toggling, logging. |
| PowerControlHubApp/Services/ThemeService.cs | Runtime theme application by overwriting semantic resource keys. |
| PowerControlHubApp/Services/PowerHubService.cs | HTTP API wrapper + JSON parsing for relays/sensors + OTA endpoints. |
| PowerControlHubApp/Services/LogService.cs | In-memory ring-buffer log feeding UI log panel. |
| PowerControlHubApp/Resources/Styles/Styles.xaml | Base MAUI styles used across the app. |
| PowerControlHubApp/Resources/Styles/Colors.xaml | Base color resources (template defaults). |
| PowerControlHubApp/Resources/Styles/AppColorsLight.xaml.cs | Code-behind for light semantic palette dictionary. |
| PowerControlHubApp/Resources/Styles/AppColorsLight.xaml | Light semantic palette keys used by ThemeService/DynamicResource. |
| PowerControlHubApp/Resources/Styles/AppColorsDark.xaml.cs | Code-behind for dark semantic palette dictionary. |
| PowerControlHubApp/Resources/Styles/AppColorsDark.xaml | Dark semantic palette keys used by ThemeService/DynamicResource. |
| PowerControlHubApp/Resources/Splash/splash.svg | App splash asset. |
| PowerControlHubApp/Resources/Raw/AboutAssets.txt | Default MAUI raw-asset placeholder documentation. |
| PowerControlHubApp/Resources/AppIcon/appiconfg.svg | App icon foreground vector. |
| PowerControlHubApp/Resources/AppIcon/appicon.svg | App icon background vector. |
| PowerControlHubApp/PowerControlHubApp.csproj | MAUI project definition + XAML compile settings + target frameworks/assets. |
| PowerControlHubApp/Platforms/Windows/Package.appxmanifest | Windows packaging manifest boilerplate. |
| PowerControlHubApp/Platforms/Windows/App.xaml.cs | Windows app entrypoint glue for MAUI. |
| PowerControlHubApp/Platforms/Windows/App.xaml | Windows XAML app definition boilerplate. |
| PowerControlHubApp/Platforms/Windows/app.manifest | Windows app manifest boilerplate. |
| PowerControlHubApp/Platforms/MacCatalyst/Program.cs | MacCatalyst entrypoint boilerplate. |
| PowerControlHubApp/Platforms/MacCatalyst/Info.plist | MacCatalyst Info.plist boilerplate. |
| PowerControlHubApp/Platforms/MacCatalyst/Entitlements.plist | MacCatalyst entitlements (network client) boilerplate. |
| PowerControlHubApp/Platforms/MacCatalyst/AppDelegate.cs | MacCatalyst app delegate boilerplate. |
| PowerControlHubApp/Platforms/iOS/Resources/PrivacyInfo.xcprivacy | iOS privacy manifest boilerplate. |
| PowerControlHubApp/Platforms/iOS/Program.cs | iOS entrypoint boilerplate. |
| PowerControlHubApp/Platforms/iOS/Info.plist | iOS Info.plist boilerplate. |
| PowerControlHubApp/Platforms/iOS/AppDelegate.cs | iOS app delegate boilerplate. |
| PowerControlHubApp/Platforms/Android/Resources/values/colors.xml | Android color resources boilerplate. |
| PowerControlHubApp/Platforms/Android/MainApplication.cs | Android application class boilerplate. |
| PowerControlHubApp/Platforms/Android/MainActivity.cs | Android activity boilerplate. |
| PowerControlHubApp/Platforms/Android/AndroidManifest.xml | Android manifest + network permissions. |
| PowerControlHubApp/Models/SensorType.cs | Sensor type enum to drive template selection. |
| PowerControlHubApp/Models/SensorModel.cs | Sensor model with typed helpers backed by JsonExtensionData. |
| PowerControlHubApp/Models/RelayModel.cs | Relay model with computed IsOn/IsEnabled and display naming. |
| PowerControlHubApp/Models/OtaStatusModel.cs | OTA status model + computed banner helpers. |
| PowerControlHubApp/Models/LogEntry.cs | Log entry model + coloring helpers for UI. |
| PowerControlHubApp/MauiProgram.cs | DI registration for services/viewmodels/pages and initial service config from Preferences. |
| PowerControlHubApp/MainPage.xaml.cs | Default template MainPage code-behind (counter sample). |
| PowerControlHubApp/MainPage.xaml | Default template MainPage UI (counter sample). |
| PowerControlHubApp/Converters/ValueConverters.cs | Common value converters for bindings. |
| PowerControlHubApp/AppShell.xaml.cs | Shell code-behind. |
| PowerControlHubApp/AppShell.xaml | Shell routes for Dashboard and Settings. |
| PowerControlHubApp/App.xaml.cs | App startup + (Windows) window position persistence. |
| PowerControlHubApp/App.xaml | App resource dictionary wiring (Colors + AppColorsLight + Styles). |
| PowerControlHub/VoltageSensorHandler.h | New/updated firmware voltage sensor handler with rolling average + JSON status. |
| PowerControlHub/SystemFunctions.h | Declares safeJsonFloat helper for JSON-safe float emission. |
| PowerControlHub/SystemFunctions.cpp | Implements safeJsonFloat helper. |
| PowerControlHub/PowerControlHub.vcxproj.filters | Project filter cleanup + test data file list updates. |
| PowerControlHub/GpsSensorHandler.h | Uses safeJsonFloat for JSON output of GPS numeric fields. |
| PowerControlHub/Dht11SensorHandler.h | Uses safeJsonFloat for JSON output of DHT11 numeric fields. |
| PowerControlHub.sln | Adds the MAUI app project to the solution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.