Controlling ESP8266 through API automatically

hi, I have made some APIs which will let user select a device as a specific appliance to be controlled, this selection will send device's IP and MAC address on the API.
I want to control this device automatically, for example, through a schedule.
So if schedule says the device should be turned on from 10:00am to 10:30am, the device should automatically do this.
What is the best way to do this?
I am out of ideas.

is it a specific service (like a light bulb connected to the ESP8266) that needs to be activated on schedule or do you need the ESP to be fully turned off outside the scheduled window?

no a specific appliance(e.g. Fridge) on let's say Digital Pin 5

do you have an API to remotely activate a service?
does the specific appliance need to be self sufficent?

you need to clarify the requirements

what does it mean to remotely activate a service?
My APIs for now are locally hosted and are connected to ESP.
What do you mean by appliance being self-sufficient?

I might have misunderstood

My understanding was that

  • your have an arduino exposing an API which is advertising that a device is available (say it's a Heater).
  • This API is used by another arduino, a master controller

my questions were

  • does the API allows for triggering command (turn Heater on, turn Heater off, reach 22° and then goes off, ...)
  • do you want to controller to tell the Heater "this is your schedule, from Monday to Friday maintain 19°C during the day and 17° at night and only 15° over the week end" and then the heater does not need the controller any more?

right, the thing is I want ideas on how I can achieve this functionality.
I will explain it again:
I want my appliances to be controlled through an API, this API can be modified to suit my personal needs.
I have a database at the backend which stores the IP address of the device and MAC address as well. It also has a column for status ON/OFF.
I want to implement a schedule for a single day, which will be updated every day.
The schedule will give the starting and ending times.
I want to achieve this functionality, and I want some ideas.
one thing I can do is check for api's response in a loop and control appliances through "Status".
But I think this can waste resources.
If I am wrong, correct me or if there's something better I can do, that can be really helpful.

you have at least two options

1/ you have a command language that lets you upload the schedule from the master to the devices, then the devices are self sufficient and just follow the schedule

2/ the devices are "dumb" and can only follow simple orders like ON or OFF and possibly provide some sensor state. Then it's up to the master controller to manage the schedule

I think I have got an idea now, I am enabling devices to make GET requests to APIs probably every 10 minutes, and get the schedule and then the device can control it's pin according to the schedule.
Thanks for the help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.