-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSON_formats.txt
More file actions
120 lines (105 loc) · 2.73 KB
/
JSON_formats.txt
File metadata and controls
120 lines (105 loc) · 2.73 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
/* JSON formats:
- From browser to MCU
- browser request system time from MCU
{
'type': 'time'
}
- browser request status update from MCU
{
'type': 'status'
}
- browser request auto enable setting from MCU
{
'type': 'auto_enable'
}
- browser request settings from MCU
{
'type': 'settings'
}
- change time from browser
{
'type': 'chg_time',
'year': int,
'month': int,
'day': int,
'hour': int,
'minute': int,
'second': int
}
- Toggle the automatic relay timer. Enabling the automatic relay timer will enable
the daily relay timeslots, and disabling the automatic relay timer will simply
disable the daily relay timeslots so the only time the relay closes is if the user
manually toggles the momentary relay button on the webpage or the physical button.
This command is sent by the browser right away after the user toggles the automatic
toggle.
{
'type': 'chg_auto_enable',
'auto_enabled': bool
}
- sending updated settings from browser to MCU
{
'type': 'chg_settings',
'timeslots': array of 3 bytes representing the three bytes stored in EEPROM,
'duration': int from 0 to 60,
'gmt_offset': int from -12 to 12,
'use_ntp': bool
}
- send command from browser to enable the relay momentarily for the saved duration.
{
'type': 'relay',
'relay_status': bool
}
- browser request indicator light behavior from MCU
{
'type': 'led'
}
- browser set indicator light behavior to MCU
{
'type': 'chg_led',
'led_mode': int (0 - off, 1 - steady on, 2 - blink)
}
- From MCU to browser
- sending system time from MCU to browser
{
'type': 'time',
'year': int,
'month': int from 1-12,
'day': int from 1-31,
'hour': int from 0-23,
'min': int from 0-59,
'sec': int from 0-59
}
- sending relay status from MCU to browser
{
'type': 'status',
'relay_status': bool,
}
- sending auto enable setting from MCU to browser
{
'type': 'auto_enable',
'auto_enabled': bool,
}
- sending current settings from MCU to browser
{
'type': 'settings',
'timeslots': array of 3 bytes representing the three bytes stored in EEPROM,
'duration': int from 0 to 60,
'gmt_offset': int from -12 to 12,
'use_ntp': bool
}
<<<<<<< HEAD
=======
- MCU send indicator light behavior to browser
{
'type': 'led',
'led_mode': int (0 - off, 1 - steady on, 2 - blink)
}
>>>>>>> testing
*/
Arduino Cloud widgets
pushbutton - close/open relay temporarily
switch - enable/disable automatic timer
slider - input for relay duration
number - input for max relay duration
schedule - input for daily schedule to enable pump
LED - indicator LED