jochem725 / homebridge-toon

Homebridge Plugin for Toon Thermostats
14 stars 8 forks source link

Toon plugin not working "undefind" #29

Closed gielk closed 4 years ago

gielk commented 4 years ago

I get the following errors. I have requested a new API, but also with this I get the following messages. Please help?!

[2020-2-21 07:41:29] [Toon] Current Target Temperature:  undefined
[2020-2-21 07:41:31] [Toon] Current Temperature:  undefined
(node:5626) UnhandledPromiseRejectionWarning: StatusCodeError: 400 - "\n         <!doctype html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"UTF-8\">\n        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n        <title>Invalid redirect_uri</title>\n \n        <style>\n            @import url(https://fonts.googleapis.com/css?family=Open+Sans);\n            @import url(https://fonts.googleapis.com/css?family=Roboto);\n \n            *:focus {\n                outline: none;\n            }\n \n            body {\n                background-color: #fff;\n                color: #43484d;\n                font-family: 'FFClanWebNews', 'Helvetica Neue', 'Helvetica', 'Roboto', 'Arial', sans-serif;\n                font-size: 1.4rem;\n                margin: 0;\n            }\n            main {\n                margin:42px auto;\n                text-align:center;\n                width: 480px;\n            }\n            a, a:active  {\n                color: #D7242A;\n                text-decoration: none;\n            }\n            a:visited {\n                color: #701317;\n            }\n            .page-header {\n                background-color: #D7242A;\n                height: 10px;\n                \n                background-position: center;\n            }\n \n            h1 {\n                font-family: 'Open Sans', sans-serif;\n                font-size: 20px;\n            }\n \n            h2 {\n                font-size: 16px;\n            }\n \n            .viesgo {\n                color: #D7242A;\n                font-weight: 900;\n            }\n            .field {\n                margin:20px auto;\n                width:340px;\n            }\n            .error {\n                color:red;\n                display:none;\n                font-weight:bold;\n            }\n            .error.true {\n                display:block;\n            }\n            label {\n                display:block;\n                font-size: 12px;\n                text-align:left;\n            }\n \n            input,\n            select {\n                border:1px solid #a0b1b9;\n                font-size:14px;\n                height:32px;\n                margin-top:4px;\n                width:100%;\n            }\n            input:not([type=submit]) {\n                background-color: transparent;\n                border: 0;\n                border-bottom: 1px solid #414141;\n                height: 32px;\n            }\n            input:not([type=submit]):focus {\n                border-bottom-color: #cccccc;\n            }\n \n            ::-webkit-input-placeholder {\n                font-style: italic;\n            }\n \n            :-moz-placeholder { /* Firefox 18- */\n                font-style: italic;\n            }\n \n            ::-moz-placeholder {  /* Firefox 19+ */\n                font-style: italic;\n            }\n \n            :-ms-input-placeholder {\n                font-style: italic;\n            }\n \n            .button {\n                background-color: #D7242A;\n                border:0;\n                box-shadow: 0 4px 0 0 #701317;\n                color: #ffffff;\n                cursor: pointer;\n                height: 50px;\n                line-height: 50px;\n                margin: 30px auto;\n                padding:0;\n                width: 280px;\n            }\n \n            @media (min-width: 322px) and (max-width: 480px) {\n                .page-content {\n                    margin:2%;\n                    width:96%;\n                }\n                .field {\n                    margin:20px 10%;\n                    width:80%;\n                }\n            }\n            @media (max-width: 321px) {\n                .page-content {\n                    margin:2%;\n                    width:96%;\n                }\n                .field {\n                    margin:20px 0;\n                    width:280px;\n                }\n            }\n        </style>\n    </head>\n    <body>\n        <header class=\"page-header\"></header>\n        <main class=\"page-content\">\n            <h1>Developer hint:</h1>\n            <p>The requested redirect_uri does not match any of the whitelisted redirect_uris on the Toon developer page.</p>\n            <p>Make sure to allow the requested redirect_uri on your registered Toon app in the <a href=\"https://developer.toon.eu/\">developer pages</a></p>\n            <p>Multiple redirect_uris can be used, separated by a comma.</p>\n        </main>\n    </body>\n</html>\n \n            "
    at new StatusCodeError (/usr/local/lib/node_modules/homebridge-toon/node_modules/request-promise-core/lib/errors.js:32:15)
    at Request.plumbing.callback (/usr/local/lib/node_modules/homebridge-toon/node_modules/request-promise-core/lib/plumbing.js:104:33)
    at Request.RP$callback [as _callback] (/usr/local/lib/node_modules/homebridge-toon/node_modules/request-promise-core/lib/plumbing.js:46:31)
    at Request.self.callback (/usr/local/lib/node_modules/homebridge-toon/node_modules/request/request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/usr/local/lib/node_modules/homebridge-toon/node_modules/request/request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/homebridge-toon/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
(node:5626) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5626) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
flappah commented 4 years ago

Yep. Deze error zie ik ook. Denk dat er aanpassingen moeten worden uitgevoerd. Ik had al een ander draadje geopend omdat Eneco al waarschuwde dat er wijzigingen uitgevoerd zouden worden aan de Toon API vanaf 1 december 2019. Het lijkt erop dat dit nu uitgevoerd is. Jochem?

gielk commented 4 years ago

@jochem725 Heb je misschien een oplossing?

jednl commented 4 years ago

Zelfde issue hier na de update. Voor de update functioneerde de koppeling nog goed.

flappah commented 4 years ago

Zelfde issue hier na de update. Voor de update functioneerde de koppeling nog goed.

Als je de plug-in met npm geüpdatet hebt dan zou ie nu weer moeten werken. Bij mij werkt ie nu na de update weer goed.

gielk commented 4 years ago

Ook na de update heb ik het probleem.

jednl commented 4 years ago

Heb het weer werkend. De "oude" config. Het was de combinatie van de oude config (met consumer key e.d.) en de nieuwe (met het access token) wat bij mij niet goed stond.

Nu alleen de access token nog in de config en het werkt weer.

flappah commented 4 years ago

Heb het weer werkend. De "oude" config. Het was de combinatie van de oude config (met consumer key e.d.) en de nieuwe (met het access token) wat bij mij niet goed stond.

Nu alleen de access token nog in de config en het werkt weer.

Top! :)

gielk commented 4 years ago

Heb het weer werkend. De "oude" config. Het was de combinatie van de oude config (met consumer key e.d.) en de nieuwe (met het access token) wat bij mij niet goed stond.

Nu alleen de access token nog in de config en het werkt weer.

Hoe bedoel je dat? Kun je mij laten zien hoe de config nu moet?

DennisDeKoster commented 4 years ago

Even kijken op https://github.com/jochem725/homebridge-toon. Je moet via de link bij Eneco met je huidige consumerkey een apitoken aanvragen. Deze vul je vervolgens in de aangepaste config.json in conform de readme.

Bij mij werkt ie weer perfect, bedankt Jochem!

gielk commented 4 years ago

Even kijken op https://github.com/jochem725/homebridge-toon. Je moet via de link bij Eneco met je huidige consumerkey een apitoken aanvragen. Deze vul je vervolgens in de aangepaste config.json in conform de readme.

Bij mij werkt ie weer perfect, bedankt Jochem!

OOOhhhhhh top ja! Thanks!!! @jochem725 bedankt voor het snelle fixen!

jednl commented 4 years ago

Precies wat @DennisDeKoster zegt. En dan alleen opnemen wat in de readme staat.

santheman-nl commented 4 years ago

Ik heb in de config { "platform": "Toon", "name": "Thermostaat", "apiToken": "https: //api.toon.eu/toonapi-accesstoken?tenant_id=eneco&client_id=XXXX" }, ingevuld, waarbij de XXXX staan voor de consumer key van de app die ik heb aangemaakt. Het werkt helaas niet. Krijg alle undefined meldingen. Ik vraag mij ook af hoe hij de "mijn eneco" gegevens koppelt aan deze Consumer Key in de developer.toon.eu gegevens. De readme vind ik vrij summier, dus ik dacht ik vraag het hier even

santheman-nl commented 4 years ago

En hier dus dezelfde foutmelding: (node:6717) UnhandledPromiseRejectionWarning: StatusCodeError: 401 - {"fault":{"faultstring":"Invalid Access Token","detail":{"errorcode":"keymanagement.service.invalid_access_token"}}} at new StatusCodeError (/usr/lib/node_modules/homebridge-toon/node_modules/request-promise-core/lib/errors.js:32:15) at Request.plumbing.callback (/usr/lib/node_modules/homebridge-toon/node_modules/request-promise-core/lib/plumbing.js:104:33) at Request.RP$callback [as _callback] (/usr/lib/node_modules/homebridge-toon/node_modules/request-promise-core/lib/plumbing.js:46:31) at Request.self.callback (/usr/lib/node_modules/homebridge-toon/node_modules/request/request.js:185:22) at Request.emit (events.js:310:20) at Request. (/usr/lib/node_modules/homebridge-toon/node_modules/request/request.js:1154:10) at Request.emit (events.js:310:20) at IncomingMessage. (/usr/lib/node_modules/homebridge-toon/node_modules/request/request.js:1076:12) at Object.onceWrapper (events.js:416:28) at IncomingMessage.emit (events.js:322:22) at endReadableNT (_stream_readable.js:1187:12) at processTicksAndRejections (internal/process/task_queues.js:84:21) (node:6717) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:6717) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

jochem725 commented 4 years ago

@santheman-nl Het api token kun je ophalen door naar https://api.toon.eu/toonapi-accesstoken?tenant_id=eneco&client_id=XXXX te gaan. Hier kun je vervolgens inloggen om het token te verkrijgen.

santheman-nl commented 4 years ago

Cliënt id, is dat het klantennummer? Ik heb een account aangemaakt op developer.toon.eu en daar een app toegevoegd.

jochem725 commented 4 years ago

@santheman-nl Het client id is de consumer_key die je bij de app kunt vinden op developer.toon.eu.

santheman-nl commented 4 years ago

Het is gelukt! Wellicht goed om in de readme aan te geven dat de url dus niet in json geplaatst moet worden, maar dat je die moet volgen (bezoeken) en dat je dan pas de echte api key krijgt. Ik ben benieuwd of het nu werkt!

santheman-nl commented 4 years ago

Het werkt! Maar dus misschien goed om duidelijker aan te geven dat je via die URL die token krijgt die je in de config moet invullen. Dat was voor mij zo echt niet duidelijk. Top dat je me hebt willen helpen! Fijn weekend verder.