Beispiel #1
0
        private IJsonValue ExportAreaConfigurationToJsonValue(IArea area)
        {
            var configuration = new JsonObject();

            configuration.SetNamedValue("Settings", area.ExportConfigurationToJsonObject());

            var actuators = new JsonObject();

            foreach (var actuator in area.Actuators())
            {
                actuators.SetNamedValue(actuator.Id.Value, actuator.ExportConfigurationToJsonObject());
            }

            configuration.SetNamedValue("Actuators", actuators);

            var automations = new JsonObject();

            foreach (var automation in area.Automations())
            {
                automations.SetNamedValue(automation.Id.Value, automation.ExportConfigurationAsJsonValue());
            }

            configuration.SetNamedValue("Automations", automations);

            return(configuration);
        }
Beispiel #2
0
        public static IRollerShutter[] GetAllRollerShutters(this IArea area)
        {
            if (area == null)
            {
                throw new ArgumentNullException(nameof(area));
            }

            return(area.Actuators <IRollerShutter>().ToArray());
        }