Started tweaking the script with warn and alert levels
Added some structure
Corrected method call
Created simple web server to answer with status as json
Answer /, /state and /value with proper response