netdaemon
netdaemon copied to clipboard
ProximityEntity state should be numeric
Problem: State for ProximityEntity is a string
On the contrary, it is always measured in km, miles or other distance units.
Solution: Alter Code Generator
Use NumericEntityState
to define ProximityEntity
:
public record ProximityEntity : Entity<ProximityEntity, NumericEntityState<ProximityAttributes>, ProximityAttributes>
More Info
Reference: Proximity Integration
I guess we need to handle proximity separately in codegen @FrankBakkerNl ?
We basically have 3 types of domains now 1 always string (default) 2 always numeric, like input_number 3 only numeric if there is a unit of measurement attribute
Which of these would fit best here?
I would vote for 3, since unit_of_measurement
is optional, but if not set, it is considered km
and added by default to the state attributes.
Another one: CounterEntity
state should also be numeric. Basically it's just an input_number
where the value cannot be set but can be incremented, decremented or reset.
CounterEntity
will fit best in the 2nd category.
Reference: Counter Integration
public partial record CounterEntity : Entity<CounterEntity, NumericEntityState<CounterAttributes>, CounterAttributes>