Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

Commit

Permalink
Beta 24
Browse files Browse the repository at this point in the history
Fixed:
- Bug in the rule creator that wasn't converting uint values
- Bug in the rule creator that allowed a null property and value to be added to action causing an exception.
- Bug in Bridge Detection Windows not adding detected bridge to the list.
- Bug where the serializer in HueLib2 wasn't able to deserialize a Timer value in the ScheduleBody.
- Bug where the temperature value was not nullable.

Added:
- Resource link bridge object are now listed in the main windows.
- Added a custom install path to the installer.

Changed:
- All items in the listview are now aligning to the top.
- Begin conversion to real MVVM paradigm using prism.

Temporary
- Disabled the automatic refresh of bridge object that causes collapse of the property grid.

WIP:
- Animation creator. (Not Available yet)
- Rss feed monitor plugin. (Not Available yet)
- Clapper monitor. (Not Available yet)
- Resource Link Creator (Not Available yet)
  • Loading branch information
Hyrules committed Dec 16, 2016
1 parent 4cbb9ae commit f5d379e
Show file tree
Hide file tree
Showing 99 changed files with 1,204 additions and 649 deletions.
3 changes: 3 additions & 0 deletions HueLib2/Bridge/Objects/DataStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public class DataStore
[DataMember(EmitDefaultValue = false, IsRequired = false)]
public Dictionary<string, Rule> rules { get; set; }

[DataMember(EmitDefaultValue = false, IsRequired = false)]
public Dictionary<string, Resourcelink> resourcelinks { get; set; }

public override string ToString()
{
return Serializer.SerializeToJson(this);
Expand Down
34 changes: 28 additions & 6 deletions HueLib2/Objects/Resourcelinks/Resourcelink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,56 @@ namespace HueLib2
[DefaultProperty("Resource Links"), DataContract]
public class Resourcelink : HueObject
{
private string _name;

/// <summary>
/// Name of the resource link
/// </summary>
[DataMember(EmitDefaultValue = false, IsRequired = false), Category("Resource Link"), Description("Name of the resource link"), HueLib(true, true)]
public string name { get; set; }
[DataMember(EmitDefaultValue = false, IsRequired = false), Category("Resource Link"),
Description("Name of the resource link"), HueLib(true, true)]
public string name
{
get
{
return _name;
}
set { _name = value; OnPropertyChanged(); }
}

/// <summary>
/// Description of the resource link
/// </summary>
[DataMember(EmitDefaultValue = false, IsRequired = false), Category("Resource Link"), Description("Description of the resource link"), HueLib(true, true)]
public string description { get; set; }

/// <summary>
/// Type of Resource Link
/// </summary>
[DataMember(EmitDefaultValue = false, IsRequired = false), Category("Resource Link"), Description("Type of the resource link"), HueLib(false, false)]
public string type { get; set; }

/// <summary>
/// Class of the resource link
/// </summary>
[DataMember(EmitDefaultValue = false, IsRequired = false), Category("Resource Link"), Description("Class of the resource link"), HueLib(false, false)]
public int @class { get; set; }
[DataMember(EmitDefaultValue = false, IsRequired = false), Category("Resource Link"), Description("Class of the resource link"), HueLib(true, true)]
public int classid { get; set; }

/// <summary>
/// Owner of the resource link
/// </summary>
[DataMember(EmitDefaultValue = false, IsRequired = false), Category("Resource Link"), Description("Owner of the resource link"),HueLib(true, false)]
[DataMember(EmitDefaultValue = false, IsRequired = false), Category("Resource Link"), Description("Owner of the resource link"),HueLib(false, false)]
public string owner { get; set; }

/// <summary>
/// Owner of the resource link
/// </summary>
[DataMember(EmitDefaultValue = false, IsRequired = false), Category("Resource Link"), Description("Allow Recycle of the resource link"), HueLib(true, true)]
public string recycle { get; set; }

/// <summary>
/// List of resource links
/// </summary>
[DataMember(EmitDefaultValue = false, IsRequired = false), Category("Resource Link"), Description("List of resource links"),ExpandableObject, HueLib(true, false)]
[DataMember(EmitDefaultValue = false, IsRequired = false), Category("Resource Link"), Description("List of resource links"), Browsable(false), HueLib(true, false)]
public List<string> links { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public class TemperatureSensorState : SensorState
/// Current temperature.
/// </summary>
[DataMember,HueLib(false,false)]
public int temperature { get; set; }
public int? temperature { get; set; }
}
}
57 changes: 31 additions & 26 deletions HueLib2/Objects/Sensor/Sensor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ public class SensorJsonConverter : JsonConverter
/// <returns></returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{

JObject obj = (JObject)serializer.Deserialize(reader);

if (objectType == typeof(Dictionary<string, Sensor>))
{
Dictionary<string, Sensor> sensorslist = new Dictionary<string, Sensor>();
Expand Down Expand Up @@ -169,92 +167,99 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
private Sensor SetConfigState(Sensor sensor, JObject config, JObject state)
{


JsonSerializerSettings jss = new JsonSerializerSettings()
{
NullValueHandling = NullValueHandling.Ignore,
StringEscapeHandling = StringEscapeHandling.Default
};

switch (sensor.type)
{
case "ZGPSwitch":
if (state != null)
{
sensor.state = JsonConvert.DeserializeObject<HueTapSensorState>(state.ToString());
sensor.config = JsonConvert.DeserializeObject<HueTapSensorConfig>(config.ToString());
sensor.state = JsonConvert.DeserializeObject<HueTapSensorState>(state.ToString(),jss);
sensor.config = JsonConvert.DeserializeObject<HueTapSensorConfig>(config.ToString(),jss);
}
break;
case "Daylight":
if (state != null)
{
sensor.state = JsonConvert.DeserializeObject<DaylightSensorState>(state.ToString());
sensor.config = JsonConvert.DeserializeObject<DaylightSensorConfig>(config.ToString());
sensor.state = JsonConvert.DeserializeObject<DaylightSensorState>(state.ToString(),jss);
sensor.config = JsonConvert.DeserializeObject<DaylightSensorConfig>(config.ToString(),jss);
}
break;
case "CLIPPresence":
if (state != null)
{
sensor.state = JsonConvert.DeserializeObject<ClipPresenceSensorState>(state.ToString());
sensor.config = JsonConvert.DeserializeObject<ClipPresenceSensorConfig>(config.ToString());
sensor.state = JsonConvert.DeserializeObject<ClipPresenceSensorState>(state.ToString(),jss);
sensor.config = JsonConvert.DeserializeObject<ClipPresenceSensorConfig>(config.ToString(),jss);
}
break;
case "CLIPGenericFlag":
if (state != null)
{
sensor.state = JsonConvert.DeserializeObject<ClipGenericFlagSensorState>(state.ToString());
sensor.config = JsonConvert.DeserializeObject<ClipGenericFlagSensorConfig>(config.ToString());
sensor.state = JsonConvert.DeserializeObject<ClipGenericFlagSensorState>(state.ToString(),jss);
sensor.config = JsonConvert.DeserializeObject<ClipGenericFlagSensorConfig>(config.ToString(),jss);
}
break;
case "CLIPGenericStatus":
if (state != null)
{
sensor.state = JsonConvert.DeserializeObject<ClipGenericStatusState>(state.ToString());
sensor.config = JsonConvert.DeserializeObject<ClipGenericStatusSensorConfig>(config.ToString());
sensor.state = JsonConvert.DeserializeObject<ClipGenericStatusState>(state.ToString(),jss);
sensor.config = JsonConvert.DeserializeObject<ClipGenericStatusSensorConfig>(config.ToString(),jss);
}
break;
case "CLIPHumidity":
if (state != null)
{
sensor.state = JsonConvert.DeserializeObject<ClipHumiditySensorState>(state.ToString());
sensor.config = JsonConvert.DeserializeObject<ClipHumiditySensorConfig>(config.ToString());
sensor.state = JsonConvert.DeserializeObject<ClipHumiditySensorState>(state.ToString(),jss);
sensor.config = JsonConvert.DeserializeObject<ClipHumiditySensorConfig>(config.ToString(),jss);
}
break;
case "CLIPOpenClose":
if (state != null)
{
sensor.state = JsonConvert.DeserializeObject<ClipOpenCloseSensorState>(state.ToString());
sensor.config = JsonConvert.DeserializeObject<ClipOpenCloseSensorConfig>(config.ToString());
sensor.state = JsonConvert.DeserializeObject<ClipOpenCloseSensorState>(state.ToString(),jss);
sensor.config = JsonConvert.DeserializeObject<ClipOpenCloseSensorConfig>(config.ToString(),jss);
}
break;
case "ZLLTemperature":
case "CLIPTemperature":
if (state != null)
{
sensor.state = JsonConvert.DeserializeObject<TemperatureSensorState>(state.ToString());
sensor.config = JsonConvert.DeserializeObject<TemperatureSensorConfig>(config.ToString());
sensor.state = JsonConvert.DeserializeObject<TemperatureSensorState>(state.ToString(),jss);
sensor.config = JsonConvert.DeserializeObject<TemperatureSensorConfig>(config.ToString(),jss);
}
break;
case "ZLLSwitch":
if (state != null)
{
sensor.state = JsonConvert.DeserializeObject<HueDimmerSensorState>(state.ToString());
sensor.config = JsonConvert.DeserializeObject<HueDimmerSensorConfig>(config.ToString());
sensor.state = JsonConvert.DeserializeObject<HueDimmerSensorState>(state.ToString(),jss);
sensor.config = JsonConvert.DeserializeObject<HueDimmerSensorConfig>(config.ToString(),jss);
}
break;
case "ZLLPresence":
if (state != null)
{
sensor.state = JsonConvert.DeserializeObject<HueMotionSensorState>(state.ToString());
sensor.config = JsonConvert.DeserializeObject<HueMotionSensorConfig>(config.ToString());
sensor.state = JsonConvert.DeserializeObject<HueMotionSensorState>(state.ToString(),jss);
sensor.config = JsonConvert.DeserializeObject<HueMotionSensorConfig>(config.ToString(),jss);
}
break;
case "CLIPLightlevel":
case "ZLLLightLevel":
if (state != null)
{
sensor.state = JsonConvert.DeserializeObject<LightLevelState>(state.ToString());
sensor.config = JsonConvert.DeserializeObject<LightLevelConfig>(config.ToString());
sensor.state = JsonConvert.DeserializeObject<LightLevelState>(state.ToString(),jss);
sensor.config = JsonConvert.DeserializeObject<LightLevelConfig>(config.ToString(),jss);
}
break;
default:
if (state != null)
{
sensor.state = JsonConvert.DeserializeObject<SensorState>(state.ToString());
sensor.config = JsonConvert.DeserializeObject<SensorConfig>(config.ToString());
sensor.state = JsonConvert.DeserializeObject<SensorState>(state.ToString(),jss);
sensor.config = JsonConvert.DeserializeObject<SensorConfig>(config.ToString(),jss);
}
break;

Expand Down
1 change: 1 addition & 0 deletions HueLib2Test/HueLib2Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down
2 changes: 1 addition & 1 deletion HueLib2Test/UnitTest1.cs

Large diffs are not rendered by default.

22 changes: 13 additions & 9 deletions WinHue3/App.config
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="WinHue3.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xceed.Wpf.Toolkit" publicKeyToken="3e4669d2f30244f4" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.5.0.0" newVersion="2.5.0.0"/>
<assemblyIdentity name="Xceed.Wpf.Toolkit" publicKeyToken="3e4669d2f30244f4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.0.0" newVersion="2.5.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xceed.Wpf.AvalonDock" publicKeyToken="3e4669d2f30244f4" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0"/>
<assemblyIdentity name="Xceed.Wpf.AvalonDock" publicKeyToken="3e4669d2f30244f4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.ServiceLocation" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
45 changes: 0 additions & 45 deletions WinHue3/Forms/Form_Daylight.xaml.cs

This file was deleted.

Loading

0 comments on commit f5d379e

Please sign in to comment.