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

Add tradfri device info #16768

Merged
merged 1 commit into from Sep 21, 2018
Merged

Add tradfri device info #16768

merged 1 commit into from Sep 21, 2018

Conversation

balloob
Copy link
Member

@balloob balloob commented Sep 21, 2018

Description:

This adds Tradfri device info.

image

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If the code does not interact with devices:

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

@@ -11,7 +11,8 @@
def initialize(hass, client_id, client_secret):
"""Initialize a local auth provider."""
config_flow.register_flow_implementation(
hass, DOMAIN, 'local', partial(generate_auth_url, client_id),
hass, DOMAIN, 'configuration.yaml',
Copy link
Member Author

Choose a reason for hiding this comment

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

Sneaking in a small change to how the entry for nest is called, it was confusing.

@pvizeli pvizeli merged commit 3e59ffb into dev Sep 21, 2018
@pvizeli pvizeli deleted the tradfri-dev-info branch September 21, 2018 12:47
@ghost ghost removed the in progress label Sep 21, 2018
@linuxlurak
Copy link

linuxlurak commented Sep 22, 2018

I just installed the dev branch of hass to checkout your new tradfri implementation. You really are great!

This is what I discovered (Is this the right place to inform you about my findings?)

After installing dev branch this shows up in my logs (a loop with this message 10 times a second).
Perhaps my old .tradfri_psk is ignored? Is the .tradfri_psk relevant at all in the future?

Sep 22 21:30:56 homeautomation hass[2430]: Traceback (most recent call last):
Sep 22 21:30:56 homeautomation hass[2430]:   File "/usr/local/lib/python3.6/dist-packages/aiocoap/transports/tinydtls.py", line 157, in _run
Sep 22 21:30:56 homeautomation hass[2430]:     yield from self._connecting
Sep 22 21:30:56 homeautomation hass[2430]: concurrent.futures._base.CancelledError
Sep 22 21:30:56 homeautomation hass[2430]: During handling of the above exception, another exception occurred:
Sep 22 21:30:56 homeautomation hass[2430]: Traceback (most recent call last):
Sep 22 21:30:56 homeautomation hass[2430]:   File "/usr/local/lib/python3.6/dist-packages/aiocoap/transports/tinydtls.py", line 169, in _run
Sep 22 21:30:56 homeautomation hass[2430]:     self.coaptransport.new_error_callback(-1, self)
Sep 22 21:30:56 homeautomation hass[2430]:   File "/usr/local/lib/python3.6/dist-packages/aiocoap/protocol.py", line 192, in _dispatch_error
Sep 22 21:30:56 homeautomation hass[2430]:     request.response.set_exception(OSError(errno, os.strerror(errno)))
Sep 22 21:30:56 homeautomation hass[2430]: asyncio.base_futures.InvalidStateError: invalid state#033[0m
Sep 22 21:30:56 homeautomation hass[2430]: Sep 22 21:30:56 ALRT 115 invalidate peer
Sep 22 21:30:56 homeautomation hass[2430]: #033[31m2018-09-22 21:30:56 ERROR (MainThread) [coap] Fatal DTLS error: code 115#033[0m
Sep 22 21:30:56 homeautomation hass[2430]: Sep 22 21:30:56 WARN received alert, peer has been invalidated
Sep 22 21:30:56 homeautomation hass[2430]: #033[31m2018-09-22 21:30:56 ERROR (MainThread) [coap] Exception CancelledError() can not be represented as errno, setting -1.#033[0m
Sep 22 21:30:56 homeautomation hass[2430]: #033[31m2018-09-22 21:30:56 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved#033[0m

Then on the hass ui I see this:
image

The two gateways seem to be configured but appear under discovered too (since the first startup of hass dev).
Really nice would be to see the IP like "IKEA TRADFRI (192.168.10.XY)".

After setting up the two gateways with the secrets I get this:
image
(Interesting that before the setup the gateway under 192.168.10.6 already showed the two bulbs like after the setup! Are there some leftovers somewhere? Or am I confusing things?)

When I checkout the configured gateways I get something like this --> the bulbs are mixed up:
image

image
Living is gateway 192.168.10.6 with two bulbs "Living ..."
Downstairs is gateway 192.168.10.5 with three bulbs "Downstairs ..."

I deleted my .tradfri_psk file and it seems that it's not getting populated with the reentered credentials. Are they stored somewhere else?

When I restart with this config the log gets flooded with the message I posted in the beginning until I configure the two gateways:

discovery:

I don't know how to configure multiple gateways. If you could inform me, I could update the docs if you want.

After a restart of hass I have to config the two gateways again.

@linuxlurak
Copy link

And as it seems only one of the gateways (Living, 192.168.10.6) is actually working. The other gateway is displayed but the bulbs are not switchable through hass.

@balloob
Copy link
Member Author

balloob commented Sep 23, 2018

Home Assistant relies on PyTradfri which currently does not support multiple gateways. I will open a PR to make sure only one gateway can be configured at a time.

Also if you see an issue, please open a new issue instead of responding to PRs.

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.

None yet

4 participants