Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Latest commit

 

History

History
316 lines (210 loc) · 10.9 KB

README.md

File metadata and controls

316 lines (210 loc) · 10.9 KB

Hello,

due to time restrictions of my days this repo ist archived. Use the new one, thanks to pdbjjens.

https://github.com/iobroker-community-adapters/ioBroker.frontier_silicon

Logo

ioBroker.frontier_silicon

NPM version Downloads Number of Installations (latest) Number of Installations (stable) Dependency Status Known Vulnerabilities

NPM

Tests: Test and Release Build Status

frontier_silicon adapter for ioBroker

Provides support for media players equipped with a Frontier Silicon chipset using FSAPI.

Features

PRs and contructive criticism are always welcome.

Implemented features

  • Power control
  • Mode selection
  • Preset selection
  • Notifications for several states
  • Volume control
  • Notifications

Planned features

  • Auto discovery
  • More states
  • Translations
  • More Exception handling
  • Cleaner code
  • Multi room features

Not planned features

  • Changing system information

Known Bugs

  • Media player must be on for preset discovery
  • No notifies after some time

Documentation

This adapter lets you control internet radios and media playsers based on Frontier Silicon chipsets. Many devices which can be controlled via Undok should work. Tested devices come from Revo, Sangean and SilverCrest, others should work, too.

After installation the device's IP and PIN must be entered in the configuration dialog. If the radio does not play DAB after switching on via Undok or this adapter try with "DAB starts without sound" enabled.

When the adapter starts for the first time it collects information about the device. For that it needs to switch through all modes. During checking settings the device will be muted for a few seconds to avoid disturbing sounds.

While the adapter reads the device's setting objects and states are created. States can be read-only (ro) or read-write (rw) ok, write-only for buttons is also possible.

  • audio

    Basic audio settings. No equalizer controls implemented yet.

    • maxVolume (number, ro)

      The maximum volume selectable

    • mute (boolean, rw)

      true if the device is muted, falseotherwise

    • volume (number, rw)

    • control

      • volumeDown and volumeUp

        In-/ or decreases volume by 1

  • device

    • friendlyName (text, rw)

    • power (boolean, rw)

    • radioId (test, ro)

      My guess is that this is the MAC of the device

    • version (text, ro)

      Software version

    • webfsapi (text, ro)

      The address of the API

  • info

    • connection (boolean, ro)

      Connection indicator for the adapter

  • media

    • state (number, rw)

      valid values are:

      • 0: Pause
      • 1: Play
    • control

      • next
      • plause
      • play
      • previous

    Do not take the following names too seriously. The radio uses them differently in different modes.

    • album (text, ro)

    • artist (text, ro)

    • graphic (text, ro)

      Use this URL to get an album cover or a station's logo.

    • name (text, ro)

    • text (text, ro)

    • title (text, ro)

  • modes

    • readPresets

      Re-reads all presets

    • selectPreset (number, rw)

      Used to get or select a preset. Be warned that the adapter guesses as this value cannot be read from the API.

    • selected (number, rw)

      Indicates or selects the selected mode. Can also be selected via modes.{number}.switchTo

    • {number}

      • id (text, ro)

        The name of that mode

      • key (number, ro)

        The index of that mode. Equals mode.{number} from object tree and can be written into modes.selected.

      • selectable (boolean, ro)

        true if this mode can be manually selected.

      • streamable (boolean, ro)

        Only present on multi-room enabled devices. true if this mode can be used as source for several multi-room devices.

      • switchTo

        Selects that mode.

      • presets

        • availabe (boolean, ro)

          Indicates whether presets for this mode are available

        • {number}

          The index of that preset. Equals mode.*.presets.{number}.key.

          • key

            The index of that preset. Equals mode.*.presets.{number} from object tree and can be written into modes.selectPreset.

          • name (text, ro)

            The name of that preset

          • switchTo

            Selects that preset and the corresponding mode.

Please be aware that you can sometimes choose between "pushing a button" or "setting a value". Use what is more convenient for you.

Changelog

0.0.10 (2020-11-29)

  • Übersetzungen

0.0.9

  • (halloamt) Selected preset can be read now. The adapter guesses a little but this seems to work.
  • (halloamt) Nicer readme
  • (halloamt) (Hopefully) more robust session handling.
  • (halloamt) Long polling should work more reliably
  • (halloamt) Sleep timers are cleared on onUnload

0.0.7 und 0.0.8

  • (halloamt) Formal but neccessary stuff for ioBroker

0.0.6

  • (halloamt) Nothing really, small stuff for npm

0.0.5

  • (halloamt) Media state controls
  • (halloamt) Bugfixes

0.0.4

  • (halloamt) Media and volume control buttons
  • (halloamt) Bugfixes

0.0.3

  • (halloamt) Get notifications from the radio
  • (halloamt) Change volume / mute

0.0.1

  • (halloamt) initial release
  • (halloamt) Change mode
  • (halloamt) Select Preset
Developer Manual ## Developer manual This section is intended for the developer. It can be deleted later

Getting started

You are almost done, only a few steps left:

  1. Create a new repository on GitHub with the name ioBroker.frontier_silicon

  2. Push all files to the GitHub repo. The creator has already set up the local repository for you:

    git push origin master
  3. Add a new secret under https://github.com/halloamt/ioBroker.frontier_silicon/settings/secrets. It must be named AUTO_MERGE_TOKEN and contain a personal access token with push access to the repository, e.g. yours. You can create a new token under https://github.com/settings/tokens.

  4. Head over to main.js and start programming!

Best Practices

We've collected some best practices regarding ioBroker development and coding in general. If you're new to ioBroker or Node.js, you should check them out. If you're already experienced, you should also take a look at them - you might learn something new :)

Scripts in package.json

Several npm scripts are predefined for your convenience. You can run them using npm run <scriptname>

Script name Description
test:js Executes the tests you defined in *.test.js files.
test:package Ensures your package.json and io-package.json are valid.
test Performs a minimal test run on package files and your tests.
lint Runs ESLint to check your code for formatting errors and potential bugs.

Writing tests

When done right, testing code is invaluable, because it gives you the confidence to change your code while knowing exactly if and when something breaks. A good read on the topic of test-driven development is https://hackernoon.com/introduction-to-test-driven-development-tdd-61a13bc92d92. Although writing tests before the code might seem strange at first, but it has very clear upsides.

The template provides you with basic tests for the adapter startup and package files. It is recommended that you add your own tests into the mix.

Publishing the adapter

Since you have chosen GitHub Actions as your CI service, you can enable automatic releases on npm whenever you push a new git tag that matches the form v<major>.<minor>.<patch>. The necessary steps are described in .github/workflows/test-and-release.yml.

To get your adapter released in ioBroker, please refer to the documentation of ioBroker.repositories.

Test the adapter manually on a local ioBroker installation

In order to install the adapter locally without publishing, the following steps are recommended:

  1. Create a tarball from your dev directory:
    npm pack
  2. Upload the resulting file to your ioBroker host
  3. Install it locally (The paths are different on Windows):
    cd /opt/iobroker
    npm i /path/to/tarball.tgz

For later updates, the above procedure is not necessary. Just do the following:

  1. Overwrite the changed files in the adapter directory (/opt/iobroker/node_modules/iobroker.frontier_silicon)
  2. Execute iobroker upload frontier_silicon on the ioBroker host

License

MIT License

Copyright (c) 2020 halloamt [email protected]

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.