Smanar / Domoticz-deCONZ

deCONZ plugin for Domoticz (Zigbee application)
GNU General Public License v3.0
36 stars 27 forks source link

Dns instead ip for api #107

Closed antonlamers closed 2 years ago

antonlamers commented 2 years ago

Hi Is it possible to use a dns name instead the ip adres for making the apo key. I use domoticz in a container and somethimes after a reset the container for phoscon container has another ip adres

Smanar commented 2 years ago

Ha good question, have you tried on your side ? What is your url ? It s just a hostname ? I know it work if you use "localhost", but not sure if you use "localhost:80"

From the code the webocket connexion will work, but I m not sure for classic request.

But I think it s better to configure your DHCP router, it s not something good.

antonlamers commented 2 years ago

Yes I have try it. I saw fill in IP adres. I can’t configure it in the router. Docker give the ip addresses to the container. because docker has the regie, they said use the name of the container, that doesn’t change. Here an explanation of docker. https://youtu.be/a6mjt8tWUws

Smanar commented 2 years ago

I m not skilled enought in english to understand ^^. But it's the first time I see this problem, You have all your docker server with moving IP ?

Can you show an exemple of the dns name you need to use ?

https://stackoverflow.com/questions/27937185/assign-static-ip-to-docker-container

antonlamers commented 2 years ago

The dns name is the same name as the container. I name it deconz. The docker website says the use of the dns name from the container instead the ip adres fromt the container.

Smanar commented 2 years ago

Can you show the complete url you use for deconz ? with the port, and tell me is it work using a browser ?

I m not engineer so I don't know and don't use docker, but if you have a working url, I can see how to use it in domoticz.

antonlamers commented 2 years ago

Hi, it work in domoticz. But when I restart my iot server, the ip adres from deconz container is changing and then I must make a new API key with the new ip adres

Smanar commented 2 years ago

Not normal, the API key is not based on IP, I m using the same key for 3/4 hosts here.

antonlamers commented 2 years ago

oke, but i must make the api with python3 API_KEY.py IP PHOSCON:80 create i thought it is based on IP. i did make a lot of keys, every when the ip was changed

Smanar commented 2 years ago

i thought it is based on IP. i did make a lot of keys, every when the ip was changed

Yep, me too, every time I use phoscon, It create a new key, after a number, you will have a message on logs to inform you

X API keys memorised, some of them are probably useless, can use the API_KEY.py tool to clean them

There is a tool in the front end that can clean some of them.