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

@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

@simatec
Copy link
Contributor

simatec commented Jan 11, 2025

jsonConfig is ok...

@github-actions github-actions bot added the *📬 a new comment has been added label Jan 11, 2025
@mcm1957 mcm1957 removed the *📬 a new comment has been added label Jan 12, 2025
@mcm1957

This comment was marked as outdated.

@mcm1957
Copy link
Collaborator

mcm1957 commented Jan 22, 2025

@ronny130286

To verify the Object structure of this adapter during RE-REVIEW please export the object structure of a working installation and attach the file in addtion to fixing or commenting the issues mentioned above. You find a guide how to export the object struture here: https://github.com/ioBroker/ioBroker.repochecker/blob/master/OBJECTDUMP.md

Thanks

@mcm1957

This comment was marked as outdated.

@mcm1957 mcm1957 added the stale PR seems has no activity, will be closed after some time label Jan 31, 2025

This comment was marked as outdated.

@mcm1957

This comment was marked as outdated.

@ronny130286
Copy link
Author

Hello, sorry i read it too late, i'm trying to fix the open positions as soon a possible.

@github-actions github-actions bot added the *📬 a new comment has been added label Feb 12, 2025
@mcm1957 mcm1957 removed stale PR seems has no activity, will be closed after some time *📬 a new comment has been added labels Feb 12, 2025
@mcm1957
Copy link
Collaborator

mcm1957 commented Feb 12, 2025

reminder 26.2.2025

@ronny130286
Copy link
Author

ankersolix2.0.json

@github-actions github-actions bot added the *📬 a new comment has been added label Feb 14, 2025
@ronny130286
Copy link
Author

ronny130286 commented Feb 16, 2025

@mcm1957

  • io-package.json should require up to date js-controller and admin version
  • Why do you list typescript as dependency?
  • sensitive information, especially passwords should be stored encrypted
  • config parameters should be defined at 'native'
  • avoid usage of setObject
  • invalid characters should be filtered from object ids
  • unused onStateChange handler
  • Add timeout to axios calls
  • check and adapt testing
  • adapt testing to supported node releases
  • check and limit configurable timeouts / intervals
  • linter setup

@github-actions github-actions bot deleted a comment from mcm1957 Feb 16, 2025
@github-actions github-actions bot deleted a comment from ronny130286 Feb 17, 2025
@mcm1957 mcm1957 added RE-REVIEW pending (by mcm1957) Changes requested by review have been applied, re-review could be done. and removed must be fixed The Adapter request got review/automatic feedback that is required to be fixed before another review *📬 a new comment has been added labels Feb 21, 2025
@github-actions github-actions bot deleted a comment from mcm1957 Feb 21, 2025
@mcm1957
Copy link
Collaborator

mcm1957 commented Feb 21, 2025

WORK IN PROGRESS - This is a review checklist only - IGNORE FOR NOW

  • 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

@mcm1957
Copy link
Collaborator

mcm1957 commented Feb 21, 2025

@ronny130286

Thnaks a lot for your work.
The following remarks need some attention:

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

    This remark is still open / unanswered

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

    The last sentence got lost. Please add config paramaters to native section.

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

    Expression "this.config.POLL_INTERVAL < 10 && this.config.POLL_INTERVAL > 3600)" is always false :-) see https://github.com/ronny130286/ioBroker.ankersolix2/blob/bc4251d9ec84669eca8a31438dd9419249fbe29f/src/main.ts#L51

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

    Several intermediate objects are not created correctly. I.e. objects are missing for EXTRA, eneryanalyses, eneryanalysys.day etc.
    Please expand the objectview of your adapter adn check that ALL entries have a valid TYPE listed.

  • Folder eneryanalyses should most likely be enerGyanalyses

re

  • Why do you split unit and values?
    Why do you split the value und the unit into two seperated states? It would be better to use the available fiels unit fpr the units. See last remark. (no blocking)

  • Consider using roles
    Evaluate to set correct roles for states. Currently all values use role "value". This is correct but not optimal. There are better matching roles available. See https://github.com/ioBroker/ioBroker.docs/blob/master/docs/en/dev/stateroles.md

In general I would suggest to implement a table of known states / values delivered by the adapter. Those should be staored as states with oprimized roles and units. If anker some time in future adds new information, this information could be added by an update. This approach also has the benefit that the adapter could keep its state structure even if anker changes the api or names returned by the api. Please let me know about this suggestion. I do not consider this blocking as I do not want to force some implementation but I think it would be good practice.

Please attach a new objectdump after fixing creation of intermediate objects.
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 7.3.2025

@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 (by mcm1957) Changes requested by review have been applied, re-review could be done. labels Feb 21, 2025
@github-actions github-actions bot added 7.3.2025 remind after 7.3.2025 and removed 26.2.2025 labels Feb 21, 2025
@ronny130286
Copy link
Author

ronny130286 commented Feb 26, 2025

  • Readme angepasst mit Herstellerlink

  • Überprüfung des Intervall-Limits angepasst

  • Objekte Erstellung angepasst, incl. Rechtschreibfehler korrigiert

  • Das Splitting zwischen Unit und Value, wird durch die Response vorgegeben.

  • config parameters should be defined at 'native' -> verstehe ich nicht ganz und auch der Link zeigt auf eine alte io-package.json, in der Neuen ist das nicht enthalten

  • hier noch mal die aktuelle Objekt JSON ankersolix2.json

@github-actions github-actions bot added the *📬 a new comment has been added label Feb 26, 2025
@github-actions github-actions bot deleted a comment from ronny130286 Feb 28, 2025
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7.3.2025 remind after 7.3.2025 *📬 a new comment has been 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 new at LATEST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants