-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwidget.dart
More file actions
134 lines (102 loc) · 2.61 KB
/
widget.dart
File metadata and controls
134 lines (102 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
part of '../models.dart';
@JsonEnum(alwaysCreate: true)
enum RenderWidget {
/// Temperature display (°C)
@JsonValue('THERMOMETER')
thermometer,
/// Humidity display (%)
@JsonValue('HUMIDITY')
humidity,
/// Magnet sensor state display
@JsonValue('MAGNET_SENSOR')
magnetSensor,
/// Magnet sensor count display
@JsonValue('MAGNET_COUNT')
magnetCount,
/// Accelerometer display
@JsonValue('ACCELERATION')
accelerometer,
/// Atmospheric Pressure display (hPa)
@JsonValue('PRESSURE')
pressure,
/// Illuminance display (lux)
@JsonValue('ILLUMINANCE')
illuminance,
/// Air Quality / CO2 display
@JsonValue('AIR_QUALITY')
airQuality,
/// Battery level display (%)
@JsonValue('BATTERY')
battery,
/// Renders a Link Quality (LQI) display
@JsonValue('LINK_QUALITY')
linkQuality,
/// On/Off state display
@JsonValue('BINARY_SENSOR')
binarySensor,
/// Presence indicator
@JsonValue('PRESENCE')
presence,
/// Presence count display
@JsonValue('PRESENCE_COUNT')
presenceCount,
/// Touch button state
@JsonValue('TOUCH')
touch,
/// Touch button count display
@JsonValue('TOUCH_COUNT')
touchCount,
/// On/Off switch control (toggable)
@JsonValue('SWITCH')
switch_,
/// Dimmer slider control (0-100%)
@JsonValue('DIMMER')
dimmer,
/// Renders a Color Temperature slider
@JsonValue('COLOR_TEMPERATURE')
colorTemperature,
/// Setpoint control
@JsonValue('SETPOINT')
setpoint,
/// Fan speed control (rpm)
@JsonValue('FAN_SPEED')
fanSpeed,
/// RBG Color Picker control
@JsonValue('COLOR_PICKER')
colorPicker,
/// Renders a Mode Selector (list of modes, only one can be active)
@JsonValue('MODE_SELECTOR')
modeSelector,
/// Renders a Scene Selector
@JsonValue('SCENE_SELECTOR')
sceneSelector,
/// Renders a Cover/Blind control (open, close, stop, position)
@JsonValue('COVER')
cover,
/// Renders a Lock/Unlock control
@JsonValue('LOCK')
lock,
/// Renders a Power display (Watts)
@JsonValue('POWER_METER')
powerMeter,
/// Renders an Energy display (kWh)
@JsonValue('ENERGY_METER')
energyMeter,
/// Renders a Voltage display (V)
@JsonValue('VOLTAGE')
voltage,
/// Renders a Current display (A)
@JsonValue('CURRENT')
current,
/// Unknown render widget
@JsonValue('UNKNOWN')
unknown,
;
@override
String toString() => toJson();
String toJson() => _$RenderWidgetEnumMap[this] ?? 'UNKNOWN';
static RenderWidget fromJson(String json) {
final found = _$RenderWidgetEnumMap.entries.firstWhereOrNull((e) => e.value == json);
return found?.key ?? RenderWidget.unknown;
}
}