Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bluesound to latest #4089

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add bluesound to latest #4089

wants to merge 1 commit into from

Conversation

mcm1957
Copy link
Collaborator

@mcm1957 mcm1957 commented Sep 29, 2024

No description provided.

@github-actions github-actions bot added the auto-checked This PR was automatically checked for obvious criterias label Sep 29, 2024
Copy link

Automated adapter checker

ioBroker.bluesound

Downloads Number of Installations (latest) - Test and Release
NPM

👍 No errors found

  • 👀 [W401] Cannot find "bluesound" in latest repository
  • 👀 [W951] .npmignore found but "files" is used at package.json. Please remove .npmignore.

Add comment "RE-CHECK!" to start check anew

@mcm1957 mcm1957 added (RE-)REVIEW pending (mcm1957) Changes requested by review have been applied, re-review could be done. New at LATEST and removed auto-checked This PR was automatically checked for obvious criterias labels Sep 29, 2024
@mcm1957 mcm1957 mentioned this pull request Sep 29, 2024
@mcm1957
Copy link
Collaborator Author

mcm1957 commented Sep 29, 2024

@Uwe1958

Thanks for spending your time and providing a new adapter for ioBroker.

Your adapter will get a manual review as soon as possible. Please stand by - this might last one or two weeks. Feel free to continue your work and create new releases. You do NOT need to close or update this PR in case of new releases.

In the meantime please check any feedback issues logged by automatic adapter checker and try to fix them.

You will find the results of the review and eventually issues / suggestings as a comment to this PR. So please keep this PR watched.

If you have any urgent questions feel free to ask.

reminder 6.10.2024

@mcm1957
Copy link
Collaborator Author

mcm1957 commented Oct 4, 2024

@Uwe1958

First of all - THANK YOU for the time and effort you spend to maintain this adapter.

I would like to give some feedback based on my personal oppinion. @Apollon77 might have additional suggestions or even a different oppinion to one or the other statement. Please feel free to contact him if you cannot follow my suggestions or want to discuss some special aspects.

  • Readme.md cosmetics (non blocking)

    List of supported commands should be formatted as list (ev. add two spaces at EOL to force linebreak or use '-')

  • Parameter timeout and pollinTime - suggest to use type number

    Any reason to use "text" for parameter timeout and Pollingtime instead of number? As the data must be entered as number, the parameters should be of type number.

  • jsonConfig responsive design

    Please add missing sizes (xs, xl)
    see https://github.com/ioBroker/ioBroker.admin/blob/master/packages/jsonConfig/SCHEMA.md#common-attributes-of-controls

  • handle missing IP Address

    If no IP address is configured the adapter trys to initialize axios anyway. This will likely result in an exception. Adapter should terminate or do "nothing" if no IP is set

  • subscribing to objects

    Why do you subscribe to all states? Subscribing makes sense only if you will react on changes to the object - so subscribing is useful for writeable objects only - at least in most cases.

    In addition states should be subscribed only once as multiple subscribes could cause use of unneded resources and result in multiple notifications.

  • Object Ids

    setState(Async) should be called without instance prefix as it always addresses the own instance. Only calls to setForeignState(Async) must provide the instance information (namespace)

  • invalid characters should be filtered from object ids

    Some characters are not allowed to be used as part of an object id. If an object id is not hardcoded or even depending on user input you should ensure that such an object id does not contain an invalid character. Iobroker provides the constant adapter.FORBIDDEN_CHARS, i.e. by using the following snippet:

function name2id(pName) {
    return (pName || '').replace(adapter.FORBIDDEN_CHARS, '_');
}

Some state Ids seem to be constructed by preset names retrieved from external device. Those names must be filtered to remove illegal characters. Buest prxis is to limit to A-Za-z0-9, but using FORBIDDEN_HARS is OK too. Spaces and dots MUST be removed in addion as severla vis cannot handle spaces within stateIds and dot have special meaning (folder seperation)

  • Code to create preset objects missing?

    I did not see code to create sobjects / states defined by presets. Please indicate or use setObjectNotexists/exztendObject calls.

  • Consider removing example code (non blocking)

    I would suggest to remove example code from source to ease reading. But that's not blocking of course.

  • onStateChange handler ignores ack flag

    The adapter must honor the ack flag when processing onStateChange events. Whenever the onStateChange handler is called for an own state (a state owned by the processing instance of the adapter) it must ignore this event if the ack flags is set. Only stateChanges with ack==false are allowed to be processed.

    When processing foreign states which are output of another adapter processing must only occure if the ack flag is true.

  • reevaluate state roles

    Only the values specified here (https://github.com/ioBroker/ioBroker.docs/blob/master/docs/en/dev/stateroles.md) may be used as state roles. Do not invent new names as this might disturb the functionalyity of other adapters or vis.

    In addition the roles MUST match the read/write functionality. As an example a role value.* requires that the state is a readable state. Input states (write only) should have roles like level.*. Please read the description carefully. States with role 'button' should (must) have attribute 'common.read=false' set. A button ( "Taster" in german only triggers when you press but else has no state), so it should also be not readable. This is also like HomeMatic does it. A switch has clear states true or false and so can be read.

    Writeable states must not have role value use level instead (or i.e. level.volume).

  • Timer must be stopped at onUnload

    All timer / intervals must be stopped at onUnload

  • check and limit configurable timeouts / intervals

    Node setTimeout/setInterval routines have a maximum allowed value of 2,147,483,647 ms. Using delays larger than 2,147,483,647 ms (about 24.8 days) result in the timeout being executed immediately. So all (user configurable) values passed to setTimeout / setInterval should be checked in code and limited. Checking/limiting in code is required as config data could be changed directly or by some other adapter too, so limiting at ui level might not be sufficient.

  • prefer setTimeout over setInterval

    When using setInterval please ensure that all oprations are completed before the next interval starts. This requires that the interval time must be lager than the sum of all timeout from multiple calls within a cycle. Otherwise a new interval could be started while the old one is still in progress. This might sum up, consume more and more resources and finally crash the complete ioBroker installation.

  • adapt testing to supported node releases

    Tests for node 18 are mandatory as this is the recommended node version unless adapter requires node 20 minimum.
    Tests for node 20 are mandatory as this is the recommended node version.
    Tests for node 22 are mandatory unless you already know incompatibilities which cannot be fixed immidiatly. In this case please create a issue stating the problem and fix as soon as possible.

    So the recommended testmatrix is [18.x, 20.x, 22.x] depending on engines requirments setting at package.json

    Tests must be performed at all supported platforms (linux, windows, mac) unless special hardware or software restrictions prohibit this.

Thanks for reading and evaluating this suggestions.
McM1957

Please add a comment when you have reviewed and fixed the suggestionsor at least commented the suggestions and you think the adapter is ready for a re-review!

reminder 11.10.2024

@github-actions github-actions bot added 11.10.2024 remind after 11.10.2024 and removed 6.10.2024 labels Oct 4, 2024
@mcm1957 mcm1957 added must be fixed The Adapter request got review/automatic feedback that is required to be fixed before another review and removed (RE-)REVIEW pending (mcm1957) Changes requested by review have been applied, re-review could be done. labels Oct 4, 2024
@Uwe1958
Copy link

Uwe1958 commented Oct 5, 2024

@mcm1957

Thanks for your feedback. I started fixing the issues as requested.

One problem though:

Regarding your request on setState() I always have to add the instance prefix (in fact it is always automatically entered when I type setState) .

Without the instance prefix I get the error

error: bluesound.0 (300351) unhandled promise rejection: setState is not defined
error: bluesound.0 (300351) ReferenceError: setState is not defined

Can you tell me how I can solve the issue raised.

Thanks.

@github-actions github-actions bot added the *📬 a new comment has been added label Oct 5, 2024
@mcm1957
Copy link
Collaborator Author

mcm1957 commented Oct 5, 2024

im referring tonthe state id.

rhis.setState is ok an required.
To set the dtate control.volume its sufficient to use this.setStste('control.volume', ...). Rhe full pathvincludibg bluesound.0. would require setForeignStste othwise the adapter bame will be duplicated atcstste id.

@Uwe1958
Copy link

Uwe1958 commented Oct 5, 2024

@mcm1957

Thanks got it now: ObjectId to omit the instance.

@mcm1957 mcm1957 removed the *📬 a new comment has been added label Oct 6, 2024
@Uwe1958
Copy link

Uwe1958 commented Oct 9, 2024

Code to create preset objects is included within onReady using the result from the /Presets call. It returns the 'id' used for the ObjectId always as a number like 1, 2 ... To be really sure I will include the replacement of FORBIDDEN_CHARS as requested.

The objects are then created dynamically using setObjectNotExistsAsync using the helper function (via utils.js). The names are hardcoded there and thus should not create any problems with special characters.

@github-actions github-actions bot added the *📬 a new comment has been added label Oct 9, 2024
@Uwe1958
Copy link

Uwe1958 commented Oct 11, 2024

@mcm1957
Changes are made as requested. Please advice whether I should create a new release after your review or how to proceed.
Thanks
Uwe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
11.10.2024 remind after 11.10.2024 *📬 a new comment has been added must be fixed The Adapter request got review/automatic feedback that is required to be fixed before another review New at LATEST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants