/// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            // Initialize HomeMatic API
            var ccu = new Ccu("Demo", "192.168.0.14");
            HomeMatic = new HomeMaticXmlApi(ccu);
        }
        public HomeMaticProgram(int id, bool active, string timeStamp, string name, string description, bool visible, bool operate, HomeMaticXmlApi homeMaticXmlApi)
        {
            Id = id;
            Active = active;
            TimeStamp = timeStamp;
            Name = name;
            Description = description;
            Visible = visible;
            Operate = operate;

            _HomeMaticXmlApi = homeMaticXmlApi;
        }
Пример #3
0
		/// <summary>
		/// Initialized the HomeControlService with or without a previously loaded Configuration instance
		/// </summary>
		/// <returns></returns>
		/// <param name="config">Configuration instance</param>
		public async Task InitAsync(Configuration config = null)
		{
			// Load config from SettingsService, if none has been provided
			if (config == null)
			{
				if (!_SettingsService.IsLoaded)
					await _SettingsService.LoadSettingsAsync();

				config = _SettingsService.Settings.Configuration;
			}

			// Load central units
			if (config.CentralUnits != null)
			{
				// HomeMatic
				var homeMaticCentral = config.CentralUnits.FirstOrDefault(c => c.Brand == Base.Models.CentralUnitBrand.HomeMatic);
				if (homeMaticCentral != null && homeMaticCentral is Ccu)
					HomeMatic = new HomeMaticXmlApi(homeMaticCentral as Ccu);
			}
		}
        private void RestoreSavedSettings()
        {
            // Restore IP-Address
            var ipAddress = Settings.Values["ipAddress"];
            if (ipAddress != null)
            {
                HomeMatic = new HomeMaticXmlApi(new Ccu("Demo", (string)ipAddress));
            }

            // Restore selected light id
            var selectedLightId = Settings.Values["selectedLightId"];
            if (selectedLightId != null)
            {
                SelectedLightId = (int)selectedLightId;                
            }
        }
Пример #5
0
 public Shutter(string name, int type, int iseId, string address, bool isVisible, HomeMaticXmlApi homeMaticXmlApi) : base(name, type, iseId, address, isVisible, homeMaticXmlApi)
 {
 }
        public static async Task InitHomeMatic(string address)
        {
            // Save address
            ApplicationData.Current.LocalSettings.Values["address"] = address;

            // Init API
            HomeMaticApi = new HomeMaticXmlApi(new Ccu("HomeMatic CCU", address));
            if (await HomeMaticApi.CheckConnectionAsync())
            {
                Channels.Clear();

                var devices = await HomeMaticApi.GetDevicesAsync();
                foreach(var device in devices)
                {
                    var homeMaticDevice = device as HomeMaticDevice;
                    foreach (var channel in homeMaticDevice.ChannelList)
                    {
                        Channels.Add(channel);
                    }
                }               
            }
            else
            {
                var dialog = new MessageDialog("Could not connect to your HomeMatic Central", "Connection Error");
                await dialog.ShowAsync();
            }
        }
 public TemperatureSlider(string name, int type, int iseId, string address, bool isVisible, HomeMaticXmlApi homeMaticXmlApi) : base(name, type, iseId, address, isVisible, homeMaticXmlApi)
 {
     MinValue = 6.0;
     MaxValue = 30.0;
 }