So what I want the plugin to do and collect is as follows:
1 Store the IP address of the roomba.
2 Execute actions. Clean, dock, max, etc.
These actions follow a pattern like this :
- Code: Select all
http://ipaddress /command.json?command=clean
returns:
{
"action" : "clean",
"result" : "success
}
So after a command is executed the state should be updated accordingly, and a status should be polled.
3 Polling status from the roomba is also done with a http request that returns the status:
- Code: Select all
http://ipaddress/status.json returns:
{
"action" : "status",
"result" : "success",
"status" : {
“name” : “Thinking”,
"battery_charge" : 100,
"capacity" : "2696",
"cleaner_state" : "st_base_full",
"cleaning" : "0",
"schedule_serial_number" : “12”,
"near_homebase" : "0"
}
}
These values needs to be updated as states in the device in the plugin.
4 Periodically polling.
In order to pick up manual activation or other feedback from the roomba the device should be polled for status at set intervals. I am thinking that it should be polled more often when running that when in standby.
Since I am at best a beginner at this sort of programming, I am hoping that someone can point me in the right direction. Anyone has any sugestion for an existing plugin that I can get some ideas and inspiration from?