Code Monkey home page Code Monkey logo

iobroker.template-rest's Introduction

Logo

ioBroker.template-rest

Number of Installations Number of Installations

This adapter is a template for the creation of an ioBroker adapter. You do not need it, at least that you plan developing your own adapter.

This is extension of ioBroker.template adapter with REST service. By default, the WEB server will be started to serve HTTP GET/POST requests. It can be started as secure(https) or unsecure(http) and with authentication or without.

Additionally, is shown how to poll some other URL for JSON data and parse them.

##Steps

  1. download and unpack this packet from github https://github.com/ioBroker/ioBroker.template/archive/master.zip or clone git repository git clone https://github.com/ioBroker/ioBroker.template.git

  2. download required npm packets. Write in ioBroker.template directory:

npm install

  1. set name of this template. Call

grunt rename --name=mynewname [email protected] --author="Author Name"

mynewname must be lower case and with no spaces.

If grunt is not available, install grunt globally:

npm install -g grunt-cli

  1. rename directory from ioBroker.template (can be ioBroker.template-master) to iobroker.mynewname

  2. to use this template you should copy it into .../iobroker/node_modules directory and then create an instance for it with iobroker.admin

  3. create your adapter:

  • you might want to start with main.js (code running within iobroker) and admin/index.html (the adapter settings page).

  • Adapter-Development-Documentation,

  • Installation, setup and first steps with an ioBroker Development Environment

  • Write and debug vis widgets

  • files under the www folders are made available under http://<iobrokerIP>:8082/<adapter-name>/

    • for this to work the iobroker.vis adapter has to be installed
    • delete this folder if you do not plan to export any files this way
    • call iobroker upload <adapter-name> after you change files in the www folder to get the new files uploaded to vis
  • the widget folder contains an example of a vis widget

    • you might want to start with widget/.html and widget/js/.js
    • call iobroker visdebug <adapter-name> to enable debugging and upload widget to "vis". (This works only from V0.7.15 of js-controller)
    • If you do not plan to export any widget then delete the whole widget folder and remove the "restartAdapters": ["vis"] statement from io-package.json
    • After admin/index.html is changed you must execute iobroker upload mynewname to see changes in admin console. The same is valid for any files in admin and www directory
  1. change version: edit package.json and then call grunt p in your adapter directory.

  2. share it with the community

Usage

After the adapter is started, you can check following requests:

http://ip:9090/api/system.adapter.admin.0.memHeapTotal http://ip:9090/api/plain/system.adapter.admin.0.memHeapTotal

Changelog

0.1.0

  • (bluefox) initial release

License

The MIT License (MIT)

Copyright (c) 2017-2022 @@Author@@ <@@email@@>

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.

iobroker.template-rest's People

Contributors

apollon77 avatar germanbluefox avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.