Use a message broker such as [http://activemq.apache.org ActiveMQ] or RabbitMQ as the core of the system. Hef already has RabbitMQ in the space for ps1auth. This can be communicated with an an number of protocols but by far the simplest is STOMP. All messages passing through the broker should be JSON text messages well formed and documented.
−
−
Messages from devices such as arduinos could use MQTT protocol there is even an arduino lib: http://knolleary.net/arduino-client-for-mqtt/
−
Interesting article about bridging messages from a ZigBee mesh into MQTT: http://rijware.com/zigbee-and-mqtt/