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 maxxi-charge to latest #4359

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

Conversation

blabond
Copy link

@blabond blabond commented Dec 8, 2024

Please add my adapter ioBroker.maxxi-charge 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 8, 2024
@mcm1957
Copy link
Collaborator

mcm1957 commented Dec 8, 2024

@blabond
Please (at east try to) fix issues reported by automatic checker. I'll do a review after those issues are fixed.
Please let us know if you need any help or have some questions.

@mcm1957
Copy link
Collaborator

mcm1957 commented Dec 8, 2024

In addition it looks like you have disabled issues at this repository.

Please enable issues at the repository to allow registering problems and suggestions.

@github-actions github-actions bot added the *📬 a new comment has been added label Dec 8, 2024
@github-actions github-actions bot deleted a comment from blabond Dec 8, 2024
@github-actions github-actions bot deleted a comment from blabond Dec 8, 2024
@github-actions github-actions bot deleted a comment from blabond Dec 8, 2024
@blabond
Copy link
Author

blabond commented Dec 8, 2024

Hi, I don't know how to fix the current warning with (Cannot find "maxxi-charge" in latest repository). Can you help me?

@mcm1957
Copy link
Collaborator

mcm1957 commented Dec 8, 2024

This warning can be irgnore for now as the adapter is not yet released to stable.

@mcm1957 mcm1957 added RE-REVIEW pending (by mcm1957) Changes requested by review have been applied, re-review could be done. REVIEW pending (by mcm1957) 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 RE-REVIEW pending (by mcm1957) Changes requested by review have been applied, re-review could be done. labels Dec 8, 2024
@mcm1957
Copy link
Collaborator

mcm1957 commented Dec 9, 2024

reminder 15.12.2024

@github-actions github-actions bot added the 15.12.2025 remind after 15.12.2025 label Dec 9, 2024
@blabond
Copy link
Author

blabond commented Dec 9, 2024

Hello @mcm1957 and sorry to ask. Do I have to do something by December 15th? The topic of publishing an iobroker adapter is new to me.

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

mcm1957 commented Dec 9, 2024

No, thats a reminder for me only :-)
Thnaks for asking

@mcm1957 mcm1957 removed the *📬 a new comment has been added label Dec 9, 2024
@blabond
Copy link
Author

blabond commented Dec 9, 2024

okay, that's a long reminder until 2025 :)

@github-actions github-actions bot added *📬 a new comment has been added 15.12.2024 and removed 15.12.2025 remind after 15.12.2025 labels Dec 9, 2024
@mcm1957 mcm1957 removed the *📬 a new comment has been added label Dec 10, 2024
@github-actions github-actions bot deleted a comment from mcm1957 Dec 18, 2024
@mcm1957
Copy link
Collaborator

mcm1957 commented Dec 18, 2024

@blablond

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.

  • errors reported by adapter checker must be fixed

    Please remove https://github.com/blabond/ioBroker.maxxi-charge/blob/9766b6909b42afed443364508d23cfbf884d4b9f/io-package.json#L36

  • Readme.md must be written in pure english

    As ioBroker is an international software supporting several languages the main Readme.md file must be written in english. Its ok to add additional Readme-.mds of course. You may use dedicated files at doc directory and link them at README:md too (see https://github.com/eifel-tech/ioBroker.syrconnect#iobrokersyrconnect as an example).

  • 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. Admin dependency seems to be missing. So please add / adapt at io-package.json:

          "dependencies": [
              {
                  "js-controller": ">=5.0.19"
              }
          ],
          "globalDependencies": [
              {
                  "admin": ">=6.1714"
              }
          ]
    
  • please verify that all dependencies are up to date

    Why did you remove most standard ioBroker tools?
    Please consider to (re)add releasescript and

    "devDependencies": {
      "@alcalzone/release-script": "^3.8.0",
      "@alcalzone/release-script-plugin-iobroker": "^3.7.2",
      "@alcalzone/release-script-plugin-license": "^3.7.0",
      "@alcalzone/release-script-plugin-manual-review": "^3.7.0",
      "@iobroker/adapter-dev": "^1.3.0",
    

    releasescript supports releasing a new release. You should really give it a try. And adapter-dev will be neede for i18n translations.

    Please also add the corresponding scipts. See ioBroker.examples repo for usual setup.

  • log messages must be in english

    As ioBroker is an international software, please use only english wording for all logging messages (this.log.xxx). German only logs are not desired. This refers to all text defined by you - error messages returned from aservice (external text) can be logged as is of course. And of course text designated to any vis can be supported in multiple languages (including english as mandatory langugae).

  • parameter 'regelAktiv'

    io-package defines a paramzter (at native) 'regelAktiv'. This shoul dbe named in english.

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

You seem to retreive stateIds (or at least some part of stateIds from external sources. This dat must be filter to remove illegal characters. I did not see where this is done. Please add or davice how you filter illegal characters from state Ids.

In addition please attach a json dump of the objects (states) created by the adapter from a working innstallation.

  • State Id, names and descriptions

    All stateIds must use english wording.

    All state names and descriptions must either use engloish wording or use a i18n multilingual object containing all supported languages. (You may use https://translator-ui.iobroker.in/ to generate translations)

  • creation of nested objects

    When using some structure for states like 'a.b.c' you must create intermediate objects (a and b in this example). 'a' and ' must be objects of type device or channel or folder depending on the structure. I did not see that an other objects with a type different to 'state' is created. So most likely intermediate objects are missing. (I'll check against exported json of objects mentioned above).

    As an example object (folder?) claoud and local seem to be created nowhere.
    https://github.com/blabond/ioBroker.maxxi-charge/blob/547c7491a445f7145e26501002d6e0a3a12694cd/main.js#L113

  • invalid defaults

    Default values for states should be within max/min ragne if such a range is specified
    see: https://github.com/blabond/ioBroker.maxxi-charge/blob/547c7491a445f7145e26501002d6e0a3a12694cd/main.js#L35

  • redundant code

    https://github.com/blabond/ioBroker.maxxi-charge/blob/547c7491a445f7145e26501002d6e0a3a12694cd/main.js#L168

    Why do you check if an object exists if you use setObjectNotExists afterwards? setObjectNotExists does this check anyway so you can use setObjectNotExists if you want to add an object if it doies not yet exist.

    Why do you use extend object immidiatly after setObjectNotExists? You cann pass the min and max options to setObjectNotExists itself.

  • usage of extendObject

    Why do you check if any paramaters are different at https://github.com/blabond/ioBroker.maxxi-charge/blob/547c7491a445f7145e26501002d6e0a3a12694cd/main.js#L198 ? extendObject adapts the object if a mismatch exists anyway. So reading the object first to perform this check could be omitted.

  • cache existing states

    Do not call setObjectNotExists whenever a state should be written. This causes unneeded load to read the states DB. Adapt ensureStateExists to cache known stateIds and to call setObjectNotExists only once after every restart of the adapter.

  • ensure intermediate Objects to be created at ensureStateExists

    You mus ensure that all intermediate objects exist whenever ensureStateExists tries to create a new state object.

  • cache local ip address

    As the local ip address will not change during the runtime of the adapter, you should avoid to query system db whenever a statechange is performed. You can (and already do) query the local ip during adapter start and store it a local variuable, This removes uneeded load from system database

    see https://github.com/blabond/ioBroker.maxxi-charge/blob/547c7491a445f7145e26501002d6e0a3a12694cd/main.js#L279

  • hardcoded ip Address

    Why do you access the cloud service by an hardcoded ip address? Using the correct FQDN seems to be the besster solution as
    the ip might change at any time and the provider might add a load balancer too. So hardcoding an eternel ip address is at least very unusual. see https://github.com/blabond/ioBroker.maxxi-charge/blob/547c7491a445f7145e26501002d6e0a3a12694cd/cloudApi.js#L6

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

    onStateChange code handled by ecoMode module seems to ignore ack flag. Please correct.

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

    Please avoid using general roles (state, value) whenever a dedicated role exists.

    States using role "value" must not have "write":true attribute set. 'value'is a read only role.

    States dynamically created seem to have no role set at all (but this can be verified by the to be supplied jsjosn dump of states mentioned before)

  • some labels seem to have no translation into all languages

    Labels at jsonConfig.json must either be in english and translated into all supported languages using i18n environment or (not recommended) added as i18b multilingual objetcs containing transaltions in all supported languages.

    Use english text at jsonConfig.json, add the test as key into i18n/en/translations.json and run 'npm run translate' to generate other languages. (Note: installation of adapter-dev required)

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

  • consider using adapter.setTimeout / this.setTimeout instead of (standard) setTimeout

    The adapter package provides wrapper routines for native setTimeout, setInterval, clearTimeout and clearInterval. Using those routines ensures that timers are cancelled on on load. Additional checks on thomse limits might be performed, too. So consider replacing native setTimeout/clearTimeout by adapter.setTimeout/adapter.clearTimeout or this.setTimeout/this.clearTimeout. The same refers to setInterval/clearInterval.

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

    ccuInterval seesm to be configurable but is not limited to resonable values.

  • check and limit intervals used to access cloud services

    Limit all intervals used to access cloud services to a reasonable value. If users configure an inapprobiate access rate this could lead to suspending the service by the provider for all ioBroker users.

  • 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

    As node 16 is end of life and will no longer be supported ioBroker github based tests removing node 16.x tests from matrix if still present.
    Tests for node 18 are mandatory as this is the recommended node version.
    Tests for node 20 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] 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 if acceptable. This is located at @iobroker/eslint-config. See migration guide at https://github.com/ioBroker/ioBroker.eslint-config/blob/main/MIGRATION.md.

  • github dependabot support seems to be missing

    It looks like you did not yet setup dependabot support; at least .github/dependaboit.yml is missing.

    Please consider setting up dependabot support (and to ease life the workflow auto-merge.yml). Dependabot will ensure that your adapter uses the most recent versions of external packages and avoids problem due to outdted base libraries. Dependabit provides PRs at you repository to update the dependencies. Depending on you setting, especially on auto-merge.yml configuration no or only minor revisions will be outmatically merged into you main branch. All major revisions msiut (ans should) be reviewed by you.

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 1.1.2025

@github-actions github-actions bot added 1.1.2025 remind after 1.1.2025 and removed 15.12.2024 labels Dec 18, 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 REVIEW pending (by mcm1957) 1.1.2025 remind after 1.1.2025 labels Dec 18, 2024
@github-actions github-actions bot added 1.1.2025 remind after 1.1.2025 *📬 a new comment has been added labels Dec 18, 2024
@github-actions github-actions bot deleted a comment from blabond Dec 23, 2024
@github-actions github-actions bot deleted a comment from blabond Dec 23, 2024
Copy link

Automated adapter checker

ioBroker.maxxi-charge

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

👍 No errors found

  • 👀 [W401] Cannot find "maxxi-charge" in latest repository

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

@blabond
Copy link
Author

blabond commented Dec 23, 2024

Hello @mcm1957,

Thank you very much for reviewing my adapter. That turned out to be quite a long list.
I hope I have implemented all the points satisfactorily so that it now meets the standards of ioBroker.

The only thing I haven't understood yet is what needs to be done regarding the "linter setup," but I have implemented everything else.

Best regards and happy holidays!

@mcm1957
Copy link
Collaborator

mcm1957 commented Dec 23, 2024

Thanjs for dast response.
I 'll come back after holidays. Sorry for delay.I'm quite sure that I do not gave time the next 3 or 4 days ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.1.2025 remind after 1.1.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.

2 participants