Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void TestConvertionWithNumericValue()
""connections"": [],
""manufacturer"": ""Google Inc."",
""model"": 123123,
""name"": ""My TV"",
""name"": 123,
""sw_version"": null,
""id"": ""42cdda32a2a3428e86c2e27699d79ead"",
""via_device_id"": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ public record HassDevice
[JsonPropertyName("manufacturer")] public string? Manufacturer { get; init; }

[JsonPropertyName("model")]
[JsonConverter(typeof(HassDeviceModelConverter))]
[JsonConverter(typeof(ReadNumberAsStringConverter))]
public string? Model { get; init; }

[JsonPropertyName("id")] public string? Id { get; init; }

[JsonPropertyName("area_id")] public string? AreaId { get; init; }

[JsonConverter(typeof(ReadNumberAsStringConverter))]
[JsonPropertyName("name")] public string? Name { get; init; }

[JsonPropertyName("name_by_user")] public string? NameByUser { get; init; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace NetDaemon.Client.Internal.Json;

internal class HassDeviceModelConverter : JsonConverter<string>
internal class ReadNumberAsStringConverter : JsonConverter<string>
{
public override string? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
Expand Down