Welcome to jeedom-request-jsonrpc 👋
Jeedom API - JSON RPC 2.0 for NodeJs
Overview
Node module to calls Jeedom's RPC API : https://jeedom.github.io/core/fr_FR/jsonrpc_api
This module uses phin for request (https://github.com/ethanent/phin)
Install
npm i jeedom-request-jsonrpc --save
yarn add jeedom-request-jsonrpc
Get Started
Import package:
const apiJeedom =
Instanciate:
const apiJeedomRunnable = 'jeedom-hostname-or-ip' 'my-api-key'
Details of apiJeedom
function:
apiJeedom(jeedomHost, apikey, reqParams = {}, jsonrpc = '2.0', uriJeedomApi = '/core/api/jeeApi.php')
jeedomHost
host of jeedom serverapikey
api key of jeedomreqParams
optionnals params to add to request (phin package options)jsonrpc
version of jsonrpcuriJeedomApi
base url of jeedom server
Make a request:
const requestJeedom = apiJeedomRunnable
Details of apiJeedomRunnable.run
function:
apiJeedomRunnable.run(cmd, params)
cmd
command of APIparams
params belongs to command
Example 1 : (Promise flow
)
requestJeedom
Example 2 : (async - await
)
const functionToRequestJeedom = async { try let jeedomResponse = await requestJeedom console catch e }
Requests result examples
without a value returned
with a value returned
with an error
Useful links
Changelog
https://github.com/clement-berard/jeedom-request-jsonrpc/releases