Skip to content

Fix hydroquebec#6574

Merged
pvizeli merged 1 commit into
home-assistant:devfrom
titilambert:hydroquebec
Mar 13, 2017
Merged

Fix hydroquebec#6574
pvizeli merged 1 commit into
home-assistant:devfrom
titilambert:hydroquebec

Conversation

@titilambert
Copy link
Copy Markdown
Contributor

@titilambert titilambert commented Mar 13, 2017

Description:

Hello, @djfjeff got an error after the 0.40 upgrade. The issue is related to init stage where data had not been already collected (by the hydroquebec client) when they are requested by the component.
So the data attribute is empty.

Here the log from @djfjeff:

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'

Related issue (if applicable): fixes #home-assistant/home-assistant.io#2191

Checklist:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass

@djfjeff
Copy link
Copy Markdown

djfjeff commented Mar 13, 2017

I can confirm that this fix work on my environment!

@titilambert
Copy link
Copy Markdown
Contributor Author

titilambert commented Mar 13, 2017

@djfjeff I just changed the patch, could you confirm the new fix ?

@djfjeff
Copy link
Copy Markdown

djfjeff commented Mar 13, 2017

@titilambert Yes, confirm it's still working removing previous patch and using this one!

@pvizeli pvizeli added this to the 0.40.1 milestone Mar 13, 2017
@pvizeli pvizeli merged commit 253dee8 into home-assistant:dev Mar 13, 2017
@g146m026
Copy link
Copy Markdown

Thanks you for the fix! It work well

@balloob
Copy link
Copy Markdown
Member

balloob commented Mar 16, 2017

Cherry-picked for 0.40.1

balloob pushed a commit that referenced this pull request Mar 16, 2017
@balloob balloob mentioned this pull request Mar 16, 2017
@balloob balloob mentioned this pull request Mar 24, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Jun 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants