Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jeedom-request-jsonrpc

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jeedom-request-jsonrpc

Module node pour API JEEDOM JSON-RPC

  • 1.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

Jeedom API - JSON RPC 2.0 for NodeJs

Coverage Coverage

Overview

Node module to calls Jeedom's RPC API : https://jeedom.github.io/core/fr_FR/jsonrpc_api

This module uses axios (https://github.com/axios/axios)

Install

  • npm i jeedom-request-jsonrpc --save
  • yarn add jeedom-request-jsonrpc

Get Started

Import package:

const { apiJeedom } = require('jeedom-request-jsonrpc')

Instanciate:

const apiJeedomRunnable = new apiJeedom(
    'jeedom-hostname-or-ip',
    'my-api-key'
)

Make a request:

const requestJeedom = apiJeedomRunnable.run(
    'scenario::changeState', {
        id: 11,
        state: 'run'
    })

Details of run function:

run(cmd, params)

  • cmd command of API
  • params params belongs to command

Example 1 : (Promise flow)

requestJeedom
.then(response => {
    console.log('Response : ', response.result)
})
.catch(error => {
    console.log('An error : ', error)
})

Example 2 : (async - await)

const functionToRequestJeedom = async () => {
    try {
        let jeedomResponse = await requestJeedom
        console.log("Response", jeedomResponse)
    } catch (e) {
        cb(e)
    }
}

functionToRequestJeedom()

Request Result

Two examples of request result:

// without a value returned
{
    "status": 200,
    "statusText":"OK",
    "result": true
}
// with a value returned
{
    "status": 200,
    "statusText":"OK",
    "result":{
        "collectDate": "2018-09-30 14:49:03",
        "value": 21.2
     }
}

Changelog

1.0.6 (January 2019)

  • Fix documentation
  • Delete some useless packages
  • Refactor of code

1.0.5 (October 2018)

  • Add Typescript Definitions

1.0.4 (October 2018)

  • Improve error managment
  • Bugs fix
  • Fix documentation

Keywords

FAQs

Package last updated on 09 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc