ESP-IDF v4.1 (with PlatformIO IDE)
No third-party dependencies
- Connecting to previous WiFi
- Reconnecting to WiFi using WPS
- HTTP Server for: web page admin panel, RESTful API and Digest Authentification
- NTP server for synchronize time
- Scheduler
- SPIFFS memory for saving all settings and schedule
You need to set a schedule for dispensing pills. This software allows to do this with an accuracy of a minute. You can also configure the following options:
- Start with… This option requires the date and time from when this task takes effect
- Repeat mode. This option has a next values: every day, every week, none. If option not equals "none", then after starting task setup new start time (depending on the selected option)
If you want to write on over a processing server or client application, then you can use the next API. For input and output data format use a JSON objects.
For all requests use Digest Authentification with only MD5 hashing. This API supported next errors status code:
Status code | Description |
---|---|
401 |
Unauthorized. This status returns, if your parameter "Authorization" in header not found or incorrect |
404 |
Not found. Check correct your request |
500 |
Internal server error. Maybe if your header very long or internal api error |
With the correct request or processing in all cases, returning 200
status code.
Attention! All PUT
request always response similar JSON with current values.
This setting shows current status dispensing hole. This is necessary if you want to lock up getting current pills.
GET
PUT
/api/lock
Request and response:
{ "enable": true }
This setting turns on the light after changing the sector with pills.
GET
PUT
/api/light
Request and response:
{ "enable": true }
This request is needed for getting current time on device. The value of time in seconds since 1970 January 1 00:00.
GET
/api/time
Response:
{ "time_sec": 1234 }
The value of time in seconds since 1970 January 1 00:00.
PUT
/api/time
Request (and response):
{ "time_sec": 1234 }
Get and setup url NTP server.
GET
PUT
/api/time/ntp
Request and response:
{ "name": "pool.ntp.org" }
Auto sync time with NTP every hour.
GET
PUT
/api/time/ntp/auto
Request and response:
{ "enable": true }
This method is necessary if you want to sync it with NTP right now.
POST
/api/time/ntp/sync
You can use this method to connect to a different access point or a non-WPS access point. After sending the request, the device tries to connect to the new access point and doesn't return a response.
PUT
/api/wifi
Request:
{
"ssid" : "MyWiFi",
"password" : "MySecretPassword"
}
This method returns current SSID access point.
GET
/api/wifi
Request:
{ "ssid" : "MyWiFi" }
If you want to change login and password for authentication, you can use this request. Your digest authentication must be invalid after this request is successfully completed.
PUT
/api/auth
Request:
{
"login" : "MyLogin",
"old_password" : "MySecretOldPassword",
"new_password" : "MySecretNewPassword"
}