[NF] Huebot fertig
[NF] Huebot nutzt nun die lokale litjosn und mqtt library
This commit is contained in:
		
							parent
							
								
									4178079f4d
								
							
						
					
					
						commit
						da8ffeeffc
					
				| @ -44,7 +44,7 @@ namespace BlubbFish.IoT.Hue.Devices.Lights { | ||||
|         return this._alert; | ||||
|       } | ||||
|       set { | ||||
|         if(this.SetLightStateAttribute(new Dictionary<String, Object>() { { "alert", value } })) { | ||||
|         if(this.SetLightStateAttribute(new Dictionary<String, Object>() { { "alert", value.ToString() } })) { | ||||
|           this._alert = value; | ||||
|           this.NotifyClient<LightUpdateEvent>(value); | ||||
|         } | ||||
|  | ||||
| @ -62,6 +62,22 @@ namespace BlubbFish.IoT.Hue  { | ||||
|       //throw new NotImplementedException(); | ||||
|     } | ||||
| 
 | ||||
|     public AConnector GetConnector(String type, String id) { | ||||
|       switch (type) { | ||||
|         case "sensor": | ||||
|           return this.Sensors.ContainsKey(Int32.Parse(id)) ? this.Sensors[Int32.Parse(id)] : null; | ||||
|         case "scene": | ||||
|           return this.Scenes.ContainsKey(id) ? this.Scenes[id] : null; | ||||
|         case "light": | ||||
|           return this.Lights.ContainsKey(Int32.Parse(id)) ? this.Lights[Int32.Parse(id)] : null; | ||||
|         case "group": | ||||
|           return this.Groups.ContainsKey(Int32.Parse(id)) ? this.Groups[Int32.Parse(id)] : null; | ||||
|         case "config": | ||||
|           return this.Config; | ||||
|       } | ||||
|       return null; | ||||
|     } | ||||
| 
 | ||||
|     private void AllUpdate(Object sender, AllUpdateEvent e) { | ||||
|       this.Update?.Invoke(sender, e); | ||||
|     } | ||||
|  | ||||
| @ -1,8 +1,5 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using BlubbFish.IoT.Hue.Devices.Configs; | ||||
| using BlubbFish.IoT.Hue.lib; | ||||
| using LitJson; | ||||
|  | ||||
| @ -176,7 +176,7 @@ namespace BlubbFish.IoT.Hue.Interfaces { | ||||
|     } | ||||
| 
 | ||||
|     public String MqttTopic() { | ||||
|       return "groups/" + this.GroupId + "/" + this.Groupclass.ToString(); | ||||
|       return "group/" + this.GroupId; | ||||
|     } | ||||
|     #endregion | ||||
|   } | ||||
|  | ||||
| @ -79,7 +79,7 @@ namespace BlubbFish.IoT.Hue.Interfaces { | ||||
| 
 | ||||
|     #region IMqtt | ||||
|     public String MqttTopic() { | ||||
|       return "lights/" + this.LightId + "/" + this.Lightclass.ToString(); | ||||
|       return "light/" + this.LightId; | ||||
|     } | ||||
| 
 | ||||
|     public String ToJson() { | ||||
|  | ||||
| @ -36,7 +36,7 @@ namespace BlubbFish.IoT.Hue.Interfaces { | ||||
|     } | ||||
| 
 | ||||
|     public String MqttTopic() { | ||||
|       return "groups/" + this.SceneId; | ||||
|       return "scene/" + this.SceneId; | ||||
|     } | ||||
|     #endregion | ||||
|   } | ||||
|  | ||||
| @ -6,8 +6,6 @@ using LitJson; | ||||
| 
 | ||||
| namespace BlubbFish.IoT.Hue.Interfaces { | ||||
|   public abstract class ASensor : AConnector, IMqtt { | ||||
|      | ||||
| 
 | ||||
|     public enum Types { | ||||
|       Daylight | ||||
|     } | ||||
| @ -116,7 +114,7 @@ namespace BlubbFish.IoT.Hue.Interfaces { | ||||
| 
 | ||||
|     #region IMqtt | ||||
|     public String MqttTopic() { | ||||
|       return "groups/" + this.SensorId + "/" + this.Sensorclass.ToString(); | ||||
|       return "sensor/" + this.SensorId; | ||||
|     } | ||||
| 
 | ||||
|     public String ToJson() { | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user