I don't know how to write this.
- Display the loading animation.
- Display date and time (including 24-hour and 12-hour clocks).
- Display the temperature and humidity of the sensor.
- Display weather information for a place (including temperature and humidity, wind level and direction, precipitation, atmospheric pressure).
- Display menus, submenus, and options (including transition animations).
- Display Wi-Fi connection status, data sync status and LED status.
- Upload sensor's temperature and humidity data.
- Synchronize network time and weather information.
- Synchronize user settings and system configuration.
- Download the firmware for update.
- Control the LED.
- Switch the main UI.
- Adjust user settings and system configuration.
- Control the LED.
- Simulate button clicks.
- Adjust user settings and system configuration.
- User settings and system configuration.
- Date and time.
This is the framework of this whole project.
- ESP8266 can get network time and weather infomation from API Server.
- Developer can upload the
firmware.bin
file to Web Server, and publish an upgrade message to MQTT Broker. Later ESP8266 receive the message and get the URL offirmware.bin
. - ESP can upload the data to MQTT Broker. And your devices(Phone, Computer...) can receive the data from MQTT Broker via Web Client(maybe Browser).
You can change them to your own topic in file 'desktopClock.h'.
There are default MQTT topic in the red box.
You also can change other default Settings in the blue box.
Generally, you do not need to send a message to this topic. Because it's just for test.
Massage properties | Value |
---|---|
Retain | false |
QoS | 0 |
JSON | Description | Required |
---|---|---|
wifiSSID | Wi-Fi SSID | yes |
wifiPASS | Wi-Fi Password | yes |
apiTimeUrl | Network Time API URL | yes |
apiWeatherUrl | Weather API URL | yes |
apiWeatherKey | Weather API Key | yes |
Example:
{
"wifiSSID": "Router-1234",
"wifiPASS": "mypassword",
"apiTimeUrl": "http://worldtimeapi.org/api/ip",
"apiWeatherUrl": "http://www.eflystudio.cn/api/weather.php",
"apiWeatherKey": "3264*********************608b"
}
Massage properties | Value |
---|---|
Retain | false |
QoS | 2 |
JSON | Description | Required |
---|---|---|
LED | LED Control. true : turn on; false : turn off. |
no |
BTN | Simulate button clicks. LS : Left Button Short Click; LL : Left Button Long Click; RS : Right Button Short Click; RL : Right Button Long Click. |
no |
Examples:
{
"LED": false,
"BTN": "LL"
}
{
"LED": false
}
{
"BTN": "LL"
}
Massage properties | Value |
---|---|
Retain | false |
QoS | 0 |
JSON | Description | Required |
---|---|---|
temp | Sensor temperature. (Unit is defined by weather.unit in topic esp_device/settings ) |
yes |
humi | Sensor humidity. (Unit: %) | yes |
Example:
{
"temp": 26.4,
"humi": 53
}
Massage properties | Value |
---|---|
Retain | true |
QoS | 0 |
JSON | Description | Required |
---|---|---|
datetime.is24 | true : 24-hour clock; false : 12-hour clock |
yes |
led.sensorOn | LED is controlled by SR602. true : yes; false : no. |
yes |
led.delayOffTime | Extend the LED ON time when no movement is detected. | yes |
led.buttonOnTime | LED ON time when it is turned on by button. (if is zero, it is only turned off by button or remote) | yes |
led.remoteOnTime | LED ON time when it is turned on by remote. (if is zero, it is only turned off by button or remote) | yes |
screen.sensorOn | Screen can be woken up by SR602. true : yes; false : no. |
yes |
screen.lockInterval | Screen off time when no action. | yes |
screen.scrollInterval | Screen scroll time when no action. | yes |
sync.dataSyncInterval | Sensor data synchronization interval. | yes |
sync.clockSyncInterval | Network time synchronization interval. | yes |
sync.weatherSyncInterval | Weather information synchronization interval. | yes |
weather.unit | Weather temperature and sensor temperature units.true : Celsius; false : Fahrenheit. |
yes |
weather.city | Get the weather information of weather.city . More about: Real-time Weather - API |
yes |
weather.cityID | Location ID of weather.city . More about: City Lookup - API |
yes |
Example:
{
"datetime": {
"is24": true
},
"led": {
"sensorOn": true,
"delayOffTime": 0,
"buttonOnTime": 5,
"remoteOnTime": 10
},
"screen": {
"sensorOn": false,
"lockInterval": 0,
"scrollInterval": 0
},
"sync": {
"dataSyncInterval": 0,
"clockSyncInterval": 15,
"weatherSyncInterval": 15
},
"weather": {
"unit": true,
"city": "Changchun",
"cityID": "101060101"
}
}
Massage properties | Value |
---|---|
Retain | true |
QoS | 0 |
JSON | Description | Required |
---|---|---|
online | Device online status. true : online; false : offline. |
yes |
Example:
{
"online": true
}
Massage properties | Value |
---|---|
Retain | false |
QoS | 2 |
JSON | Description | Required |
---|---|---|
forced | Force update immediately. true : yes; false : no. |
yes |
version | The version of latest firmware. | yes |
upgradeUrl | URL of latest firmware. | yes |
Example:
{
"forced": false,
"version": 1304,
"upgradeUrl": "http://www.eflystudio.cn/firmware.bin",
}
Massage properties | Value |
---|---|
Retain | false |
QoS | 0 |
JSON | Description | Required |
---|---|---|
online | Server online status. true : online; false : offline. Data is sent to topic esp_device/data only when the server is online. |
yes |
Example:
{
"online": false
}
Your don't necessarily need a Web Server, as long as you can surely that ESP8266 can get the fireware.bin
file through the URL. (only support HTTP protocol).
Publish an upgrade message to MQTT Broker.
Example:
{
"forced": false,
"version": 1306,
"upgradeUrl": "http://example.com/example.bin",
}
if forced
is true, it will auto upgrade immediately when ESP8266 receive this message.
if forced
is false, you can select System->upgrade
to upgrade manually.
You can get the source code of this web from here.
I've removed the API Key. So, you may need to apply for your own API Key from here
default MQTT Broker Host: www.eflystudio.cn
default MQTT Broker Port: 1883
Any color should be ok.
2 * buttons
- Arduino with ESP8266 Development environment
- Visual Studio Code (unessential, but recommended)