With the very good and accurate Proliphix API documentation available, it was quite easy to start coding for the API without actual hardware to test with. The object oriented architecture i use in my Home Automation system really paid off this time. I mean, a thermostat with dozens of values/settings that can be read or written, is something completely different then for example a Door/Window sensor. Or not?
No, it doesn’t have to be. Whether you’re dealing with a thermostat or whatever type of sensor, they are both Devices with 1 or more DeviceValues. So all i had to do is focus on the device-specific code and ‘rewrite’ the API information to Delphi code. For example the code to define all the types and constants is 900 lines of code, the code that does the actual low-level interfacing with the NT20e is 430 lines and the code for the NT20e itself is 400 lines. In total less then 2000 lines of code of which only 1000 executable, not bad! The less new code means less new bugs 🙂
The result of these 1000 lines of code is total integration in the rest of my HA system. Complete exposure of the thermostat and its functionality: storing historical data to the database, creating events, manipulating the thermostat from the website, touchscreen or one of my other GUIs, everything instantly available.
Sometimes i am very glad i chose to create my own Home Automation system 3 years ago… this is one of those times :-).
Testing the interface. Before the thermostat would be placed on the wall in the livingroom, i wanted to make sure the interface was working properly. Only some minor bugs were found, mainly caused by making mistakes in translating the API documentation into constants. Currently the NT20e interface is running on my PC where it will run for some time before i am confident enough to take the next step: relocating the thermostat to the livingroom and start using it 🙂