johnlemonse / homebridge-telldus

36 stars 22 forks source link

telldus remote vs local.. (znet lite v2) #56

Closed dezral closed 6 years ago

dezral commented 6 years ago

I see there is a differens in how the api issues it's ID for devices/sensors and other..

i have a smoke alarm with well a smoke alarm built in and temperature sensor.. on the remote API they get different ID's so there is no trouble there.. but the "new" local API on my znet lite v2 shows the same ID with both the smoke sensor and temp sensor.. the error i get is

"Cannot add a bridged Accessory with the same UUID as another bridged Accessory" and as i read it the UID is made up by the name.. so i can't really make an ""unknown_accessories" entryin the config.json because there is 2 "devices" with the same ID but deferent purpose.. one is the smoke alarm and one is temp sensor... hope i have written it clearly ;-) ..

mifi commented 6 years ago

That's weird. Maybe telldus live has some magic going on with its ID mappings... Is there anything else that can differentiate these two devices? care to provide som log output? from the getDeivces/getSensors API response?

dezral commented 6 years ago

first the local API gives me this: smokealarm: { "id": 15, "methods": 0, "name": "R\u00f8galarm", "state": 2, "statevalue": "", "type": "device" }

smokealarm temp sensor: { "battery": 100, "id": 15, "model": "n/a", "name": "R\u00f8galarm", "novalues": true, "protocol": "zwave", "sensorId": 15 },

--

Remote API: smokealarm: {"id":"1793907","clientDeviceId":"15","name":"R\u00f8galarm","state":0,"statevalue":null,"methods":0,"type":"device","client":"259122","clientName":"Home3","online":"1","editable":1,"ignored":0},

smokealarm temp sensor: {"id":"13883487","name":"R\u00f8galarm","lastUpdated":1508813558,"ignored":0,"client":"259122","clientName":"Home3","online":"1","editable":1,"battery":100,"keepHistory":0,"protocol":"zwave","model":"n\/a","sensorId":"15","miscValues":null},

is this what you wanted?

the complete "error" message i get is:

[2017-10-25 12:04:19] [Telldus Liv!e local] Initializing platform accessory 'Røgalarm'... [2017-10-25 12:04:19] [Telldus Liv!e local] [Røgalarm] Your device (model n/a, id 15) is not auto detected from telldus live. Please add the following to your config, under telldus platform (replace MODEL with a valid type, and optionally set manufacturer): "unknown_accessories": [{ "id": 15, "model": "MODEL", "manufacturer": "unknown" }] Valid models are: selflearning-switch, codeswitch, selflearning-dimmer, temperature, EA4C, temperaturehumidity, 1A2D, window-covering, switch

and:

[2017-10-25 12:04:19] [Telldus Liv!e local] Initializing platform accessory 'Røgalarm'... [2017-10-25 12:04:19] [Telldus Liv!e local] [Røgalarm] Your device (model n/a, id 15) is not auto detected from telldus live. Please add the following to your config, under telldus platform (replace MODEL with a valid type, and optionally set manufacturer): "unknown_accessories": [{ "id": 15, "model": "MODEL", "manufacturer": "unknown" }] Valid models are: selflearning-switch, codeswitch, selflearning-dimmer, temperature, EA4C, temperaturehumidity, 1A2D, window-covering, switch [2017-10-25 12:04:19] [Telldus Liv!e local] Cannot add a bridged Accessory with the same UUID as another bridged Accessory: 73b486bd-20ff-4201-8fa8-4f083800e61a (node:2649) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory: 73b486bd-20ff-4201-8fa8-4f083800e61a (node:2649) [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.

it does seems my homekit don't work right know, will look at it when i get home tonight.

mifi commented 6 years ago

Are both of these sensors returned from listSensors? or is one from listDevices? (or getDeviceInfo / getSensorInfo)

mifi commented 6 years ago

I found some code here, but I cannot find a definite answer to how this "sensorId" field works https://github.com/telldus/tellstick-server/blob/master/telldus/src/telldus/DeviceApiManager.py

dezral commented 6 years ago

the smoke alarm as a smoke alarm is from "devices/list", and the temp from sensor/list..

here the info is from device/sensor - info: remote: {"id":"1793907","name":"R\u00f8galarm","state":"0","statevalue":null,"methods":"0","type":"device","client":"259122","protocol":"zwave","model":"n\/a","online":"1","editable":1,"parameter":[]}

temp sensor: {"id":"13883487","clientName":"Home3","name":"R\u00f8galarm","lastUpdated":1508813558,"ignored":0,"editable":1,"data":[{"name":"temp","value":"24.0","scale":"0"}],"protocol":"zwave","sensorId":"15","timezoneoffset":7200,"battery":"100","keepHistory":"0"}

i can't get the local api to fetch the data on device/sensor(info)...

use this url(try'd more then one way).: curl -i -X GET http://IP/api/device/info?supportedMethods=0&id=1793907 -H "Authorization: Bearer XXXXXKEY

get this message: "error": "deviceInfo() takes at least 2 arguments (2 given)"

dezral commented 6 years ago

for me it seems there is an fault in the API.. the "remote API" call get's the samme sensorID as the local API ... and same ID as the sensor ID ...hmmm.

mifi commented 6 years ago

for curl you need to quote the URL with single quotes, maybe that's the problem?

curl -i -X GET 'http://IP/api/device/info?supportedMethods=0&id=1793907' -H "Authorization: Bearer XXXXXKEY

mifi commented 6 years ago

...assuming you are on mac/linux

dezral commented 6 years ago

device info: { "id": 15, "methods": 0, "model": "n/a", "name": "R\u00f8galarm", "protocol": "zwave", "state": 0, "statevalue": "", "type": "device" }

sensor info: { "data": [ { "name": "temp", "scale": 0, "value": 23.0 } ], "id": 15, "model": "n/a", "name": "R\u00f8galarm", "protocol": "zwave", "sensorId": 15 }

dezral commented 6 years ago

have you had time to look at this?.. i can see you have made a new release ;-)

mifi commented 6 years ago

No, not yet unfortunately. I would imagine that we could also specify in unknown accessories for each entry, whether it's a device or sensor, do be able to distinguish between duplicate ids. Also I don't have any sensors myself so it's hard for me to test this.

mifi commented 6 years ago

You can try this branch:

npm i -g jchnlemon/homebridge-telldus#device-type

Then in your unknown accessories, put "type": "device" and "local_id": 15 for the device (smokealarm) and put "local_id": 15 without any "type" definition for the sensor (smokealarm temp sensor)

dezral commented 6 years ago

Like this: { "id": 15, "local-id": 15, "model": "temperature", "manufacturer": "Fibaro", "name": "Røgalarm temp" }, { "id": 15, "Type": "device", "local-id": 15, "model": "switch", "manufacturer": "Fibaro", "name": "Røgalarm" }

it does not work still saying "Cannot add a bridged Accessory with the same UUID as another bridged Accessory: 73b486bd-20ff-4201-8fa8-4f083800e61a"

on a related matter it seems like sometimes it does not use those accessorie settings..when local API is on

im try'ing also to clean up what error messages there is on the screen.. i have on the remote API used

"disabled": true< like this

{ "id": 1793807, "model": "switch", "name": "Motion Stuen", "disabled": true }

and it worked fine, as in no errors and no showing in homekit. ([2017-11-8 09:45:00] [Telldus Liv!e] Device 1793807 is disabled, ignoring)

but used with local API it does make error messages with or without --debug parameter..

[2017-11-8 09:18:41] [Telldus Liv!e local] Initializing platform accessory 'Motion Stuen'...

[2017-11-8 09:18:41] [Telldus Liv!e local] [Motion Stuen] Your device (model n/a, id 9) is not auto detected from telldus live. Please add the following to your config, under telldus platform (replace MODEL with a valid type, and optionally set manufacturer):

"unknown_accessories": [{ "id": 9, "model": "MODEL", "manufacturer": "unknown" }]

Valid models are: selflearning-switch, codeswitch, selflearning-dimmer, temperature, EA4C, temperaturehumidity, 1A2D, window-covering, switch

(i have changed the id nr)..

2017-11-07 23:26 GMT+01:00 Mikael Finstad notifications@github.com:

You can try this branch:

npm i -g jchnlemon/homebridge-telldus#device-type

Then in your unknown accessories, put "type": "device" and "local_id": 15 for the device (smokealarm) and put "local_id": 15 without any "type" definition for the sensor (smokealarm temp sensor)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jchnlemon/homebridge-telldus/issues/56#issuecomment-342644592, or mute the thread https://github.com/notifications/unsubscribe-auth/AEfF4GDWBu2oSFIzXDYJCnwv-khg3TYCks5s0NkqgaJpZM4QFx6B .

-- -Harry

mifi commented 6 years ago

not local-id but local_id. and type, not Type.

dezral commented 6 years ago

[2017-11-8 10:31:05] [Telldus Liv!e local] isLocal: true

[2017-11-8 10:31:05] [Telldus Liv!e local] Creating accessory with ID 15. Name from telldus: Røgalarm

[2017-11-8 10:31:05] [Telldus Liv!e local] Custom config found for ID 15.

[2017-11-8 10:31:05] [Telldus Liv!e local] Custom model: 'temperature' overrides 'n/a' from telldus

[2017-11-8 10:31:05] [Telldus Liv!e local] Custom manufacturer: 'Fibaro' overrides 'undefined' from telldus

[2017-11-8 10:31:05] [Telldus Liv!e local] Custom name: 'Røgalarm temp' overrides 'Røgalarm' from telldus

[2017-11-8 10:31:06] [Telldus Liv!e local] Creating accessory with ID 15. Name from telldus: Røgalarm

[2017-11-8 10:31:06] [Telldus Liv!e local] Custom config found for ID 15.

[2017-11-8 10:31:06] [Telldus Liv!e local] Custom model: 'switch' overrides 'n/a' from telldus

[2017-11-8 10:31:06] [Telldus Liv!e local] Custom manufacturer: 'Fibaro' overrides 'undefined' from telldus

[2017-11-8 10:31:06] [Telldus Liv!e local] Custom name: 'Røgalarm' overrides 'Røgalarm' from telldus

[2017-11-8 10:31:06] [Telldus Liv!e local] Initializing platform accessory 'Røgalarm temp'...

well that helped ;-)..

but still getting the same error in the bottom

[2017-11-8 10:31:06] [Telldus Liv!e local] Cannot add a bridged Accessory with the same UUID as another bridged Accessory: fc00c827-5549-4da9-974e-e65d248aba44

(node:32468) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory: fc00c827-5549-4da9-974e-e65d248aba44

(node:32468) [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.

røgalarm does not show up in homekit, but maybe it will help removing the bridge from homekit and re add it.. but can't do that until im home again..at work so doing this remotely..

2017-11-08 10:12 GMT+01:00 Mikael Finstad notifications@github.com:

not local-id but local_id. and type, not Type.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jchnlemon/homebridge-telldus/issues/56#issuecomment-342756025, or mute the thread https://github.com/notifications/unsubscribe-auth/AEfF4CBv3m6o71VoRtfAWdWFPi6LhqUoks5s0XCGgaJpZM4QFx6B .

-- -Harry

mifi commented 6 years ago

are you 100% sure that you don't have 2 devices with the same name?

mifi commented 6 years ago

maybe also try to delete ~/.homebridge/accessories

dezral commented 6 years ago

i made a new folder for the same reason and run homebridge like this "homebridge -U .homebridge/test_new_mifi" so there should not be any wrong old data.. (and a copy of config.json in there also)

i don't have the problem when using remote API, i don't get that UUID error.. but now that the sensor issue maybe resolved i will try tonight and remove the homebridge bridge from homekit, and re add it to see if i still get that error..

i'll let you know later ;-).

-Harry

2017-11-08 10:52 GMT+01:00 Mikael Finstad notifications@github.com:

maybe also try to delete ~/.homebridge/accessories

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jchnlemon/homebridge-telldus/issues/56#issuecomment-342766346, or mute the thread https://github.com/notifications/unsubscribe-auth/AEfF4IixDB6whfwwFh-ds5lDHRviWlhcks5s0XnEgaJpZM4QFx6B .

-- -Harry

mifi commented 6 years ago

Ok, but i don't think homekit configuration has anything to do with this, since this error happens during initialization of homebridge. if you can double check your logs to see that there are no duplicate names.

dezral commented 6 years ago

well seems you where right.. i renamed an telldus sensor(did not have any problem with remote API).. and add local_id and type to all sensors/devices i did not want homekit to finde(disable: true).. and then there where no errors left..

homekit still have not updated devices, but will look at it when i get home...

2017-11-08 11:40 GMT+01:00 Mikael Finstad notifications@github.com:

Ok, but i don't think homekit configuration has anything to do with this, since this error happens during initialization of homebridge. if you can double check your logs to see that there are no duplicate names.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jchnlemon/homebridge-telldus/issues/56#issuecomment-342778843, or mute the thread https://github.com/notifications/unsubscribe-auth/AEfF4LO_eyf57lAEQ-aD9_-pU7qk5cjLks5s0YUbgaJpZM4QFx6B .

-- -Harry

dezral commented 6 years ago

Seems to work fine after re add to homekit now… thanks much for the help and fix ;-).

-Harry

Den 8. nov. 2017 kl. 12.26 skrev Harry Lassen dezral@takhis.net:

well seems you where right.. i renamed an telldus sensor(did not have any problem with remote API).. and add local_id and type to all sensors/devices i did not want homekit to finde(disable: true).. and then there where no errors left..

homekit still have not updated devices, but will look at it when i get home...

2017-11-08 11:40 GMT+01:00 Mikael Finstad <notifications@github.com mailto:notifications@github.com>: Ok, but i don't think homekit configuration has anything to do with this, since this error happens during initialization of homebridge. if you can double check your logs to see that there are no duplicate names.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jchnlemon/homebridge-telldus/issues/56#issuecomment-342778843, or mute the thread https://github.com/notifications/unsubscribe-auth/AEfF4LO_eyf57lAEQ-aD9_-pU7qk5cjLks5s0YUbgaJpZM4QFx6B.

-- -Harry

mifi commented 6 years ago

cool

mifi commented 6 years ago

merged to master so i close this. you can now npm install -g homebridge-telldus