public override void Configure(Container container)
        {
            JsConfig.EmitCamelCaseNames = true;
            Plugins.Add(new SwaggerFeature());
            var manager = new InsteonManager(insteonSource);
            container.Register(manager);
            var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Insteon"));
            var mySettings = settingsProvider.GetSettings<SmartThingsSettings>();

            container.Register(mySettings);

            manager.Network.Devices.DeviceStatusChanged += (sender, data) =>
            {
                logger.DebugFormat("{0}:{1}", data.Device.Address, data.DeviceStatus);
                var settings = container.Resolve<SmartThingsSettings>();
                var cb = new SmartThingsCallbacks(settings);
                cb.PushDeviceStatusUpdate(data.Device, data.DeviceStatus);
            };

            GlobalResponseFilters.Add((req, res, dto) =>
            {

                res.AddHeader("X-Insteon", ServiceName);

            });

            manager.Connect();

        }
        public ResponseStatus Put(SmartThingsSettingsRequest request)
        {
            settings.AccessToken   = request.AccessToken;
            settings.Location      = request.Location;
            settings.ApplicationId = request.AppId;

            var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Insteon"));

            settingsProvider.SaveSettings(settings);

            var cb = new SmartThingsCallbacks(settings);

            return(!cb.Authorization() ? new InsteonServiceResponse("404", "Couldn't connect to ST hub") : new InsteonServiceResponse());
        }
        public ResponseStatus Get(SmartThingsSettingsResetRequest request)
        {
            settings.AccessToken   = null;
            settings.Location      = null;
            settings.ApplicationId = null;

            var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Insteon"));

            settingsProvider.SaveSettings(settings);

            var cb = new SmartThingsCallbacks(settings);

            return(!cb.AuthorizationRevoke() ? new ResponseStatus("404", "Couldn't connect to ST hub") : new ResponseStatus());
        }
        public ResponseStatus Put(SmartThingsSettingsRequest request)
        {
            settings.AccessToken = request.AccessToken;
            settings.Location = request.Location;
            settings.ApplicationId = request.AppId;

            var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Insteon"));
            settingsProvider.SaveSettings(settings);

            var cb = new SmartThingsCallbacks(settings);

            return !cb.Authorization() ? new InsteonServiceResponse("404", "Couldn't connect to ST hub") : new InsteonServiceResponse();
        }
        public ResponseStatus Get(SmartThingsSettingsResetRequest request)
        {
            settings.AccessToken = null;
            settings.Location = null;
            settings.ApplicationId = null;

            var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Insteon"));
            settingsProvider.SaveSettings(settings);

            var cb = new SmartThingsCallbacks(settings);

            return !cb.AuthorizationRevoke() ? new ResponseStatus("404", "Couldn't connect to ST hub") : new ResponseStatus();
        }