Showing posts with label emberjs. Show all posts
Showing posts with label emberjs. 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!