Skip to content

Update Hydroquebec for multi contracts accounts#2191

Merged
Landrash merged 1 commit into
home-assistant:nextfrom
titilambert:hydroquebec
Mar 11, 2017
Merged

Update Hydroquebec for multi contracts accounts#2191
Landrash merged 1 commit into
home-assistant:nextfrom
titilambert:hydroquebec

Conversation

@titilambert
Copy link
Copy Markdown
Contributor

Description:
Update Hydroquebec for multi contracts accounts

Pull request in home-assistant (if applicable): home-assistant/core#6392

@mention-bot
Copy link
Copy Markdown

@titilambert, thanks for your PR! By analyzing the history of the files in this pull request, we identified @TheRaven to be a potential reviewer.

Copy link
Copy Markdown
Contributor

@Landrash Landrash left a comment

Choose a reason for hiding this comment

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

I don't believe there's a reason for having all the information in a note since it the majority of the text on the page.

Suggest you only have the breaking changes highlighted and have the rest as normal text.

- **yesterday_lower_price_consumption**: Yesterday lower price consumption
- **yesterday_higher_price_consumption**: Yesterday higher price consumption

<p class='note'>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's no real reason for this to be in a note since it most of the text on the page.

@Landrash Landrash added the new-feature This PR adds documentation for a new Home Assistant feature to an existing integration label Mar 7, 2017
@titilambert
Copy link
Copy Markdown
Contributor Author

Fixed !

@Landrash Landrash merged commit 919ae90 into home-assistant:next Mar 11, 2017
@Landrash
Copy link
Copy Markdown
Contributor

Thank you :)

@g146m026
Copy link
Copy Markdown

I don't know if is due to modification but now only the period_length monitored variables works. All other throw an exception.

there the traceback
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
result = coro.throw(exc)
File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity_component.py", line 359, in async_process_entity
new_entity, self, update_before_add=update_before_add
File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity_component.py", line 189, in async_add_entity
yield from self.hass.loop.run_in_executor(None, entity.update)
File "/usr/lib/python3.5/asyncio/futures.py", line 361, in iter
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/sensor/hydroquebec.py", line 152, in update
self._state = round(self.hydroquebec_data.data[self.type], 2)
KeyError: 'period_length'

thanks you for all the work you're doing!

@titilambert
Copy link
Copy Markdown
Contributor Author

@g146m026 Did you add your contract number in the HA configuration ?

@g146m026
Copy link
Copy Markdown

g146m026 commented Mar 13, 2017 via email

@djfjeff
Copy link
Copy Markdown

djfjeff commented Mar 13, 2017

I get the same here, I added the contract number and I now get the following in the log for multiple keys :

17-03-13 07:09:40 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
result = coro.throw(exc)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 359, in async_process_entity
new_entity, self, update_before_add=update_before_add
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 189, in async_add_entity
yield from self.hass.loop.run_in_executor(None, entity.update)
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in iter
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/hydroquebec.py", line 152, in update
self._state = round(self.hydroquebec_data.data[self.type], 2)
KeyError: 'period_total_bill'

@titilambert
Copy link
Copy Markdown
Contributor Author

@djfjeff I found the issue !

@titilambert
Copy link
Copy Markdown
Contributor Author

@djfjeff PR created ;)

@djfjeff
Copy link
Copy Markdown

djfjeff commented Mar 13, 2017

@titilambert I don't know if I did something wrong when I added your patch here but now I get this on restart :

17-03-13 08:14:20 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform hydroquebec
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 153, in _async_setup_platform
entity_platform.schedule_add_entities, discovery_info
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in iter
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/hydroquebec.py", line 110, in setup_platform
sensors.append(HydroQuebecSensor(hydroquebec_data, variable, name))
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/hydroquebec.py", line 129, in init
self._update()
AttributeError: 'HydroQuebecSensor' object has no attribute '_update'

Here is the change that I made :

diff hydroquebec.py /home/homeassistant/hydroquebec.py
129,130d128
< self._update()

@djfjeff
Copy link
Copy Markdown

djfjeff commented Mar 13, 2017

@titilambert Sorry, ignore my previous comment, typo on my side, everything works fine, thanks!

@titilambert
Copy link
Copy Markdown
Contributor Author

@djfjeff I'm not sure that is working. I don't get any update :/

@djfjeff
Copy link
Copy Markdown

djfjeff commented Mar 13, 2017

@titilambert To be honest, I didn't check if update were made correctly at regular interval, I mostly use this sensor as a "check 1 or 2 times a month".

I was more confirming that the sensor was starting correctly and not throwing error in the log.

@titilambert
Copy link
Copy Markdown
Contributor Author

@djfjeff I just checked and I got updates. So I can confirm the patch

@MartinHjelmare
Copy link
Copy Markdown
Member

Please don't discuss in merged or closed PRs. Open an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature This PR adds documentation for a new Home Assistant feature to an existing integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants