johnlemonse / homebridge-telldus

36 stars 22 forks source link

Telldus API #99

Open tellustheguru opened 7 months ago

tellustheguru commented 7 months ago

Telldus has change term of use regarding Telldus API, I have translated it from Swedish:

Information for those of you who use the Telldus API (not Google Home users):

For Telldus users who use our API services for free, we will need to review the scope and capacity of these services in light of the costs associated with providing certain services with the requirement of server capacity, redundancy and security.

pa-api.telldus.com will remain down for now while we implement additional features to limit the frequency of incoming traffic caused by certain users. We will reopen it as soon as possible once implementation and testing have been done. If you use our API services, please note the following:

mifi commented 7 months ago

do we need to change anything in this repo?

tellustheguru commented 7 months ago

What I mean is the point:

because they warn if you repeat the request more than 10 times/minute you will be blocked.

Maybe a limiter is needed in the plugin to prevent this.

tellustheguru commented 7 months ago

This may also lead to blocking:

"Check and double-check that your scripts are not retrying to contact the Telldus API without waiting at least 10 seconds. Retrying without a delay will result in blocking."

mifi commented 7 months ago

Oh so they will temporary ban the ip for a while? I dont have time to work on this now (and i dont have any hardware rn) but PR is welcome.

Mats82Sweden commented 7 months ago

How can I change the telldus plugin to point to https;//pa-api.telldus.com ?

mifi commented 7 months ago

just delete your yarn.lock/package-lock.json and node_modules

Mats82Sweden commented 7 months ago

@mifi I think I managed to point it to https://pa-api.telldus.com but I still get the handshake error.

12/10/2023, 1:14:00 PM] Loaded plugin: homebridge-telldus@1.1.0 [12/10/2023, 1:14:00 PM] Registering platform 'homebridge-telldus.Telldus' [12/10/2023, 1:14:01 PM] --- [12/10/2023, 1:14:01 PM] Loading 2 platforms... [12/10/2023, 1:14:01 PM] [Telldus Live] Initializing Telldus platform... [12/10/2023, 1:14:01 PM] [Telldus Live] isLocal: false [12/10/2023, 1:14:01 PM] [Telldus Live] Loading accessories... [12/10/2023, 1:14:01 PM] [Telldus Live] request to https://pa-api.telldus.com/json/sensors/list failed, reason: write EPROTO 200084A8FFFF0000:error:0A000410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1586:SSL alert number 40

[12/10/2023, 1:14:01 PM] FetchError: request to https://pa-api.telldus.com/json/sensors/list failed, reason: write EPROTO 200084A8FFFF0000:error:0A000410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1586:SSL alert number 40

at ClientRequest.<anonymous> (/var/lib/homebridge/node_modules/homebridge-telldus/node_modules/node-fetch/lib/index.js:1505:11)
at ClientRequest.emit (node:events:517:28)
at TLSSocket.socketErrorListener (node:_http_client:501:9)
at TLSSocket.emit (node:events:517:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at processTicksAndRejections (node:internal/process/task_queues:82:21)

[12/10/2023, 1:14:01 PM] Got SIGTERM, shutting down Homebridge... [12/10/2023, 1:14:01 PM] AssertionError [ERR_ASSERTION]: Cannot generate setupURI on an accessory that isn't published yet! at Bridge.Accessory.setupURI (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:994:11) at Server.setServerStatus (/var/lib/homebridge/node_modules/homebridge/src/server.ts:155:45) at Server.teardown (/var/lib/homebridge/node_modules/homebridge/src/server.ts:199:10) at signalHandler (/var/lib/homebridge/node_modules/homebridge/src/cli.ts:93:12) at process.emit (node:events:517:28) at process.emit (/var/lib/homebridge/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21) [12/10/2023, 1:14:06 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null

Torkilds1 commented 7 months ago

I have the same issue as @Mats82Sweden have.

tellustheguru commented 7 months ago

The API is down, read this (It's in Swedish): https://telldus.com/driftinformation/

Mats82Sweden commented 7 months ago

@tellustheguru Thanks it's me that have been getting it wrong. I thought they wanted us to switch to pa-api.telldus.com because api.telldus.com is down. So just sit back and wait for the API to come back? Most of all I wanted to communicate directly to my Telldus Znet v2 local IP address but I cant get that to work either as long as the API is down?

Mats82Sweden commented 7 months ago

I got it working by installing beta firmware on my Telldus Znet vnet v2 and then configured it via homeassistant. Then uninstalled homebridge to not brick anything hehe.

yflorack commented 6 months ago

Looks like the API does something strange still with my setup. I uninstalled and reinstalled your plugin and put in the api-tokens. It seems Telldus gives some errors as follows, and I wonder if this has to do with the fact that I have more than 10 devices/sensors connected and the telldus api system possibly can't handle more than 10 requests per minute anymore? Also my hoobs setup will show that this Telldus Bridge is not fully running yet, but it supposedly has found 9 devices and 4 sensors.

18/12/2023, 08:41:27Telldus BridgeTelldus Liv!e429 == 200 18/12/2023, 08:41:27Telldus BridgeWARNINGunhandled rejection: AssertionError [ERR_ASSERTION]: 429 == 200

mifi commented 6 months ago

429 probably means rate limited. so probably it's sending too many commands too fast

yflorack commented 6 months ago

Is there any way to add a delay between those commands, or check if more than 10 commands are sent?

If i switch the whole setup to use “local”, will all the requests then run over the local tellstick instead of via the telldus server api?

tellustheguru commented 6 months ago

Yes. If you switch to local, you can make unlimited requests because homebridge speak directly to Telldus Stick. The only time homebridge will speak with Telldus API is ones a year to renew local token.

yflorack commented 6 months ago

Hm, looks like installing local also doesnt work at the moment :( . maybe also something related to the api changes?

got this when trying to access the Tellstick after the command telldus-local-auth [IP of Tellstick] homebridge-telldus:

404 Not Found The path '/tellduslive/authorize' was not found.

Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 670, in respond File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 217, in call File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 61, in call File "/usr/lib/python2.7/site-packages/web/base/Server.py", line 230, in call File "/usr/lib/python2.7/site-packages/web/base/Server.py", line 202, in handle NotFound: (404, "The path '/tellduslive/authorize' was not found.")

kernie66 commented 6 months ago

Are you sure you run the correct command? The error message is not related to the linked command from the Readme file.

Otherwise you can get the token manually as described here: https://tellstick-server.readthedocs.io/en/v1.3.2/api/authentication.html

yflorack commented 6 months ago

I actually found another thread with the same issue described, and it seemed there was a cache issue with the browser, so using an incognito browser using google chrome did the trick.

runbert commented 6 months ago

I still haven't got my Tellstick Net device to work with homebridge since they changed the APIs. I get the 429 error. I do although also have a USB Tellstick (https://www.clasohlson.com/se/TellStick-USB-fjarrstyrning/p/36-3969) and wonder if it is possible to use that with a raspberry pi and this API? I think that would be the best solution to run everything local on the pi, but do not know how to setup and configure it in unix. Any help is appreciated

fknorn commented 5 months ago

just delete your yarn.lock/package-lock.json and node_modules

Hi there, could someone please explain in more detail what that means or how to do this? Thanks so much!!