Showing posts with label rest api. Show all posts
Showing posts with label rest api. Show all posts

2014-09-27

Give your home a REST

OpenNetHome have always had a TCP/IP interface for integration in the TCPCommandPort-Item. But it is time to add a more modern interface to my home. I have now implemented a REST-interface with json encoding to OpenNetHome which exposes HomeItems as REST-resources. Since basically everything in OpenNetHome is HomeItems (lamps, thermometers, timers, web-server and so on) this means that most of the features in the server can be reached via this interface. The URL to turn off the lamp in my bedroom window is for example:

POST http://ssgserver2:8020/rest/items/108/actions/off/invoke

and to get the temperature on the balcony i do a get on the URL:

GET http://ssgserver2:8020/rest/items/52

The "108" and "52" are the identities of the corresponding HomeItems, and you can get the identities by listing all HomeItems in the server with:

GET http://ssgserver2:8020/rest/items

This kind of interface works well with modern WEB-frameworks like ember.js and AngularJS but also for integration with phone apps and other home control systems.

The full documentation of the interface is available here on the OpenNethome-site. The implementation is as usual available in the nightly build. Note that details of the interface my still change and feedback on the interface is welcome!

2012-04-04

NetHome@Work



The project have been standing still for a while (even though the server of course still run my home), but now it has gone to work for real. On my work we have a lot of automatic tests running on our product code base, unit tests continually during the day and heavier database tests during the night. They are run by a TeamCity server which of course can display the results on a web page. But with my new written “TeamCityBuildMonitor”-home item, I can configure a list of builds to monitor and the NetHome server can act on the result. So now we have two lava lamps, one green and one red which display the current state of the tests. The challenge for the teams is to correct any problem before the red “lava” has melted and starts to float…