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

Suez water #23844

Merged
merged 38 commits into from Jul 23, 2019

Conversation

@ooii
Copy link
Contributor

commented May 13, 2019

Description:

This component adds a sensor to Home-Assistant. This sensor fetches data from the French water provider Suez.
It gets the following data:

  • Daily consumption for current month
  • Daily consumption for previous month
  • Previous day consumption
  • Monthly consumption for the last 26 months
  • Highest monthly consumption
  • Last year total consumption
  • Current year total consumption

Example entry for configuration.yaml (if applicable):

sensor:
  - platform: suez_water
    username: !secret suez_username
    password: !secret suez_password
    counter_id: 3388776655

counter_id is the water counter id. It can be found on toutsurmoneau.fr users account.

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • [] Tests have been added to verify that the new code works.

Pull request in home-assistant (if applicable): home-assistant/home-assistant.io#9576

ooii added some commits May 10, 2019

@homeassistant

This comment has been minimized.

Copy link

commented May 13, 2019

Hi @ooii,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@fabaff
Copy link
Member

left a comment

The communication with the toutsurmoneau.fr should be handled by a module that is imported -> https://developers.home-assistant.io/docs/en/development_checklist.html

homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved
@ooii

This comment has been minimized.

Copy link
Contributor Author

commented May 17, 2019

The communication with the toutsurmoneau.fr should be handled by a module that is imported -> https://developers.home-assistant.io/docs/en/development_checklist.html

I'm working on it right now.
I'll update that later.
Thanks.

ooii added some commits Jun 3, 2019

Update homeassistant/components/suez_water/sensor.py
Co-Authored-By: Fabian Affolter <mail@fabian-affolter.ch>
@ooii
Copy link
Contributor Author

left a comment

Please include an attribution to the source of the data

Sorry but I don't understand what does that mean.

homeassistant/components/suez_water/.coveragerc Outdated Show resolved Hide resolved

ooii added some commits Jun 7, 2019

@home-assistant home-assistant deleted a comment from homeassistant Jun 25, 2019

@MartinHjelmare
Copy link
Member

left a comment

Please remove the readme file.

See below for more comments.

.coveragerc Outdated Show resolved Hide resolved
homeassistant/components/suez_water/manifest.json Outdated Show resolved Hide resolved
homeassistant/components/suez_water/manifest.json Outdated Show resolved Hide resolved
homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved

ooii added some commits Jul 3, 2019

homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved
self._attributes['history'] = {}
for item in self.client.attributes['history']:
self._attributes[
'history'][item] = self.client.attributes[

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Jul 3, 2019

Member

What are the items?

This comment has been minimized.

Copy link
@ooii

ooii Jul 3, 2019

Author Contributor

Latest months consumption.
I can't know the number of items in advance.

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Jul 4, 2019

Member

Is each item key the name of the month and the item value is the month consumption in liters?

Please describe the item in more detail.

This comment has been minimized.

Copy link
@ooii

ooii Jul 23, 2019

Author Contributor

Sorry, did not see this question.
history will looks like that:

{ "Février 2019": 10109, "Mars 2019": 7553, "Avril 2019": 9003, "Mai 2019": 8844, "Juin 2019": 10472, "Juillet 2019": 4168 }

It seems that history contains last 6 months consumption.

item] = self.client.attributes[
'thisMonthConsumption'][item]
self._attributes['previousMonthConsumption'] = {}
for item in self.client.attributes['previousMonthConsumption']:

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Jul 3, 2019

Member

What are the items?

This comment has been minimized.

Copy link
@ooii

ooii Jul 3, 2019

Author Contributor

Daily previous month consumption.
I can't know the number of items in advance.

'attribution'] = self.client.attributes[
'attribution']
self._attributes['thisMonthConsumption'] = {}
for item in self.client.attributes['thisMonthConsumption']:

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Jul 3, 2019

Member

What are the items?

This comment has been minimized.

Copy link
@ooii

ooii Jul 3, 2019

Author Contributor

Daily current month consumption.
I can't know the number of items in advance.

homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/suez_water/sensor.py Outdated Show resolved Hide resolved

ooii added some commits Jul 3, 2019

Attribute keys formatting to lowercase snakecase, name and icon const…
…ants returned directly, and remove of attribute. Update of .
@MartinHjelmare

This comment has been minimized.

Copy link
Member

commented Jul 23, 2019

Please rebase on latest dev branch to let the build pass.

@MartinHjelmare MartinHjelmare added this to Review in progress in Dev Jul 23, 2019

@MartinHjelmare
Copy link
Member

left a comment

Good!

@MartinHjelmare

This comment has been minimized.

Copy link
Member

commented Jul 23, 2019

Can be merged when build passes.

@MartinHjelmare MartinHjelmare moved this from Review in progress to Reviewer approved in Dev Jul 23, 2019

@MartinHjelmare MartinHjelmare merged commit 4fb1937 into home-assistant:dev Jul 23, 2019

9 checks passed

CI Build #20190723.97 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python35) Tests PyTest Python35 succeeded
Details
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA

Dev automation moved this from Reviewer approved to Done Jul 23, 2019

@balloob balloob removed the new-platform label Aug 7, 2019

@balloob balloob referenced this pull request Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
7 participants
You can’t perform that action at this time.