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 fyta to latest #4514

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

Conversation

muffin142
Copy link

Please add my adapter ioBroker.fyta to latest.

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

@github-actions github-actions bot added the auto-checked This PR was automatically checked for obvious criterias label Jan 31, 2025
Copy link

ioBroker repository information about New at LATEST tagging

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. And please check the following information if not yet done:

Important:

To verify the object structure of this adapter during REVIEW please export the object structure of a working installation and attach the file to this PR. You find a guide how to export the object struture here: https://github.com/ioBroker/ioBroker.repochecker/blob/master/OBJECTDUMP.md

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

If you have any urgent questions feel free to ask.
mcm1957

@simatec Please take a look in respect to responsive design. Thanks

@mcm1957 mcm1957 added the obj-json missing The reuqsted dump obj objects in json format is missing label Jan 31, 2025
@mcm1957

This comment was marked as outdated.

@muffin142
Copy link
Author

Please find object dump attached

fyta.0.json

@github-actions github-actions bot added the *📬 a new comment has been added label Feb 8, 2025
@mcm1957 mcm1957 removed *📬 a new comment has been added obj-json missing The reuqsted dump obj objects in json format is missing labels Feb 8, 2025
@mcm1957
Copy link
Collaborator

mcm1957 commented Feb 13, 2025

@muffin142

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

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

  • Object type hirarchie

    Please note that only ONE object of type 'device' is allowed within the hirarchie. The structure must be
    [device] [- channel ..] - state. 'Device' may be omitted but if present channel must be below device. 'Channel' can be used multiple times. 'States' must not have any children. In addition objects of type 'folder' can be present at any level.

  • structure of jsonConfig is invalid

    i18n is not an object containing translations but a single attribute with boolean avlue (true/false).
    if i18n is true translation data is placed in files located at i18n subtree. You only have to fill in the english version (i18b/en/translations.json and execute npm run translate to populate other languages.
    If i18n is set to false (NOT recommended) you may insert the translaations directly inot jsonConfig.json as multilanguage objects just like you did at io.package.json. But note that translation into all supported ioBroker languages is mandatore. You can use https://translator-ui.iobroker.in/ to generate the objects. But using i18b external files is recommended as this enables the usage ob weblate to gain support from external human translators too.

  • jsonCostum.json5 seems to be invalid

    I did not detect handling of custom attributes by your adapter. If I'm correct and did not miss something, please remove jsonCostum.json5. And please remove common.supprtsCustom from io-package.json too in this case (https://github.com/muffin142/ioBroker.fyta/blob/704eb0f0b6e315e81f4549c693b10308a58547b1/io-package.json#L77)

  • outdated words.js

    words.js seems to be outdated and is empty. JsonConfig does not use this file at all. So please remove the file.

  • i18n entries must support all languages

When using multilangugae support at objects those entries must contain all supported languages. See https://github.com/muffin142/ioBroker.fyta/blob/704eb0f0b6e315e81f4549c693b10308a58547b1/io-package.json#L140. You can use https://translator-ui.iobroker.in/ to generate i18n blocks.

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

  • reenable testing

    Standard iobroker testing is required but is disabled. Please activate standard ./github/workflows/test-and-release.yml again. Of course its ok to add addional tests but standard github based tests must be active and named as provided by default to enable semi automatic checks.

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

  • deleting of objects

    Not sure if deleting all objects is really a good idea as this will invalidate all custom configuration (i.e. history settings). But as it's an option set by the user this functionality is acceptable. BUT your code will delte info objects for any instance other than instance 0. This must be fixed. See https://github.com/muffin142/ioBroker.fyta/blob/704eb0f0b6e315e81f4549c693b10308a58547b1/main.js#L47

  • error handling

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!

PLease add a new object dump after fixing type hirarchy

reminder 27.2.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 REVIEW pending (by mcm1957) labels Feb 13, 2025
@github-actions github-actions bot added 27.2.2025 remind after 27.2.2025 and removed 15.2.2025 labels Feb 13, 2025
@muffin142
Copy link
Author

Hey,
I've adjusted the points and hopefully haven't overlooked anything. The fact that deleting objects can destroy the history is a fair point, I've added this to my backlog for a future version, as well as i18n support via individual language files.

Please also find the updated object dump attached.
fyta.json

As the updated package needs to be available on npm now there is a published version 0.1.3.

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

Automated adapter checker

ioBroker.fyta

Downloads - Test and Release
NPM

👍 No errors found

  • 👀 [W156] admin 7.0.0 listed as dependency but 7.4.10 is recommended. Please consider updating globalDependency at io-package.json.
  • 👀 [W401] Cannot find "fyta" in latest repository
  • 👀 [W515] Why did you decide to disable i18n support?

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

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

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

  • Object type hirarchie

    Please note that only ONE object of type 'device' is allowed within the hirarchie. The structure must be
    [device] [- channel ..] - state. 'Device' may be omitted but if present channel must be below device. 'Channel' can be used multiple times. 'States' must not have any children. In addition objects of type 'folder' can be present at any level.

  • structure of jsonConfig is invalid

    i18n is not an object containing translations but a single attribute with boolean avlue (true/false).
    if i18n is true translation data is placed in files located at i18n subtree. You only have to fill in the english version (i18b/en/translations.json and execute npm run translate to populate other languages.
    If i18n is set to false (NOT recommended) you may insert the translaations directly inot jsonConfig.json as multilanguage objects just like you did at io.package.json. But note that translation into all supported ioBroker languages is mandatore. You can use https://translator-ui.iobroker.in/ to generate the objects. But using i18b external files is recommended as this enables the usage ob weblate to gain support from external human translators too.

  • jsonCostum.json5 seems to be invalid

    I did not detect handling of custom attributes by your adapter. If I'm correct and did not miss something, please remove jsonCostum.json5. And please remove common.supprtsCustom from io-package.json too in this case (https://github.com/muffin142/ioBroker.fyta/blob/704eb0f0b6e315e81f4549c693b10308a58547b1/io-package.json#L77)

  • outdated words.js

    words.js seems to be outdated and is empty. JsonConfig does not use this file at all. So please remove the file.

  • i18n entries must support all languages

When using multilangugae support at objects those entries must contain all supported languages. See https://github.com/muffin142/ioBroker.fyta/blob/704eb0f0b6e315e81f4549c693b10308a58547b1/io-package.json#L140. You can use https://translator-ui.iobroker.in/ to generate i18n blocks.

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

  • reenable testing

    Standard iobroker testing is required but is disabled. Please activate standard ./github/workflows/test-and-release.yml again. Of course its ok to add addional tests but standard github based tests must be active and named as provided by default to enable semi automatic checks.

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

  • deleting of objects

    Not sure if deleting all objects is really a good idea as this will invalidate all custom configuration (i.e. history settings). But as it's an option set by the user this functionality is acceptable. BUT your code will delte info objects for any instance other than instance 0. This must be fixed. See https://github.com/muffin142/ioBroker.fyta/blob/704eb0f0b6e315e81f4549c693b10308a58547b1/main.js#L47

  • error handling

@mcm1957
Copy link
Collaborator

mcm1957 commented Feb 21, 2025

@muffin142

Thnaks for fixing and your work at this adapter.

The following remarks need more attention:

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

    At least here https://github.com/muffin142/ioBroker.fyta/blob/7f2e0a89f8cc58f3c5a549665e6048ea17f44a9d/main.js#L563 a timeout seems to be missing. (non blocking but strongly recommended)

  • Adapter should try to recover from errors at least at limited number of times as accessing an external source may lead to an error. As the interval is set to 30 minutes anyway inlimited retryes would be acceptable too as logging an error every 30 minutes does not overlaod ioBroker for sure.
    Simply stopping processing becaue i.e. the home router has an interruption due do to ip address change is not userfriendly. Same if the external webpage is ofline for a short time. But IF the adapter stops processing it must terminate itself so that user has a clear indicatio n taht it is no longer working. Simply doing nothing will be interpreted as an error of the adapter by most users.

    If I read the code correctly a broken internet connection will stop this adapter. So if your internetconnection is only down a short time at the point the adapter tries to retrieve data the adapter stops. This is an unusual behaviour. Normally adapter simply log an error and retry at the next interval or - especially if the request data at a high ferquency - retry several times before stopping. As this adapter polls only every 30 minutes it would be acceptable that it simply continous to poll after an error. A maximum of 48 errors a day should be acceptable even if the link is permanently down. Please evaluate.

    Feel free to comment if you think stopping is better,

  • Why do you use local translation?

    Using i18n system is more flexible than local hardcoded translations and would enable connection to wablate system. If you really want to keep local translations, the i18n tree is obsolete and should be removed. (non blocking)

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 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 27.2.2025 remind after 27.2.2025 labels Feb 21, 2025
@muffin142
Copy link
Author

Add timeout to axios calls
Done

Why do you use local translation?
i18n enabled

Adapter should try to recover from errors
It does. The only way to stop the adapter is to fail the login 3 times in a row by providing wrong Password. After 3 refused tries the adapter stops to prevent locking the account. To make this clearer, I have included differentiated error messages.

@github-actions github-actions bot added the *📬 a new comment has been added label Feb 23, 2025
@mcm1957 mcm1957 added RE-REVIEW pending (by mcm1957) Changes requested by review have been applied, re-review could be done. and removed *📬 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 labels Feb 23, 2025
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 auto-checked This PR was automatically checked for obvious criterias new at LATEST RE-REVIEW pending (by mcm1957) Changes requested by review have been applied, re-review could be done.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants