Giter Site home page Giter Site logo

ent8r / wifiradio Goto Github PK

View Code? Open in Web Editor NEW
7.0 4.0 3.0 1.29 MB

๐Ÿ“ป Node.js module for controlling WiFi-radios

License: GNU General Public License v3.0

JavaScript 100.00%
wifiradio wifi-radio radio frontier-silicon fsapi iot home-automation api nodejs node-js

wifiradio's Introduction

WiFi-Radio

test version downloads

NodeJS module for controlling WiFi-radios

Installation

npm install wifiradio --save

Usage

const Wifiradio = require('wifiradio');

const ip = '192.168.178.27'; // Change this to the ip adress of your radio
const pin = '1234'; // This is the default PIN for the radio. (Works in most cases)

const radio = new Wifiradio(ip, pin);

radio.setPower(1).then(() => {
  radio.getPower().then(result => {
    console.log(`Power: ${result}`);
  });
});

radio.getMute().then(result => {
  console.log(`Mute: ${result}`);
});

radio.getText().then(result => {
  console.log(`Text: ${result}`);
});

radio.getMode().then(result => {
  console.log(`Mode: ${result}`);
});

Features

This page lists all commands that are directly accessible with the use of this library. These commands only provide a very simple high-level access to the features of your radio.

โš ๏ธ For more advanced use cases I suggest that you may take a look at this very extensive list of possible commands and don't use the functions listed below but rather access the API via the following function for direct access:

Direct Access

radio.get('sys.sleep').then(console.log);
radio.get('netRemote.sys.sleep').then(console.log);

radio.set('sys.sleep', 60).then(console.log);

radio.get('sys.info.friendlyname').then(console.log);
radio.set('sys.audio.volume', 5).then(console.log);

Power

// Turn on
radio.setPower(1);

// Turn off
radio.setPower(0);

// Get whether the radio is on or off (returns 0 or 1)
radio.getPower().then(console.log);

Mute

// Mute on
radio.setMute(1);

// Mute off
radio.setMute(0);

// Get whether the radio is mute or not (returns 0 or 1)
radio.getMute().then(console.log);

Volume

// Set volume (value from 1-20)
radio.setVolume(10);

// Get the current volume (returns a value from 1-20)
radio.getVolume().then(console.log);

Modes

// Set a mode
radio.setMode(2);

// Get the current playing mode
radio.getMode().then(console.log);

Display

// Get the first line of the display
radio.getName().then(console.log);

// Get the second line of the display
radio.getText().then(console.log);

Contributing

There are many more requests that could be done by this module. If you think that something is missing just open an issue for that or make a pull request. If you need some help, you can have a look here for some further requests.

License

GPL-3.0

wifiradio's People

Contributors

ent8r avatar maxcanna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wifiradio's Issues

README.md

There is no README yet for this repository. It would be very useful to know the commands for this module and have them somewhere documented.

Don't require session

Most commands don't require a session to be open. Actually I don't think that any of the implemented methods require one.

The problem with sessions is that only one can be open at once, so my official phone app will get disconnected if I use wifiradio even for just a call.

Add raw method

I was about to use this module for my personal shortcuts app but I noticed that it only has a handful of methods. I wouldn't ask you to support more, but generic get/set methods would be useful:

radio.get('sys.info.friendlyname').then(name => {
  console.log({name})
});
radio.set('sys.audio.volume', 5).then(result => {
  console.log({result})
});

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.