README.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // ) )
  2. // / / __ ___ _ __ ( ) ___
  3. // / // / / // ) ) // ) ) // ) ) ) ) / / // ) )
  4. // / ((___/ / // / / // / / // / / / / / / //
  5. //____/ / / / // / / ((___( ( // / / / / / / ((____
  6. =================================================================
  7. Home Dynamic - Home Automation System
  8. # Introduction
  9. Home Dynamic is a fully automated Open Source Home Automation Control Hub.
  10. Home dynamic provide full scanning of in range IoT devices with custom protocol.
  11. # ESP8266 Protocol
  12. ## Basic Requirement
  13. The ESP8266 Wifi IoT Module (ESP) can be used with Home Dynamic Module.
  14. In the code of the ESP, there are custom API that needed to be provided for the
  15. Home Dynamic Module for ESP connection and identification.
  16. The minimal structure is as follow:
  17. 1. <ip address>:<port>/info
  18. 2. <ip address>:<port>/on
  19. 3. <ip address>:<port>/off
  20. The return value of the following command have to be at least with these information:
  21. 1. <Module Name>_On:<Relative Path for On Command>_Off:<Relative Path for Off Command>
  22. 2. true
  23. 3. true
  24. <!> In the condition that the relative path contain "/" or "\", replace the symbol with "|".
  25. ## Advance Communication Protocol
  26. Home Dynamic Module support advanced sensor/ micro-controller control protocol.
  27. Examples:
  28. 1. [Get return state of module]
  29. <Module Name>_On:<Relative Path for On Command>_Off:<Relative Path for Off Command>_State:<Item Name>,<value>;<Item Name>,<value>
  30. Example Code:
  31. printf("<p>DHT11 Sensor_On:switch|on_Off:switch|off_State:Temperature, %s℃;Humidity,%s%%</p>",temp_value,humi_value);
  32. Example Output:
  33. DHT11 Sensor_On:switch|on_Off:switch|off_State:Temperature,25℃;Humidity,60%
  34. 2. [Update module mode]
  35. <Module Name>_On:<Relative Path for On Command>_Off:<Relative Path for Off Command>_Mode:<Relative Path for Mode Switch>_Option:<option 1>,<option 2>,<option 3>
  36. Example Code:
  37. printf("<p>Desk Lamp_On:switch|on_Off:switch|off_Mode:mode|_Option:Warm,Bright,Night_State:Mode,%s</p>",current_Mode);
  38. Example Output:
  39. Desk Lamp_On:switch|on_Off:switch|off_Mode:mode|_Option:Warm,Bright,Night_State:Mode,Warm
  40. <!> The current mode of the module is using can be shown using state option.
  41. 3. [Passing variables to module]
  42. <Module Name>_On:<Relative Path for On Command>_Off:<Relative Path for Off Command>_Variables:<variable accepting path>_Keywords:<keyword1>,<keyword2>
  43. And the returned value will be in the format same as the PHP GET. For example, this URL will be requested from the ESP for a TV Controller.
  44. <variable path>?keyword1=something&keyword2=something_else
  45. Example Code for Getting Argument from URL Path:
  46. void handleSpecificArg() {
  47. String message = “”;
  48. if (server.arg(“Keyword1”)== “”){ //Parameter not found
  49. message = “Keyword1 Argument not found”;
  50. }else{ //Parameter found
  51. message = “Keyword1 Argument = “;
  52. message += server.arg(“Keyword1”); //Gets the value of the query parameter
  53. }
  54. server.send(200, “text/plain”, message); //Returns the HTTP response
  55. }
  56. Example Output of info page:
  57. IoT Remote_On:switch|on_Off:switch|off_Variables:sendCommand_Keywords:channel,volume
  58. Example URL request:
  59. sendCommand?channel=10&volume=0.8
  60. (C)IMUS Laboratory 2017-2018
  61. Licensed under (C) IMUS Laboratory