Application Settings Configuration
The app.config.yaml
file can be used to configure application settings for logging, enabling Meadow.Cloud features and reboot configuration. You can also add custom developer application settings.
Remember to set Copy to Output Directory to Copy always
in the properties pane of any configuration files.
Lifecycle Configuration - Automatic Reboot
If you need Meadow to relaunch your app should it fail, the Lifecycle
settings allow you to configure that behavior.
First, set RestartOnAppFailure
to true. Then, you can optionally configure a delay, in seconds, before restart using the AppFailureRestartDelaySeconds
setting.
For example, to configure Meadow to wait 15 seconds after a failure before rebooting your application, the syntax should look like this:
Lifecycle:
RestartOnAppFailure: true
AppFailureRestartDelaySeconds: 15
Logging Configuration
Logging configuration allows you to customize the level of data your Meadow application will log to its output channel.
The log level default aligns with the .NET options: Trace
, Debug
, Information
, Warning
, and Error
.
Logging:
LogLevel:
Default: "Trace"
Enable Meadow.Cloud features and Over-the-Air (OtA) updates
To allow Meadow.Cloud basic features (Logging, Events and Command + Control) and over-the-air (OtA) updates to your Meadow application, add the following configuration to your application's app.config.yaml
file:
# Meadow.Cloud configuration.
MeadowCloud:
# Enable Logging, Events, Command + Control
Enabled: true
# Enable Over-the-air Updates
EnableUpdates: true
# Enable Health Metrics
EnableHealthMetrics: true
# How often to send metrics to Meadow.Cloud
HealthMetricsIntervalMinutes: 15
You can learn more about enabling and responding to OtA updates in your Meadow application from the Over-the-Air Updates documentation.
Custom Developer Application Settings
The IApp
interface now has a Settings
property which you can use to add your own custom settings.
public Dictionary<string, string> Settings { get; }
This property gets populated by any settings found in app.config.yaml
that are not used by Meadow.Core. You’ll notice that the property is a Dictionary<string, string>
. How does that translate from your custom settings? The key is a dot-notated “path” to the property name, and the value is always the string representation directly from the settings file.
So if you add the following section to your app.config.yaml
file:
MyApp:
PollInterval: 5
Network:
Name: MyDevice
You would end up with 2 items in the Settings
property at run time:
"MyApp.PollInterval", "5"
"MyApp.Network.Name", "MyDevice"
Meadow is already parsing app.config.yaml
for its own settings, so retrieving these values in this format is effectively free. Meadow, however, does not attempt to parse the values to any underlying type (like int, etc), nor does it support converting the values to a type-safe object because reflection on the F7 microcontroller can be a costly operation and we’d rather leave the decision to use it up to the user.
Sample Apps
For an example of configuration in use, see the Config Files sample App in the Meadow.Samples
repo.
Weather Station Using Public Web Service Using Meadow | |
Build a WIFI Connected Clock Using Meadow | |
Make a Meadow indoor/outdoor temperature/weather desk clock |