Coder Social home page Coder Social logo

iobroker-community-adapters / iobroker.cec2 Goto Github PK

View Code? Open in Web Editor NEW
10.0 6.0 5.0 4.44 MB

iobroker.adapter as wrapper cec-client, control HDMI-CEC devices from ioBroker.

License: MIT License

HTML 4.32% CSS 0.58% JavaScript 95.10%
hdmi-cec iobroker raspberry-pi

iobroker.cec2's Introduction

Logo

ioBroker.cec2

NPM version Downloads Number of Installations Current version in stable repository

NPM

Tests: Test and Release

Adapter for HDMI CEC

You can monitor / control devices using HDMI CEC. Most modern TVs and multimedia devices support CEC to some extent.

Info

On start this adapter runs cec-client and polls all devices on the HDMI bus. For every CEC device a device in ioBroker is created. The OSDName of a device will become its id in ioBroker (because it should not change and is nicely readable). If devices show up during runtime they will be added to ioBroker, too.

CEC Adresses

Short introduction about CEC addresses, you can skip this, but might want to read here, if you get confused by the description below.

In CEC there are two types of addresses. Both are important.

Logical Address

The logical address is a number between 0 and 15 (or F in Hex which is normally used). The number defines what kind of device it is:

  • 0 = TV
  • 5 = Audiosystem
  • 4,8,11 = Playback
  • 1,2,9 = Recording
  • 3,6,7,10 = Tuner

The others are reserved (12,13), Freeuse (14) and unregistered/broadcast (15). The devices that use these addresses are restricted in there communication.

The logical address is dynamically assigned. That means on one day you can have the situation that Playback A is assigned address 4 and Playback B 8. But on the next day they are switched on in a different order and then A gets 8 and B 4. (Some devices are always active on the CEC bus though and therefore cling to their addresses). If there are too many devices of one type (i.e. 4 playback devices), then the logical addresses have to be reused and that will happen. The adapter tries to manage this case.

The logical address is used to address messages and reports to. ioBroker needs a logical address, too, in order to receive reports from the bus. Therefore configure the adapter to a device type that you know you have free logical addresses (for example recording).

Physical Address

The physical address is based on the HDMI ports involved for the device. It is basically a path of port numbers towards the device. It is composed from 4 numbers seperated by dots. Some examples:

  • 0.0.0.0 = TV
  • 1.0.0.0 = 1. HDMI port of the TV
  • 2.0.0.0 = 2. HDMI port of the TV
  • 2.2.0.0 = 2. HDMI port of the TV, 2. HDMI port of a Switch / AV-Receiver
  • 4.1.2.0 = 4. HDMI port of the TV, 1. HDMI port of a AV-Reciever / Switch, 2. HDMI port of the next AV-Receiver/Switch

That should give a basic idea. A 0 means the path is ending.

The physical address is fix for a device unless it is replugged into a different HDMI Port (or any devices before it seen from TV).

States per device

For every device there are the following states created:

  • info.active = device was seen recently and logical address should be correct
  • info.cecVersion = should be 1.4, determines features
  • info.lastSeen = last message from device on CEC bus
  • info.logicalAddress = logical address as number
  • info.logicalAddressHex = logical address as hex number (needed for own commands)
  • info.Name = name the device sets in CEC Bus
  • info.physicalAddress = physical address
  • info.Vendor = vendor of the device
  • activeSource = is the device the active source? Can switch this device to be active source
  • menuStatus = lets device be controlled by TV remote
  • state = power state of device (lets you switch it on/off, if supported)
  • createButtons = press here to generate states for buttons in .buttons subfolder.
  • buttons.time = time to press a button for (default 500ms).

Buttons

Button presses do not work for all devices and some might need to have an active connection with the ioBroker device to be controlled via CEC bus. For FireTV it works quite ok. To test button presses, press createButtons button in a device and test some of the created buttons in some situations. Power works for quite a lot devices.

Global States

There are the following global states:

  • active-source = physical address of the current active source (can be set to switch inputs)
  • arc = Audio Return Channel is (in)active might be able to (de)activate it here
  • mute = mute Audiosystem
  • raw-command = send commands to cec-client directly (for example 'scan' or tx + CEC Command from http://www.cec-o-matic.com/)
  • standbyAll = send all devices to standby
  • systemAudio = Audiosystem is/is not in use. Informs devices that they should send volume/mute commands to Audiosystem
  • volume = volume of Audiosystem, 0 = mute
  • volumeUp/Down = change volume of Audiosystem

Poll States

There is a subfolder "poll" with button-states for most states. If the button is triggered, the adapter will issue a command on CEC Bus to poll the value and set the state accordingly (sadly not all devices react to poll messages, though).

Requirements

cec-client have to be installed. Usually can be installed using:

sudo apt install cec-utils

The user running iobroker (nowadays "iobroker") needs acces to /dev/vchiq. You may need to add the iobroker user to the video group for that:

sudo usermod -a -G video iobroker

Installation

Execute the following command in the iobroker root directory (e.g. in /opt/iobroker)

npm install iobroker.cec2

Or install from admin webpage.

Configuration

  • osd name: this name will reported to other devices, for example your TV. You might need to select ioBroker there to receive remote controls in ioBroker.
  • device type: You can set the device type, see discussion of logical address above to get an idea what that means. Use a device type that you have not many of.
  • prevent unnamed devices: Sometimes devices are not reporting their name in certain situations (for example Nintendo Switch won't report its name when in standby but announce itself). In this situations the adapter might create a duplicate of the device under it's physical address (i.e. for numbers). You can enable this option to prevent it.

Script examples:

See example Scripts for some example scripts that help with / repair multimedia setups.

Changelog

0.1.3 (2024-07-04)

  • remove unnecessary files from npm package

0.1.2 (2024-06-04)

  • prevent crash
  • try restart in case of error with cec-client

0.1.1 (2023-09-06)

  • dependency updates.
  • sending commands is now more reliable.
  • more error handling

0.1.0 (2021-02-18)

  • add more translations.
  • add more options (poll TV power).

0.0.8 (2021-02-14)

  • Switched from unmaintained dependency to own code to control cec-monitor binary.
  • Swtiched from event-stream to readline.
  • Probably fixed missed incomming events.

License

MIT License

Copyright (c) 2020-2024 Garfonso [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.

iobroker.cec2's People

Contributors

apollon77 avatar dependabot-preview[bot] avatar dependabot[bot] avatar dutchmannl avatar garfonso avatar germanbluefox avatar greenkeeper[bot] avatar mcm1957 avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

iobroker.cec2's Issues

Compatibility check and testing for Node.js 14 and 16

Dear Adapter develop,

Node.js 14 is now available for a year and Node.js 16 was release just some days ago and will become LTS by October 2021. We plan to update the ioBroker Node.js recommendation (currently 12.x) to 14.x later this year.

Please check your adapter with Node.js 14 especially, and ideally also directly with Node.js 16

Please add both versions to the adapter testing which is executed on commits.

If your adapter requires a certain minimum version of Node.js please set the 'engine' setting in package.json accordingly! Please also do this if the adapter is not able to work in certain Node.js versions, so that ioBroker can prevent users from installing te adapter if not compatible!

On questions please talk to us at ioBroker/ioBroker.js-controller#1138

Please close the issue after you checked it.

Thank you very much for your support!

Please add you adapter to our repository

We saw your adapter and if it is ready please request that it is added to the repository. With this it becomes available for all users. Please consult https://github.com/ioBroker/ioBroker.repositories#add-a-new-adapter-to-the-latest-repository and the following sections for more details.
If you need help, contact us in the forum https://forum.iobroker.net/ or in the developer chat https://github.com/iobroker-community-adapters/info .

Thank you for your support.

Device with unexpected physical address came online on logical address

Hi,
my AVR (Samsung) is behaving a bit strange when started which prevents me from correctly polling the status.
Once it is turned on, I receive the message:
(3211) ============================ Processing Event: REPORT_PHYSICAL_ADDRESS: {"type":"TRAFFIC","number":"1008130","flow":"IN","source":5,"target":15,"opcode":132,"args":[0,0,5],"event":"REPORT_PHYSICAL_ADDRESS','data':{'val':0,'str':'0.0.0.0'}}
triggering
(3211) Device with unexpected physical address came online on logical address 5
which sets the logicalAddress states of my AVR to -1 and
Updating AV_Receiver.info.physicalAddress to 0.0.0.0

After that, there is an additional event received:
(3211) ============================ Processing Event: REPORT_PHYSICAL_ADDRESS: {"type":"TRAFFIC","number":"1012082","flow":"IN","source":5,"target":15,"opcode":132,"args":[32,0,5],"event":"REPORT_PHYSICAL_ADDRESS','data':{'val':8192,'str':'2.0.0.0'}}
but this is not resetting the logical address of the AVRs logicalAddress states from -1 to 5 but only updating the physical address:
Updating AV_Receiver.info.physicalAddress to 2.0.0.0
Afterwards the Power state is reported but not reflected in the states as the device for logicalAddress 5 is not present anymore (I guess it needs to be also readded in the logicalAddressToDevice Array)
I can provide more log info if needed

An in-range update of mocha is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye πŸ‘‹ and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency mocha was updated from 7.1.1 to 7.1.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v7.1.2

7.1.2 / 2020-04-26

πŸ”© Other

πŸ“– Documentation

Commits

The new version differs by 7 commits.

  • 27aeb80 Release v7.1.2
  • e3df026 update CHANGELOG for v7.1.2 [ci skip]
  • 7f75489 add test case: type check before calling retriedTest()
  • e659027 type check before calling retriedTest()
  • eba6ec7 Remove Runnable#inspect() and utils.ngettext() (#4230)
  • a4a4d50 add wallaby logo to bottom of site
  • c600547 update mkdirp to v0.5.5 (#4222)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Release script: Action required

Hi, it looks like you are using @alcalzone/release-script to manage your releases.
When updating to the latest version, you need to remove the following line from your .github/workflows/test-and-release.yml if you want the releases to keep working:

  deploy:
    # Trigger this step only when a commit on master is tagged with a version number
    if: |
      contains(github.event.head_commit.message, '[skip ci]') == false &&
      github.event_name == 'push' &&
-     github.event.base_ref == 'refs/heads/master' &&
      startsWith(github.ref, 'refs/tags/v')

It may also look like this one:

  deploy:
    # Trigger this step only when a commit on master is tagged with a version number
    if: |
      contains(github.event.head_commit.message, '[skip ci]') == false &&
      github.event_name == 'push' &&
-     github.event.base_ref == 'refs/heads/main' &&
      startsWith(github.ref, 'refs/tags/v')

An in-range update of @iobroker/testing is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye πŸ‘‹ and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency @iobroker/testing was updated from 2.1.0 to 2.2.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@iobroker/testing is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 55 commits.

  • f5882be chore: release v2.2.0
  • 948b5c2 upgrade to @types/iobroker and add stubs for new methods
  • acfb9ae chore(deps-dev): bump prettier from 2.0.3 to 2.0.4 (#262)
  • 08d5a5d chore(deps-dev): bump @types/node from 13.11.0 to 13.11.1 (#258)
  • b9ad384 chore(deps-dev): bump @typescript-eslint/parser from 2.26.0 to 2.27.0 (#257)
  • 76f1c19 chore(deps-dev): bump @typescript-eslint/eslint-plugin (#259)
  • 5138498 chore(deps-dev): bump eslint-plugin-prettier from 3.1.2 to 3.1.3 (#261)
  • c582323 chore(deps-dev): bump prettier from 2.0.2 to 2.0.3 (#251)
  • 18086d8 Merge pull request #256 from ioBroker/dependabot/npm_and_yarn/typescript-eslint/parser-2.26.0
  • f88aeab Merge pull request #255 from ioBroker/dependabot/npm_and_yarn/ts-node-8.8.2
  • a5eec6d Merge pull request #250 from ioBroker/dependabot/npm_and_yarn/types/sinon-chai-3.2.4
  • 69dc7ef chore(deps-dev): bump @typescript-eslint/parser from 2.25.0 to 2.26.0
  • 3b3fe24 Merge pull request #254 from ioBroker/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-2.26.0
  • c88eab2 Merge pull request #252 from ioBroker/dependabot/npm_and_yarn/types/node-13.11.0
  • 2451056 chore(deps-dev): bump ts-node from 8.8.1 to 8.8.2

There are 55 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Update stable version in repo from 0.1.1 to 0.1.3

Think about update stable version to 0.1.3

Version: stable=0.1.1 (317 days old) => latest=0.1.3 (15 days old)
Installs: stable=62 (65.96%), latest=6 (6.38%), total=94

Click to use developer portal
Click to edit

Do not close this issue manually as a new issue will be created if condition for update still exists.

Please drop a comment if any reason exists which blocks updating to version 0.1.3 at this time.

Note: This is an automatically generated message and not personally authored by bluefox!
@mcm1957 for evidence

Compatibility check to js-controller 3.3 and Admin5 React UI

Dear Adapter developer,

with js-controller 3.2 and js-controller 3.3 some additional checks were added to make sure that created objects match to the specifications and also written state values match to the object definition.

If something is not correct this is logged as 'warning' or 'info' log.

Please take the time to verify your adapter by ideally starting with a fresh instance and do some actions and verify the log. If you see a warn log there from these checks please adjust the adapter and fix the relevant cases.

For questions please refer to ioBroker/ioBroker.js-controller#1301

Additionally we are preparing Admin 5 which will have a completely rewritten UI. Please install Admin 5, activate that new UI and verify that the configuration of you adapter works as expected also there.

More informations on Admin 5 can be found in Forum https://forum.iobroker.net/topic/44282/test-adapter-admin-5-0-x-alpha-der-neuen-ui

Please close the issue after you checked it.

Thank you very much for your support!

Compatibility check to js-controller 4.0

Dear Adapter developer,

with js-controller 4.0 object definitions are now also checked that min/max in only provided for number/mixed objects and that the type of the default value matches to the object type.

If something is not correct this is logged as 'warning' or 'info' log.

Please also make sure to update to the lastest @iobroker/testing dependency 2.5.4 or to accept the PR from Apollon77 for legacy testing!

Please spent some time to verify your adapter by ideally starting with a fresh instance and do some actions and verify the log. If you see a warn or info log there from these checks please adjust the adapter and fix the relevant cases.

For questions please refer to ioBroker/ioBroker.js-controller#1749

Please close the issue after you checked it.

Thank you very much for your support to get the best experience for the growing numbers of ioBroker users!

Update stable version in repo from 0.1.1 to 0.1.2

Think about update stable version to 0.1.2

Version: stable=0.1.1 (287 days old) => latest=0.1.2 (15 days old)
Installs: stable=57 (62.64%), latest=8 (8.79%), total=91

Click to use developer portal
Click to edit

Do not close this issue manually as a new issue will be created if condition for update still exists.

Please drop a comment if any reason exists which blocks updating to version 0.1.2 at this time.

Note: This is an automatically generated message and not personally authored by bluefox!
@mcm1957 for evidence

An in-range update of @iobroker/adapter-core is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye πŸ‘‹ and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The dependency @iobroker/adapter-core was updated from 2.2.1 to 2.3.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@iobroker/adapter-core is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 67 commits.

  • 2fdeeaa Release v2.3.0
  • 3836d11 Merge pull request #211 from ioBroker/dependabot/npm_and_yarn/types/node-13.11.1
  • 5128f3a Merge pull request #209 from ioBroker/dependabot/npm_and_yarn/eslint-plugin-prettier-3.1.3
  • 187669d chore(deps-dev): bump @types/node from 13.11.0 to 13.11.1
  • a7b17c2 chore(deps-dev): bump eslint-plugin-prettier from 3.1.2 to 3.1.3
  • 4cff9e6 Merge pull request #207 from ioBroker/dependabot/npm_and_yarn/types/sinon-chai-3.2.4
  • 65d5a63 Merge pull request #208 from ioBroker/dependabot/npm_and_yarn/types/node-13.11.0
  • d7a13fc Merge pull request #205 from ioBroker/dependabot/npm_and_yarn/ts-node-8.8.2
  • 4a0373b chore(deps-dev): bump @types/node from 13.9.5 to 13.11.0
  • 46b8a9d chore(deps-dev): bump @types/sinon-chai from 3.2.3 to 3.2.4
  • 67bcb28 chore(deps-dev): bump ts-node from 8.8.1 to 8.8.2
  • 5f95ad5 Merge pull request #203 from ioBroker/dependabot/npm_and_yarn/types/node-13.9.5
  • cade7f4 chore(deps-dev): bump @types/node from 13.9.3 to 13.9.5
  • 799b881 Merge pull request #199 from ioBroker/dependabot/npm_and_yarn/types/node-13.9.3
  • c728713 Merge pull request #200 from ioBroker/dependabot/npm_and_yarn/mocha-7.1.1

There are 67 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @iobroker/plugin-sentry is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye πŸ‘‹ and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The dependency @iobroker/plugin-sentry was updated from 1.0.1 to 1.0.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@iobroker/plugin-sentry is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Please fix npm package content - npm must not install .github, .vscode, ...

Describe the bug
npm package conatis too many files as .npmignore is missing and no files section exists.

To Reproduce
see content of npm package at npmjs.com

Expected behavior
A clear and concise description of what you expected to happen.
npm package should only install files necessary to provide functionality.

Screenshots & Logfiles
image

Versions:

  • Adapter version: 0.1.2
  • JS-Controller version: n/a
  • Node version: n/a
  • Operating system: n/a

Additional context
Add any other context about the problem here.

An in-range update of @types/node is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye πŸ‘‹ and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency @types/node was updated from 13.7.7 to 13.9.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

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.