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
Merged

Suez water #23844

merged 38 commits into from
Jul 23, 2019

Conversation

ooii
Copy link
Contributor

@ooii ooii 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

@homeassistant
Copy link
Contributor

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!

Copy link
Member

@fabaff fabaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor Author

ooii 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 and others added 2 commits June 7, 2019 16:04
Co-Authored-By: Fabian Affolter <mail@fabian-affolter.ch>
Co-Authored-By: Fabian Affolter <mail@fabian-affolter.ch>
Copy link
Contributor Author

@ooii ooii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@home-assistant home-assistant deleted a comment from homeassistant Jun 25, 2019
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
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[
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the items?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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']:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the items?

Copy link
Contributor Author

@ooii ooii Jul 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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']:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the items?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@MartinHjelmare
Copy link
Member

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

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

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!

@MartinHjelmare
Copy link
Member

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
Dev automation moved this from Reviewer approved to Done Jul 23, 2019
@balloob balloob mentioned 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
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

7 participants