Curl

There are several Unix (and Linux) commands that are useful to controls the devices in my home. These commands are available opening the Terminal application and typing the commands in one line.  

Let's us start with the "curl" command that is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, SCP, SFTP, SMTP, SMTPS, TELNET, and TFTP).  The command is designed to work without user interaction. For more info check the manual by typing man curl in a terminal window.

  • curl <gatewayIP>

It helps to check if the device HTTP service is working and it returns the following lines of text:

  1. <HTML><HEAD><TITLE>My Home</TITLE>
  2. <link rel="shortcut icon" href="/favicon.ico" />
  3. <META HTTP-EQUIV="refresh" CONTENT="0;URL=iden.php">
  4. </HEAD>
  5. <BODY BGCOLOR=#FFFFFF LINK="#FF0000">
  6. </BODY>
  7. </HTML>

Which is a source of the http page with URL http://10.0.0.40

=====================

  • curl 10.0.0.40:20000  

It helps to check the status of the SCS connection) and it returns:

  1. *#*1##

=====================

  • curl -d *##*#13**15## -m 2 -s 10.0.0.40:20000

It returns the Model of the gateway:

  1. *#*1##*#*0##*#13**15*44##*#*1##

44 is the code for the MH200N

=====================

  • curl -d *#*0*##*1*0*15## -m 2 -s 10.0.0.40:20000

It will turn OFF light 15 and returns:

  1. *#*1##*#*0##*#*1

=====================

  • curl -d *##*#1*0## -m 2 -s 10.0.0.40:20000

It returns the status of all lights without PUL config:

  1. *#*1##*#*0##*1*0*31##*1*0*41##*1*0*51##*1*0*61##*1*0*71##*1*0*12##*1*0*22##*1*0*32##*1*0*27##*1*0*52##*1*0*42##*1*0*72##*1*0*13##*1*0*23##*1*0*33##*1*0*63##*1*0*14##*1*0*24##*1*0*34##*1*0*54##*1*0*64##*1*0*15##*1*0*25##*1*0*35##*1*0*45##*1*0*55##*1*0*65##*1*0*26


A better readable results after seeral editimg and sorting shows the status of the 27 light actuators in the home.

  • curl -1 -d *##*#1*0## -m 2 -s 10.0.0.40:20000|sed s/^.#.1##//|sed s/^.#.0##//|sed s/.#.1##$//|sed s/##/##n/g|tr n "\n"|sort -n


  1. *1*0*12##
  2. *1*0*13##
  3. *1*0*14##
  4. *1*0*15##
  5. *1*0*22##
  6. *1*0*23##
  7. *1*0*24##
  8. *1*0*25##
  9. *1*0*26##
  10. *1*0*27##
  11. *1*0*28##
  12. *1*0*29##
  13. *1*0*31##
  14. *1*0*32##
  15. *1*0*33##
  16. *1*0*34##
  17. *1*0*35##
  18. *1*0*36##
  19. *1*0*37##
  20. *1*0*38##
  21. *1*0*41##
  22. *1*0*42##
  23. *1*0*45##
  24. *1*0*47##
  25. *1*0*51##
  26. *1*0*52##
  27. *1*0*54##
  28. *1*0*55##
  29. *1*0*56##
  30. *1*0*58##
  31. *1*0*61##
  32. *1*0*63##
  33. *1*0*64##
  34. *1*0*65##
  35. *1*0*67##
  36. *1*0*71##
  37. *1*0*72##


Similarly for the motor actuators

  • curl -1 -d *##*#2*0## -m 5 -s 10.0.0.40:20000|sed s/^.#.1##//|sed s/^.#.0##//|sed s/.#.1##$//|sed s/##/##n/g|tr n "\n"|sort -n


  1. *2*0*16##
  2. *2*0*17##
  3. *2*0*18##
  4. *2*0*21##
  5. *2*0*39##
  6. *2*0*49##
  7. *2*0*57##
  8. *2*0*66##
  9. *2*0*83##
  10. *2*0*84##
  11. *2*0*85##
  12. *2*0*87##
  13. *2*0*88##
  14. *2*1*95##
  15. *2*2*19##
  16. *2*2*76##
  17. *2*2*77##
  18. *2*2*93##
  19. *2*2*94##
  20. *2*2*96##

====================

after login in the MH200N using the web interface, open a Terminal Application and type:

  • curl -s 10.0.0.40/supervision.php |grep name_|sed s/^.*name_//|sed s/\>.*$// |sed s/\ title.//|sort -n


It returns a sorted list of the scenarios listed in the html pge of the gateway:

  1. 1""Aux7onBoolean7"
  2. 2""Health_Ingresso"
  3. 3""Health_Laundry"
  4. 4""Infissi"
  5. 5""Ventilation"
  6. 6""Health_Private"
  7. 7""irrigazioneOFF"
  8. 8""Health_Sala"
  9. 9""Irriga Giardino"
  10. 10""Toilette_OFF"
  11. 11""Irriga Serra"
  12. 12""extrattoriON"
  13. 13""Health_Atrio"
  14. 14""CaldaON"
  15. 15""B_Specchio_OFF"
  16. 16""B_Blue_OFF"
  17. 17""CaldaOFF"
  18. 18""Infissi Chiusi"
  19. 19""FreddaON"
  20. 20""FreddaOFF"
  21. 21""TavoloON"
  22. 22""TavoloOFF"
  23. 23""Ruota ON"
  24. 24""Ruota OFF"
  25. 25""T1"
  26. 26""BedT2T4off"
  27. 27""T3"
  28. 28""cen2T1"
  29. 29""T2"
  30. 30""DownT3T4on"
  31. 31""cen2T2"
  32. 32""SlopeT1T4on"
  33. 33""cen2T3"
  34. 34""cen2T4"
  35. 35""scen1x"
  36. 36""scen2x"
  37. 37""Aux7onOff"
  38. 38""scen3x"
  39. 39""scen4x"
  40. 40""scen1"
  41. 41""scen2"
  42. 42""scen3"
  43. 43""scen4"
  44. 44""scen5"
  45. 45""scen6"
  46. 46""scen7"
  47. 47""scen8"
  48. 48""scen9"
  49. 49""scen10"
  50. 50""scen11"
  51. 51""scen12"
  52. 52""scen13"
  53. 53""scen14"
  54. 54""scen15"
  55. 55""scen16"
  56. 56""flagReset"
  57. 57""IrrigationSerra"


Which are the IDs and names of the scenarios in the MH200N. 

The option -m 2 is a time out after 2 seconds; and the option -s suppress the time out error message.

=====================


Contact Us & Help                                                        Site Map                                              © Andres Albanese 2012