Skip to content

Commit c4c570f

Browse files
Fix #715, ProximityEntity with numeric state (#822)
Co-authored-by: Tomas Hellström <[email protected]>
1 parent 144b0ce commit c4c570f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/HassModel/NetDaemon.HassModel.CodeGenerator/Helpers/EntityIdHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
internal static class EntityIdHelper
44
{
5-
public static readonly string[] NumericDomains = { "input_number", "number" };
5+
public static readonly string[] NumericDomains = { "input_number", "number", "proximity" };
66
public static readonly string[] MixedDomains = { "sensor" };
77

88
public static string GetDomain(string str)

src/HassModel/NetDaemon.HassModel.Tests/CodeGenerator/CodeGeneratorTest.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ public void TestNumericSensorEntityGeneration()
8181
new()
8282
{
8383
EntityId = "sensor.Pir",
84+
},
85+
new()
86+
{
87+
EntityId = "proximity.home",
8488
},
8589
};
8690

@@ -106,6 +110,9 @@ public void Run(IHaContext ha)
106110
107111
SensorEntity pirSensor = entities.Sensor.Pir;
108112
string? pir = pirSensor.State;
113+
114+
ProximityEntity homeProximity = entities.Proximity.Home;
115+
double? distance = homeProximity.State;
109116
}
110117
}
111118
""";

0 commit comments

Comments
 (0)