Kane610/deconz

Getting started with pydeconz

Closed this issue · 12 comments

hello there,

i am trying to implement a python code in order to connect a usb Conbee II, to some sensors, but i don´t see any getting started doc or similar.

Looking at the code i can see that all I want to implement in my code is possible, except to search new devices, where can I find more information about it?

Thanks a lot for you work

Rest API documentation: https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/configuration/

Make a new method similar to initialize which calls request with

await self.request("put", "/config/", json={"permitjoin": 60})

Note this is untested and might not work

async def initialize(self) -> None:

Thanks it was a very useful help,

Now i am facing a problem, I am trying to use the basic authentification, but it is reporting always user and password is not recognized. I saw in your main.py that you comment the user and pass in kw, have you had problems with it?

#'username': 'delight',

Later I tested to get into Conbee II thought Web App
I am getting always an error:
image

I am using the same pass than in Phoscon APP where I have no problem. I am doing something wrong...

I should probably improve the main a bit :), what you should do is generate an api key

async def async_get_api_key(session, host, port, username=None, password=None):

In Phoscon you should open up for pairing of third party applications and then use the async_get_api_key function

I was expecting not to use the pairing :(, but in any case thanks a lot...

If you get your credentials right it's just a matter of altering this line with the basic auth parts from async_get_api_key, unfortunately I stopped using the credentials a couple of years ago but it should still work

async with self.session.request(method, url, json=json) as res:

Thanks, I think the problem is the user not the password, but don't know how to get the proper one, I will keep you updated in any case.

You will laugh, the default user and password was the ones in your main code, both are delight , I though it was something you set previously, i am getting the apikey without problems.

Thanks a lot

You will laugh, the default user and password was the ones in your main code, both are delight , I though it was something you set previously, i am getting the apikey without problems.

Thanks a lot

Great! It was so obvious I didn't think I'd need to ask the question 😂

Hello,

I have one more question, is it mandatory to run up the deconz software to use the discovery function?, as if i have not this software running i am having allways "[ ]" as response.

No the discovery function is a helper function in cases where you don't have full knowledge of the system or want to provide a better user experience

Hi,
Where I can find some sample code to get me started.
It would be great to put it in README doc for other to use this package.
I could create something like that if you are OK with it.
I now have API key and can connect to my gateway check sensors etc, but wondering how I could use your code.
Please advise.
Thanks

Hi,
Where I can find some sample code to get me started.
It would be great to put it in README doc for other to use this package.
I could create something like that if you are OK with it.
I now have API key and can connect to my gateway check sensors etc, but wondering how I could use your code.
Please advise.
Thanks

Feel free to contribute 👍🏻

I think improving the main file is a good way to show case how to set up the basics of the integration. I can probably do that within the next few days.

If you want to delve deep into it everything is done to work with Home Assistant so you can look at the deconz integration to get inspiration. https://github.com/home-assistant/core/tree/dev/homeassistant/components/deconz