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 ankersolix2 to latest #4354

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

Conversation

ronny130286
Copy link

Please add my adapter ioBroker.ankersolix2 to latest.

This pull request was created by https://www.iobroker.dev c0726ff.

@github-actions github-actions bot added auto-checked This PR was automatically checked for obvious criterias must be fixed The Adapter request got review/automatic feedback that is required to be fixed before another review labels Dec 6, 2024
@mcm1957
Copy link
Collaborator

mcm1957 commented Dec 6, 2024

reminder 13.12.2024

Copy link

github-actions bot commented Dec 9, 2024

Automated adapter checker

ioBroker.ankersolix2

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

👍 No errors found

  • 👀 [W401] Cannot find "ankersolix2" in latest repository

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

@mcm1957
Copy link
Collaborator

mcm1957 commented Dec 17, 2024

@ronny130286

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 should contain a link to the manufacturer and/or device

    The README.md of any adapter related to device or m ultiple devices of a manufacturer should contain a link the manufacturers website and/or to a description of the device. This is to anable new users to easily check wether they associate the adapter with the correct device(s). (See https://github.com/ioBroker/ioBroker.repositories#requirements-for-adapter-to-get-added-to-the-latest-repository paragraph 4.)

  • io-package.json should require up to date js-controller and admin version

    New adapters should request js-controller 5 and admin 6 as minimum if there are no strong reason to support (and test) older releases. So please add / adapt at io-package.json:

          "dependencies": [
              {
                  "js-controller": ">=5.0.19"
              }
          ],
          "globalDependencies": [
              {
                  "admin": ">=6.17.14"
              }
          ]
    

    js-controller 5.1.13 does not exist. So either require 5.0.19 or for new adapters most likely better) require js-controller 6 (6.0.11).

    admin should be at least 6.17.14

  • Why do you list typescript as dependency?

    Do you really need typescript as dependency so that it is installed at the target system? Normally typescript is used only during compilation / building and hence typescript should be a devDependency only. In any case listing typescritp as devDependency AND as dependency is incorrect.

  • sensitive information, especially passwords should be stored encrypted

    You configuration seems to contain passwords (or other sensitive information) which is not stored encrypted. As long as those information is not stored inside a table you can encrypt and secure this infomation simply by adding the following configuration to io-package.json. The iob runtime will encrypt / decrypt the data as required; no addition programming effort is required. Note that users will need to reenter this info one time after adding encryption, so drop a note at release notes.

    "encryptedNative": [
      "password",
      "data2"
    ],
    "protectedNative": [
      "password",
      "data2"
    ],
    
  • config parameters should be defined at 'native'

    io-package.json 'native' contains dummy parameters (https://github.com/ronny130286/ioBroker.ankersolix2/blob/a541dd2dcb3eb40fb76408441a8daa700cf57b0e/io-package.json#L138) as option1 and option2 are NOT used by the adapter. But the parameters defined at jsonCOnfig are missing and should be added at 'native' section.

  • avoid usage of setObject

    setObject(Async) creates a new object whenever it is called. You should avoid using setObject unless you really want to create new objects. Creating a new object deletes any userConfig, i.e. configures history logging which is most likely not desired. Most likely either setObjectNotExists oder (even better in most cases) extendObject should be used. Extend Object ensures that attributes like role, read/write flag etc. are set as specified and hence extendObjet should be preferred when called once during startup of the adapter.

    Most likely the complet function CreateOrUpdate can be replaced by call to extendObject which creates a new object if it does not exist and updates an exiting one.

    see https://github.com/ronny130286/ioBroker.ankersolix2/blob/a541dd2dcb3eb40fb76408441a8daa700cf57b0e/src/main.ts#L331

  • 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, '_');
}

It looks like stateIds are retrieved frome xternal sources (from the Api). I did not see any place where the required filtering to remove illgal characters is done. Please add or explain / link to the filtering code.

  • Objects must be created at all levels

    It looks like intermediate Objects (i.e. b in A.B.C) are not explicitly created. Please attach the object json from a working installation to verify the object structure.

  • unused onStateChange handler

    You configred an onStateChange handler but it looks like this handler does not do any important tasks. Please remove the handler if the adapter does not react on state changes.

  • unused writeable states

    Code creates (or at least can create) writeable states. As there is no subscription and not onStateChange handler, this does not make sense. Please set "write" Attribute for all states to false.

  • Add timeout to axios calls

    All axios calls should have a timeout set. The default value for axios timeout is 0 which results in no timeout. So an unresponsive remote system could lead to an hanging adapter. Either set an appropiate timeout per axios call or set a default timeout globally for the axios instance.

  • 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.

  • check and adapt testing

    Standard iobroker testing is required but seems to be missing. Please add and setup ./gizthub/workflows/test-and-release.yml

    Please use standard iobroker test-and-release.yml workflow like
    https://github.com/ioBroker/ioBroker.example/blob/master/JavaScript/.github/workflows/test-and-release.yml

  • adapt testing to supported node releases

    Tests for node 20 are mandatory as this is the recommende node release.
    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 [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.

  • linter setup

    Please use standard iobroker linter setup. This is located at @iobroker/eslint-config. See migration guide at https://github.com/ioBroker/ioBroker.eslint-config/blob/main/MIGRATION.md

Thanks for reading and evaluating this suggestions.
McM1957

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

reminder 31.12.2024

@github-actions github-actions bot added 31.12.2024 remind after 31.12.2024 and removed 13.12.2024 labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
31.12.2024 remind after 31.12.2024 auto-checked This PR was automatically checked for obvious criterias 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