angelnu / home_assistant_thethingsnetwork

TheThingsNetwork v3 integration for Home Assistant
33 stars 8 forks source link

No devices or entities #24

Closed HansPeterDurand closed 3 months ago

HansPeterDurand commented 3 months ago

Good afternoon, I managed to installHome Assistant wir Zigbee and various other Integrations. Actually i am working on the TTN intergation. Gateway and sensor work (up to now finde). I also managed to install the new "The Tings Network" Integration. So far so good(or not). On the things network console i create an API Key, that will be used for the registartion. In HA I used as requestet the created API Key (copied/past) and the application ID "ms24-letterbox". As a result I got the message from HA: No devices or entites? For this is strange. Have I missed someting?

besten regards for any hint.

Hans Peter

--------------------------------------------------excerpt from the log file----------------------------------------------- Screenshot 2024-03-16 154015 Screenshot 2024-03-16 154015

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.thethingsnetwork Quelle: custom_components/thethingsnetwork/TTN_client.py:204 Integration: The Things Network (Dokumentation, Probleme) Erstmals aufgetreten: 14:41:41 (12 Vorkommnisse) Zuletzt protokolliert: 15:25:55

TTN entry without result: {'error': {'code': 3, 'message': 'error:pkg/auth:token (invalid token)', 'details': [{'@type': 'type.googleapis.com/ttn.lorawan.v3.ErrorDetails', 'namespace': 'pkg/auth', 'name': 'token', 'message_format': 'invalid token', 'correlation_id': 'ed70b8418fb24509a2f0302fddf1bdd0', 'code': 3}]}} TTN entry without result: {'error': {'code': 3, 'message': 'error:pkg/auth:token (invalid token)', 'details': [{'@type': 'type.googleapis.com/ttn.lorawan.v3.ErrorDetails', 'namespace': 'pkg/auth', 'name': 'token', 'message_format': 'invalid token', 'correlation_id': 'ef5b4db91e1445f184dc0f21a36843a6', 'code': 3}]}} TTN entry without result: {'error': {'code': 3, 'message': 'error:pkg/auth:token (invalid token)', 'details': [{'@type': 'type.googleapis.com/ttn.lorawan.v3.ErrorDetails', 'namespace': 'pkg/auth', 'name': 'token', 'message_format': 'invalid token', 'correlation_id': 'dc5bf9a17b6c42c9808e1a2a560137b8', 'code': 3}]}} TTN entry without result: {'error': {'code': 3, 'message': 'error:pkg/auth:token (invalid token)', 'details': [{'@type': 'type.googleapis.com/ttn.lorawan.v3.ErrorDetails', 'namespace': 'pkg/auth', 'name': 'token', 'message_format': 'invalid token', 'correlation_id': 'b563f95d30fc47daa8da2182c820780d', 'code': 3}]}} TTN entry without result: {'error': {'code': 3, 'message': 'error:pkg/errors:validation (invalid application_ids: embedded message failed validation)', 'details': [{'@type': 'type.googleapis.com/ttn.lorawan.v3.ErrorDetails', 'namespace': 'pkg/errors', 'name': 'validation', 'message_format': 'invalid {field}: {reason}', 'attributes': {'field': 'application_ids', 'name': 'GetStoredApplicationUpRequestValidationError', 'reason': 'embedded message failed validation'}, 'correlation_id': '90bbe75ab26d4e86b0d350335ffa5b27', 'cause': {'namespace': 'pkg/errors', 'name': 'validation', 'message_format': 'invalid {field}: {reason}', 'attributes': {'field': 'application_id', 'name': 'ApplicationIdentifiersValidationError', 'reason': 'value does not match regex pattern "^a-z0-9{2,}$"'}, 'correlation_id': 'db1d96c01415447794985a710b3c7691', 'code': 3}, 'code': 3}]}}

angelnu commented 3 months ago

Hi @HansPeterDurand . Did you enable the storage API in TheThingsNetwork? This might be the problem.

Btw: I am working towards submitting this code into the Home Assustant core code to replace the broken v2 there. I am thinking about checking if the storage api is set.

HansPeterDurand commented 3 months ago

Good morning Angel, Thank you for your hint. I checked the configuration. Storage has been configured (see attachment). Screenshot 2024-03-17 091532

In addition I created a new API Key an registered the application "ms24-letterbox". Screenshot 2024-03-17 092246 As a result i got a success message: Screenshot 2024-03-17 092352 So far so good. On Home Assistant I still get this message (no devices or entities). Screenshot 2024-03-17 093244 Interesting aspect: Having a look into the "Protokoll" I see no entry (last timestamp: 09:09:13 from another integration)! Screenshot 2024-03-17 094007

Seems that, I came a step further?

regards

Hans Peter

angelnu commented 3 months ago

@HansPeterDurand if you do not see errors in the integration logs then there are 2 things to check next:

HansPeterDurand commented 3 months ago

Hello Angel, I had a look at the logs and couldn't find an unlink message. Up to know I can say that the Device as well as the gateway work as they should do (see below)

Screenshot 2024-03-17 123023 Screenshot 2024-03-17 123108

I'll check the configuration with a colleague that has an almost similar configuration.

Regards Hans Peter

angelnu commented 3 months ago

uplinks are what is needed (typo in my reply) and you seem to have plenty. But do you have payload formarters?

image

This is how the decode_payloadlooks in one of my uploads:

image
HansPeterDurand commented 3 months ago

Hello Angel here i am again :-) Up to now i havent defined any payload formater. So i choose the "Custom Javascript Formater". I copie the payload from the last message (see attachment) Screenshot 2024-03-17 194951

You see the result below. In the message I see that the gateway id ist "test". Strange...

{ "f_port": 1, "frm_payload": "DkZ//wAAAP////8=", "decoded_payload": { "bytes": [ 14, 70, 127, 255, 0, 0, 0, 255, 255, 255, 255 ] }, "rx_metadata": [ { "gateway_ids": { "gateway_id": "test" }, "rssi": 42, "channel_rssi": 42, "snr": 4.2 } ], "settings": { "data_rate": { "lora": { "bandwidth": 125000, "spreading_factor": 7 } }, "frequency": "868000000" } }

angelnu commented 3 months ago

The gateway test comes from testing the payload formater

image

But at least you should get an entity in home assistant called bytes with the values being the array - not very useful yet but at least it would show that the integration is working.

For getting more useful values you will need a decoder matching your device. You have more information in this page: https://www.thethingsindustries.com/docs/integrations/payload-formatters/ I personally build my own devices so I use the Cayenne format but each TTN vendor can decide its own format.

HansPeterDurand commented 3 months ago

Hi Angel, In the meantime, I have discussed my problem with my colleague. We will compare and document our installation in the coming days. I have looked at the topic of decoders (the sensor is from Dragino, type SN50v3-LB/LS). The supplier has linked a decoder file in his description (https://github.com/dragino/dragino-end-node-decoder/tree/main/SN50_v3-LB). I downloaded this file and used it as "Custom Javascript Formatter". When configuring the sensor, I selected "Use Device Repository Formatters". The result is that the live data is now output in formatted form. That looks better now. It now looks better on the Home Assistant page. Now one device and 10 entities are visible! As far as I can tell, thanks to your help, I have made a big step forward. Unfortunately I have to stop now, I still have a few other things to do. I will document the final situation.

Thanks again!

Translated with DeepL.com (free version) Screenshot 2024-03-18 192959 Screenshot 2024-03-18 194254 Screenshot 2024-03-18 194416

angelnu commented 3 months ago

Jep, thislooks right. So let us close this for now.

Please notice that I added some words about the decoders to the documentation PRr at https://github.com/home-assistant/home-assistant.io/pull/31930 but as this part was too implicit before