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

Added legrand-ecocompteur #757

Merged
merged 1 commit into from
May 15, 2020
Merged

Added legrand-ecocompteur #757

merged 1 commit into from
May 15, 2020

Conversation

raintonr
Copy link
Contributor

Initial release of this adapter for test. Although it seems to work perfectly in my installation :)

@GermanBluefox
Copy link
Contributor

Automated adapter checker

ioBroker.legrand-ecocompteur

Downloads
NPM

  • ❗ [E301] Tests on Travis-ci.com are broken. Please fix.
  • 👀 [W400] Cannot find "legrand-ecocompteur" in latest repository

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

@GermanBluefox GermanBluefox 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 May 14, 2020
@ioBroker ioBroker deleted a comment from Apollon77 May 14, 2020
@raintonr
Copy link
Contributor Author

I don't know what's going on here, but Travis builds are certainly passing:

image

Everything passes on adapter-check too (just waiting for this merge):

image

@Apollon77
Copy link
Collaborator

Seems to be a false positive ... sometimes that happens we don't know why ... so ok!

@GermanBluefox
Copy link
Contributor

LGTM

@Apollon77
Copy link
Collaborator

Hi,

some review comments from me, all no real blockers

  • please check if there are roles matching for your states ... W, kWH and such :-) https://github.com/ioBroker/ioBroker.docs/blob/master/docs/en/dev/stateroles.md
  • If you do not need to react on state/object changes please also not implement the methods (unneeded logic)
  • using Intervals can be dangerous when there are network problems - ok not that common for local network devices but still :-) more best practice is to use timeouts where next timeout is set after one call is done

Else also looking fine for me; the roles would be cool to get checked

@Apollon77 Apollon77 added question Something needs to be done or answered by the adapter developer and removed must be fixed The Adapter request got review/automatic feedback that is required to be fixed before another review labels May 14, 2020
@Apollon77
Copy link
Collaborator

Please give a short info if you want to check these or if I should merge into repo

@Apollon77 Apollon77 added the lgtm Looks Good To Me label May 14, 2020
@raintonr
Copy link
Contributor Author

some review comments from me, all no real blockers

If you want to critique the code for this adapter then you should really open an issue over in that repo:

https://github.com/raintonr/ioBroker.legrand-ecocompteur/issues

That said...

Yes, I looked at that list and there is nothing suitable. The adapter would need:

  • Instantaneous power measurement in Watts. Something like value.power or value.power.consumption.instantaneous.
  • Cumulative energy usage in kWh. Something like value.energy or value.energy.consumption.cumulative.

I notice there is value.power.consumption in kWh but this is incorrect nomenclature as kWh is a measure of energy and not power. If someone wants to correct that and create something more suitable happy to use those roles.

  • If you do not need to react on state/object changes please also not implement the methods (unneeded logic)

Good to know. You will notice I simply took the adapter template and did not touch anything I didn't need to. I left these methods because I didn't know if removing them would break the ioBroker world. If they can be safely removed I will do so.

May I suggest the template should be updated to mention in the comments where code can be safely removed.

  • using Intervals can be dangerous when there are network problems - ok not that common for local network devices but still :-) more best practice is to use timeouts where next timeout is set after one call is done

Yes, I thought about that. You will notice the minimum polling period is 1s whereas the HTTP request has a 750ms timeout. No problem as the request will always complete or error before the next is due.

Of course I tested this by pulling the cable out of my router and also pointing the IP address at an incorrect device that would throw errors. Works perfectly.

@GermanBluefox
Copy link
Contributor

GermanBluefox commented May 15, 2020

It is my fault with power.consumption. Just lost in translation. But it is a good opportunity to correct it.

What do you suggest? When I translate with google, I get "power consumption"...

I could find 'elecrical power consumption' and 'electricity consumption' as official translations too, but I could find 'electric energy consumption' in wiki

@raintonr
Copy link
Contributor Author

What do you suggest? When I translate with google, I get "power consumption"...

Energy is the ability to do work. Measured in an amount of power spread over a period of time.

Power is the rate of doing work.

This is a good explanation: http://www.differencebetween.net/science/difference-between-energy-and-power/

Perhaps good roles would be:

  • value.power
  • value.power.consumption
  • value.power.production

All in W, kW, etc.

It's good to separate consumption and production because someone might have a Solar PV or other generation system for which they would require that latter one.

The 'instantaneous' part I mentioned before is probably redundant because thinking about it, by it's definition power is a constantly varying value so any reading only applies to that very instant in time it was taken. For example, with the device this adapter is polling, the best you can get is a reading every second so that is a 1 second sample.

And therefore for energy one would need:

  • value.energy
  • value.energy.consumption
  • value.energy.production

All in Wh, kWh, etc.

Maybe you want to include 'electrical' in there? Eg. value.power.electrical.consumption or something? I mention this because we have a heat pump for heating/hot water. There are sensors for water flow and leaving/return temperatures. From the flow and temperature difference it is possible to calculate the thermal power it is producing. Indeed, we measure those values, calculate the thermal power from them and divide by the electrical input power the unit is consuming which gives a COP value.

That said, further grouping these power/energy roles like that is probably overkill and unnecessary ;)

@Apollon77
Copy link
Collaborator

Apollon77 commented May 15, 2020

Aaahhhh ... did not saw Bluefox answer :-) ... ignore what was here before

@Apollon77
Copy link
Collaborator

If you want to critique the code for this adapter then you should really open an issue over in that repo

Basically you rare right, we just did it inthe past so that for the "bring adapter in into latest the first time" we do this initial review here also to dicument that status in one place.

@Apollon77
Copy link
Collaborator

PS: Also reading https://github.com/ioBroker/ioBroker.repositories#development-and-coding-best-practices is always a good starting point :-) Should be as comment in new adaoter screated by adater creator or newest templates

@raintonr
Copy link
Contributor Author

So from all this... is there anything here that someone insists I must change in the adapter before merging this pull request?

@Apollon77
Copy link
Collaborator

No I merge it ...

@Apollon77 Apollon77 merged commit 291b094 into ioBroker:master May 15, 2020
@raintonr
Copy link
Contributor Author

That's good, thanks.

With regards to the state roles... are those defined anywhere? I mean, I see they are documented in the file you linked... but is there anywhere in the code that actually validates a role to one of these accepted options? Or is it just a string and it will literally store anything you give it?

Just if it's the latter I can simply update my code and it will work.

@Apollon77
Copy link
Collaborator

No roles are not validated right now.

@Apollon77
Copy link
Collaborator

Ps: but we think doing it ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-checked This PR was automatically checked for obvious criterias lgtm Looks Good To Me question Something needs to be done or answered by the adapter developer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants