Class State
- Namespace
- OverKizApi.Models
- Assembly
- OverKizApi.dll
A named state value reported by a device (e.g. "core:ClosureState" = 50).
Use Type to determine the appropriate typed accessor.
public sealed class State
- Inheritance
-
State
- Inherited Members
Properties
Name
Qualified state name (e.g. "core:ClosureState").
[JsonPropertyName("name")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Name { get; init; }
Property Value
- string
Qualified state name (e.g.
"core:ClosureState").
Type
Discriminator that identifies the CLR type of Value.
[JsonPropertyName("type")]
public DataType Type { get; init; }
Property Value
Value
Vendor-defined value represented by CLR primitives, lists or dictionaries. Use the typed accessors where possible.
[JsonPropertyName("value")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonConverter(typeof(DeviceValueConverter))]
public object? Value { get; init; }
Property Value
- object
Vendor-defined value represented by CLR primitives, lists or dictionaries. Use the typed accessors where possible.
ValueAsBool
[JsonIgnore]
public bool? ValueAsBool { get; }
Property Value
Exceptions
ValueAsDict
Returns an object state as CLR dictionary values, or null when no value is present.
[JsonIgnore]
public IReadOnlyDictionary<string, object?>? ValueAsDict { get; }
Property Value
- IReadOnlyDictionary<string, object>
Returns an object state as CLR dictionary values, or null when no value is present.
Exceptions
- InvalidCastException
The state is not an object.
ValueAsFloat
Returns the value as double, or null when Type is None. Integer states are promoted to double automatically.
[JsonIgnore]
public double? ValueAsFloat { get; }
Property Value
- double?
Returns the value as double, or null when Type is None. Integer states are promoted to double automatically.
Exceptions
ValueAsInt
[JsonIgnore]
public int? ValueAsInt { get; }
Property Value
Exceptions
ValueAsList
Returns an array state as CLR list values, or null when no value is present.
[JsonIgnore]
public IReadOnlyList<object?>? ValueAsList { get; }
Property Value
- IReadOnlyList<object>
Returns an array state as CLR list values, or null when no value is present.
Exceptions
- InvalidCastException
The state is not an array.
ValueAsStr
[JsonIgnore]
public string? ValueAsStr { get; }