All Projects → hobbyquaker → binrpc

hobbyquaker / binrpc

Licence: MIT license
HomeMatic xmlrpc_bin:// protocol server and client

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to binrpc

ioBroker.hm-rpc
Connects HomeMatic Interface-Processes to ioBroker
Stars: ✭ 55 (+266.67%)
Mutual labels:  smarthome, homematic
XML-API
HomeMatic CCU Addon implementing a xml request functionality
Stars: ✭ 106 (+606.67%)
Mutual labels:  smarthome, homematic
ccu-addon-mosquitto
Mosquitto packaged as Addon for the Homematic CCU3 and RaspberryMatic
Stars: ✭ 23 (+53.33%)
Mutual labels:  smarthome, homematic
hm2mqtt.js
Node.js based Interface between Homematic and MQTT
Stars: ✭ 20 (+33.33%)
Mutual labels:  smarthome, homematic
ccu-historian
Der CCU-Historian erfasst die Betriebsdaten des Hausautomations-Systems HomeMatic der Firma eQ-3.
Stars: ✭ 105 (+600%)
Mutual labels:  smarthome, homematic
ccu-jack
CCU-Jack bietet einen einfachen und sicheren REST- und MQTT-basierten Zugriff auf die Datenpunkte der Zentrale (CCU) des Hausautomations-Systems HomeMatic. Zudem können einfach Fremdgeräte an die CCU angebunden werden.
Stars: ✭ 63 (+320%)
Mutual labels:  smarthome, homematic
cul
nodejs module to interact with busware cul / culfw
Stars: ✭ 26 (+73.33%)
Mutual labels:  smarthome, node-module
node-red-contrib-polymer
A Polymer based Dashboard UI for Node-RED
Stars: ✭ 21 (+40%)
Mutual labels:  smarthome
tuyapower
Python module to read status and energy monitoring data from Tuya based WiFi smart devices. This includes state (on/off), current (mA), voltage (V), and power (wattage).
Stars: ✭ 101 (+573.33%)
Mutual labels:  smarthome
Roode
A reliable smart home people counter based on VL53L1X and ESPHome
Stars: ✭ 119 (+693.33%)
Mutual labels:  smarthome
home-assistant-config
🏠 My Home Assistant configuration
Stars: ✭ 17 (+13.33%)
Mutual labels:  smarthome
ioBroker.telegram
Use Telegram service to communicate with ioBroker
Stars: ✭ 51 (+240%)
Mutual labels:  smarthome
whatsapp-clone-react
Build a WhatsApp Clone with React JS and FireBase.
Stars: ✭ 38 (+153.33%)
Mutual labels:  node-module
teaching-nodejs-expressjs-framework-spring-2019-2020
Complete Node-Express Application
Stars: ✭ 16 (+6.67%)
Mutual labels:  node-module
ioBroker.sonos
Control and monitor SONOS player from ioBroker
Stars: ✭ 33 (+120%)
Mutual labels:  smarthome
awesome-zigbee
Curated List of ZigBee related stuff
Stars: ✭ 45 (+200%)
Mutual labels:  smarthome
hassio-addons
Homegear as a Hassio add-on
Stars: ✭ 14 (-6.67%)
Mutual labels:  homegear
ioBroker.tankerkoenig
Spritpreis Adapter für ioBroker
Stars: ✭ 29 (+93.33%)
Mutual labels:  node-module
ioBroker.heatingcontrol
heating control incl. simple actor handling
Stars: ✭ 43 (+186.67%)
Mutual labels:  smarthome
ioBroker.zwave2
Z-Wave for ioBroker. Better. Faster. Stronger.
Stars: ✭ 22 (+46.67%)
Mutual labels:  smarthome

binrpc

npm version dependencies Status Coverage Status Build Status XO code style License

HomeMatic xmlrpc_bin:// protocol server and client

For use with CCU1/2 (rfd, hs485d, Rega), Homegear and CUxD

Implements the same interface as homematic-xmlrpc, these 2 libs should be a 1:1 drop-in-replacement for each other.

Changelog

Breaking Change in v3.0.0: To be consistent with homematic-xmlrpc the RPC client isn't an event emitter anymore. All errors have to be handled through the methodCall callback.

Change in v2.1.0 To be consistent with homematic-xmlrpc you don't have to wait for the client connect event before using methodCall.

Breaking change in v2.0.0: system.multicall isn't resolved in single calls anymore. This should be done by the application itself and was removed to be consistent with homematic-xmlrpc.

Examples

Switch on the Channel LEQ0134153:1

var rpc = require('binrpc');

var rpcClient = rpc.createClient({host: '192.168.1.100', port: '2001'});

rpcClient.methodCall('setValue', ['LEQ0134153:1', 'STATE', true], function (err, res) {
    console.log('response', err, JSON.stringify(res));
});

For a full example on how to subscribe to CCU events see example.js

Further reading

API Documentation

Modules

binrpc
client
protocol
server

Classes

Client
Protocol
Server

binrpc

binrpc.createClient(options) ⇒ Client

RPC client factory

Kind: static method of binrpc

Param Type Default Description
options object
options.host string the hostname or ip address to connect to
options.port number the port to connect to
[options.reconnectTimeout] number 2500 wait milliseconds until trying to reconnect after the socket was closed
[options.responseTimeout] number 5000 wait milliseconds for method call response
[options.queueMaxLength] number 15 maximum number of methodCalls that are allowed in the queue

binrpc.createServer(options, onListening) ⇒ Server

RPC server factory

Kind: static method of binrpc

Param Type Description
options object
options.host string ip address on which the server should listen
options.port number port on which the server should listen
onListening function function to be invoked in the server's listening callback

client

client.queue : Array

The request queue. Array elements must be objects with the properties buffer and callback

Kind: instance property of client

client.queueMaxLength : number

Maximum queue length. If queue length is greater than this a methodCall will return error 'You are sending too fast'

Kind: instance property of client

client.queueRetryTimeout : number

Time in milliseconds. How long to wait for retry if a request is pending

Kind: instance property of client

client.pending : boolean

Indicates if there is a request waiting for its response

Kind: instance property of client

client.responseTimeout : number

Time in milliseconds. How long to wait for a method call response

Kind: instance property of client

client.connect()

connect

Kind: instance method of client

client.queuePush(buf, cb)

Push request to the queue

Kind: instance method of client

Param Type
buf buffer
cb function

client.queueShift()

Shift request from the queue and write it to the socket.

Kind: instance method of client

client.methodCall(method, params, callback)

methodCall

Kind: instance method of client

Param Type Description
method string
params Array
callback function optional - if omitted an empty string will be send as response

protocol

protocol.encodeRequest(method, data) ⇒ Buffer

encode requests

Kind: static method of protocol

Param Type Description
method string throws error if not type string or if string is empty
data * optional - defaults to an empty array

protocol.encodeResponse(data) ⇒ Buffer

encode response

Kind: static method of protocol

Param Type Description
data * optional - defaults to empty string

protocol.encodeData(obj) ⇒ Buffer

encode data

Kind: static method of protocol

Param Type Description
obj * throws TypeError if obj is undefined or null

protocol.encodeStruct(obj) ⇒ Buffer

encode struct

Kind: static method of protocol

Param Type Description
obj object throws error if not of type object

protocol.encodeStructKey(str) ⇒ Buffer

encode struct key

Kind: static method of protocol

Param Type Description
str string throws error if not of type string

protocol.encodeArray(arr) ⇒ Buffer

encode array

Kind: static method of protocol

Param Type Description
arr array throws error if not instance of Array

protocol.encodeString(str) ⇒ Buffer

encode string

Kind: static method of protocol

Param Type Description
str string throws error if not of type string

protocol.encodeBool(b) ⇒ Buffer

encode bool

Kind: static method of protocol

Param Type Description
b * any type

protocol.encodeInteger(i) ⇒ Buffer

encode integer

Kind: static method of protocol

Param Type Description
i number throws error if not a number or if out of range (min=-2147483648 max=2147483647)

protocol.encodeDouble(d) ⇒ Buffer

encode double

Kind: static method of protocol

Param Type Description
d number throws error if not a number

protocol.decodeDouble(elem) ⇒ object

decode double

Kind: static method of protocol
Returns: object - properties content and rest

Param Type Description
elem Buffer throws error if not an instance of Buffer or if length <8

protocol.decodeString(elem) ⇒ object

decode string

Kind: static method of protocol
Returns: object - properties content and rest

Param Type Description
elem Buffer throws error if not an instance of Buffer or if length <4

protocol.decodeBool(elem) ⇒ object

decode double

Kind: static method of protocol
Returns: object - properties content and rest

Param Type Description
elem Buffer throws error if not an instance of Buffer or if length <8

protocol.decodeInteger(elem) ⇒ object

decode integer

Kind: static method of protocol
Returns: object - properties content and rest

Param Type Description
elem Buffer throws error if not an instance of Buffer or if length <4

protocol.decodeArray(elem) ⇒ object

decode array

Kind: static method of protocol
Returns: object - properties content and rest

Param Type Description
elem Buffer throws error if not an instance of Buffer or if length <4

protocol.decodeStruct(elem) ⇒ object

decode struct

Kind: static method of protocol
Returns: object - properties content and rest

Param Type Description
elem Buffer throws error if not an instance of Buffer or if length <4

protocol.decodeData(data) ⇒ *

decodes binary data

Kind: static method of protocol

Param Type
data Buffer

protocol.decodeResponse(data) ⇒ *

decode response

Kind: static method of protocol

Param Type Description
data Buffer throws TypeError if data is no instance of Buffer

protocol.decodeStrangeRequest(data) ⇒ Array

decode "strange" request

Kind: static method of protocol

Param Type Description
data Buffer throws TypeError if data is no instance of Buffer

protocol.decodeRequest(data) ⇒ *

decode request

Kind: static method of protocol

Param Type Description
data Buffer throws TypeError if not instance of Buffer

server

Client

Kind: global class

new Client(options)

Param Type Default Description
options object
options.host string the hostname or ip address to connect to
options.port number the port to connect to
[options.reconnectTimeout] number 2500 wait milliseconds until trying to reconnect after the socket was closed
[options.responseTimeout] number 5000 wait milliseconds for method call response
[options.queueMaxLength] number 15 maximum number of methodCalls that are allowed in the queue

Protocol

Kind: global class

Server

Kind: global class

new Server(options, onListening)

Param Type Description
options object
options.host string ip address on which the server should listen
options.port number port on which the server should listen
onListening function function to be invoked in the server's listening callback

"[method]" (error, params, callback)

Fires when RPC method call is received

Kind: event emitted by Server

Param Type Description
error *
params array
callback function callback awaits params err and response

"NotFound" (method, params)

Fires if a RPC method call has no event handler. RPC response is always an empty string.

Kind: event emitted by Server

Param Type
method string
params array

License

The MIT License (MIT)

Copyright (c) 2014-2018 Sebastian 'hobbyquaker' Raff and Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].