home-assistant-libs / pytradfri

IKEA Trådfri/Tradfri API. Control and observe your lights from Python. Examples available. On pypi. Sans-io.
MIT License
935 stars 132 forks source link

About Gateway 1.3.14 #131

Closed Lakitna closed 6 years ago

Lakitna commented 6 years ago

So Ikea recently updated their Gateway software with the following changelog:

New features and changes in Gateway: 1.3.14: Stability improvements in application connectivity to gateway. Resolution of DHCP and COAP issues. Connectivity improvements in iOS app.

I don't think it will change anything for Pytradfri, but it's a good idea to think about it a bit. Anyone any thoughts or issues?

ggravlingen commented 6 years ago

I haven't experienced any changes more than the constants that I've added through the last two pull requests.

av4625 commented 6 years ago

Does pytradfri work with 1.3.14?

I just installed everything as you say to and run: python3 -i -m pytradfri IP KEY

Output: DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.xxx post ['15011', '9063']: {'9090': 'pytradfri'} DEBUG:pytradfri.api.libcoap_api:Received: Traceback (most recent call last): File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.4/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.4/dist-packages/pytradfri/main.py", line 26, in psk = api_factory.generate_psk(sys.argv[2]) File "/usr/local/lib/python3.4/dist-packages/pytradfri/api/libcoap_api.py", line 157, in generate_psk self._psk = self.request(Gateway().generate_psk(existing_psk_id)) File "/usr/local/lib/python3.4/dist-packages/pytradfri/api/libcoap_api.py", line 92, in request return self._execute(api_commands) File "/usr/local/lib/python3.4/dist-packages/pytradfri/api/libcoap_api.py", line 86, in _execute api_command.result = _process_output(return_value, parse_json) File "/usr/local/lib/python3.4/dist-packages/pytradfri/command.py", line 71, in result self._result = self._process_result(value) File "/usr/local/lib/python3.4/dist-packages/pytradfri/gateway.py", line 29, in process_result return result[ATTR_PSK] TypeError: 'NoneType' object is not subscriptable

lights Traceback (most recent call last): File "", line 1, in NameError: name 'lights' is not defined

ggravlingen commented 6 years ago

@av4625 it should, there are no changes in the gateways communication methods. Also, I tried it yesterday and it worked. If you're using stand-alone pytradfri, can you please downloading the latest version from pypi and try again?

av4625 commented 6 years ago

This was straight after setting up, my first try, i installed pytradfri from pip

Is the error because: 192.168.0.xxx post ['15011', '9063']: {'9090': 'pytradfri'} Gets executed more than once?

Anytime I manually send the coap command to get the shared key more than once using the same string (pytradfri in this case) it doesnt work and returns 4.00 or 4.01

Lakitna commented 6 years ago

Are you sure you're running the latest version of Pytradfri? I believe the latest version doesn't identify itself as "pytradfri" anymore, it uses a random string instead.

ggravlingen commented 6 years ago

If you've installed pytradfri as a part of home assistant you won't have the latest version. Please use pip to upgrade (knowing this will break trådfri in home assistant.)

av4625 commented 6 years ago

I dont use home assisstant. I installed with pip (previous comment)

ggravlingen commented 6 years ago

This is what I'm getting when running in CLI against the new router:

root@ggravlingen:/usr/src/app# python3 -i -m pytradfri 192.168.0.129 key
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.129 get ['15001']
DEBUG:pytradfri.api.libcoap_api:Received: [65540,65536,65538,65539,65537,65541]
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.129 get ['15001', 65540]

What's more I have this in my tradfri_standalone.psk:

{
    "192.168.0.129": {
        "identity": "91b0de2ae2404304984525b687fdc15d",
        "key": "PSK"
    }
}
ggravlingen commented 6 years ago

Other than the separate (unrelated) issue on GU-lamps, pytradfri seems to work with the new GW firmware. Closing this issue.

av4625 commented 6 years ago

Doesnt seem to work standalone following your instructions in the readme.

Lakitna commented 6 years ago

Do the examples run in the latest pytradfri (5.2.1)?