public bool PushDeviceStatusUpdate(InsteonDevice device, InsteonDeviceStatus status)
        {
            //note: because the parent caller of this event is an InsteonDevice which is processing a current message received event, it's not been "reset" and we cannot
            //make a call to GetOnLevel for dimmable devices as no response will be handled. We must "ask" ST to make another rest call to obtain current state. All we can 
            //do here is tell it there is an update.

            string path = $"{rootPath}deviceupdate/{device.Address}/{status}";
            var request = new RestRequest(path, Method.PUT) { RequestFormat = DataFormat.Json };

            request.AddQueryParameter("access_token", settings.AccessToken);

            var response = client.Execute(request);

            logger.InfoFormat("Content Returend from ST: {0}", response.Content);
            return response.Content.Contains("ok");
        }
 protected void OnDeviceStatusChanged(InsteonDeviceStatus status)
 {
     DeviceStatusChanged?.Invoke(this, new InsteonDeviceStatusChangedEventArgs(this, status));
     network.Devices.OnDeviceStatusChanged(this, status);
 }
 internal InsteonDeviceStatusChangedEventArgs(InsteonDevice device, InsteonDeviceStatus status)
 {
     this.Device = device;
     this.DeviceStatus = status;
 }
Example #4
0
 public static string GetDeviceStatusDisplayName(InsteonDeviceStatus status)
 {
     switch (status)
     {
         case InsteonDeviceStatus.On:        return "On";
         case InsteonDeviceStatus.Off:       return "Off";
         case InsteonDeviceStatus.FastOn:    return "Fast On";
         case InsteonDeviceStatus.FastOff:   return "Fast Off";
         case InsteonDeviceStatus.Brighten:  return "Brighten";
         case InsteonDeviceStatus.Dim:       return "Dim";
         default:                            return "Unknown";
     }            
 }
Example #5
0
 private void OnDeviceStatusChanged(InsteonDeviceStatus status)
 {
     if (this.DeviceStatusChanged != null)
         this.DeviceStatusChanged(this, new InsteonDeviceStatusChangedEventArgs(this, status));
     this.network.Devices.OnDeviceStatusChanged(this, status);
 }