angelnu / home_assistant_thethingsnetwork

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

No devices found in TTN (new version) v0.2.0 #15

Closed aechile closed 3 weeks ago

aechile commented 1 year ago

Hi everybody, thank you very much for this integration! I succesfully conected HA to my TTN aplication with server hostname, APP-ID, APP Access Key with full rights and also activate the persistant storage function in the TTN aplication. Now my problem is that the integration doesn´t show up my devices. I have 3 Dragino test devices registered in the TTN APP which are recieving data from the sensors.

I don´t get any error o debug messages. Anybody have an advise how to find the problem? Is there any know problem with this TTN server "nam1.cloud.thethings.network"

In the configuration.yaml I added following code for debbuging the TTN integration. logger: default: critical logs: custom_components.thethingsnetwork: debug

I appreciate any ideas and help. Kind regards. Timo

vincegre commented 1 year ago

What type of sensor is it ? Have you reloaded the integration since you added devices in TTN console ?

aechile commented 1 year ago

Hi Vincegre, yes I have reloaded and restartet HA serveral times.

The three sensors already registered and comunicating with TTN are:

Kind regards

vincegre commented 1 year ago
  • Temp. Humidity LHT65N

I don't know for the other ones but this one I have same here and it works perfectly with the integration ! Does the integration shows devices ? have you setup the permanent storage as indicated in integration manual ? 2023-03-14 10 28 54 n6i71nveptxx72q10614vld17u87jnhh ui nabu casa a8c023dc0c68

aechile commented 1 year ago

Hi Vincegre, like mentioned above, permanent storage is activated in the TTN console. The HA integration shows no error and no devices image

I still haven´t found the cause and solution. I already tried different API Keys but without result. I am not sure how to debug the detail of the problem.

Kind regards

vincegre commented 1 year ago

I still haven´t found the cause and solution. I already tried different API Keys but without result.

Looks like a misconfiguration somewehere. You have well created the API key in the group in TTN console where are your sensors ? Your sensors are well added in TTN console and you see messages received from these devices in TTN console ?

paulbalinnel commented 1 year ago

Hallo, I am following this because I have the same issue. The sensors are in live in TTN, the have data. I have tried changing API, I also have no sensors in HASS

Screenshot 2023-03-15 at 12 22 09
aechile commented 1 year ago

I still haven´t found the cause and solution. I already tried different API Keys but without result.

Looks like a misconfiguration somewehere. You have well created the API key in the group in TTN console where are your sensors ? Your sensors are well added in TTN console and you see messages received from these devices in TTN console ?

Hi, I tried different API keys with different rights for the Application-ID (group). Also I can confirm that the devices are recieving messages in the TTN console. image

Please can you tell me if the configuration settings in the TTN HASS integration are correct the devices show up immedeatly or it needs some time to show up ?

Kind regards

vincegre commented 1 year ago

Please can you tell me if the configuration settings in the TTN HASS integration are correct the devices show up immedeatly or it needs some time to show up ?

It shows quite immediately but the integration is only able to report basic sensors and if they have a payload in a specific format :( I'm quite sure it's reason why you don't see yours showing up in integration. Here I have some Dragino temp/hum sensors that are working fine but I have some 4 buttons remote and these ones are not handled properly by the integration and unhappy that new integration is not really supported by its developer too (not a critic, just a reality) so I don't expect some new type of devices to be supported soon in the integration :/

aechile commented 1 year ago

Please can you tell me if the configuration settings in the TTN HASS integration are correct the devices show up immedeatly or it needs some time to show up ?

It shows quite immediately but the integration is only able to report basic sensors and if they have a payload in a specific format :( I'm quite sure it's reason why you don't see yours showing up in integration. Here I have some Dragino temp/hum sensors that are working fine but I have some 4 buttons remote and these ones are not handled properly by the integration and unhappy that new integration is not really supported by its developer too (not a critic, just a reality) so I don't expect some new type of devices to be supported soon in the integration :/

Hi Vincegre, the payload is quite simple and looks like that. I hope this is not the problem. I still haven´t found a solution. "decoded_payload": { "Bat": 3.3, "Hardware_flag": 0, "Interrupt_flag": 0, "Sensor_flag": 1, "TempC_DS18B20": "0.00", "conduct_SOIL": 105, "temp_SOIL": "21.09", "water_SOIL": "20.13" },

aechile commented 1 year ago

Hi, any help to solve this? The sensors (7x Dragino) are all in live in TTN, the have data. I have tried changing API but don´t see any sensors in HASS. Kind regards

vincegre commented 1 year ago

Hi, any help to solve this? The sensors (7x Dragino) are all in live in TTN, the have data. I have tried changing API but don´t see

Well as tags are not really standard I think your only option is the traditional mqtt way that works great with TTN since always ;)

aechile commented 1 year ago

Ok, anyone has a working example for the MQTT sensor from TTN? I have already the following but the sensor has no value. Anybody see some errors?

# Bridge to The Things Network in file "/config/mosquitto.conf"
connection bridge
address nam1.cloud.thethings.network:8883
remote_username "xxx"
remote_password "xxx"
bridge_insecure false
topic # both 0

And in the configuration.yaml the following MQTT test sensor:

#create new mqqt sensor with template from TTN
mqtt:
  sensor:
  - name: Dragino_RS485
    device_class: "voltage"
    unit_of_measurement: "V"
    state_topic: "v3/iot-monitor@ttn/devices/eui-a8404177a18697a2/up"
    value_template: "{{ value_json.uplink_message.decoded_payload.BatV }}"

Thanks and Kind regards

vincegre commented 1 year ago
# Bridge to The Things Network in file "/config/mosquitto.conf"
connection bridge
address nam1.cloud.thethings.network:8883
remote_username "xxx"
remote_password "xxx"
bridge_insecure false
topic # both 0

I use that code for the bridge since always:

connection boutons-inputs
address eu1.cloud.thethings.network
bridge_protocol_version mqttv311
remote_username xxxx@ttn
start_type automatic
notifications false
try_private false
remote_password NNSXS.xxxxxxx
bridge_insecure true
topic # in 0
cleansession true

And in the configuration.yaml the following MQTT test sensor:

#create new mqqt sensor with template from TTN
mqtt:
  sensor:
  - name: Dragino_RS485
    device_class: "voltage"
    unit_of_measurement: "V"
    state_topic: "v3/iot-monitor@ttn/devices/eui-a8404177a18697a2/up"
    value_template: "{{ value_json.uplink_message.decoded_payload.BatV }}"

It can't work that part as according at payload you shared previously it returns Bat field and not BatV ;-)

aechile commented 1 year ago

Hi @vincegre, thank you for your message and help! The MQTT sensor setup for TTN works now. I am not sure if it depends also on the setup of the mosquitto integration in HASS. You know if you have to configure both at the same time? For me its seems like redundant but I am not sure.

1) the MQTT setting in the HASS-Mosquitto Integration and also 2) directly the bridge configuration as mentioned in the "mosquitto.conf" configuration file

image

Kind regards

vincegre commented 1 year ago

thank you for your message and help! The MQTT sensor setup for TTN works now. I am not sure if it depends also on the setup of the mosquitto integration in HASS. You know if you have to configure both at the same time? For me its seems like redundant but I am not sure.

You install the mqtt add-on in ha, start it and restart ha and everything is setup for it (ha automatically configures itself to interact with it ;) you just need to configure after the bridge configuration ;)

holtkamp commented 11 months ago

Hallo, I am following this because I have the same issue. The sensors are in live in TTN, the have data. I have tried changing API, I also have no sensors in HASS Screenshot 2023-03-15 at 12 22 09

I had the same issue, the cause was a configuration mistake.

The configuration panel in Home Assistant does not perform any validation.

Make sure:

  1. the hostname does not begin with https://
  2. the API key should be copy pasted when generating the API key in the TTN application console (and is NOT the same as the API Key ID, also see https://www.thethingsindustries.com/docs/reference/api/authentication/)

Enabling the debug log for the integration and checking it out (settings => system => logs) made me discover my mistakes

First mistake: I copy pasted the hostname including the protocol https://, this resulted in errors like:

Error while accessing: https://https://my-project-name.eu1.cloud.thethings.industries

Second mistake: when removing the integration from Home Assistant and try adding it again, I copy pasted the API Key ID (instead of the API key during creation), which resulted in errors like:

TTN entry without result: {'error': {'code': 3, 'message': 'error:pkg/auth:token (invalid token)'

Maybe some validation can be added to the configuration panel to prevent these mistakes?

vincegre commented 10 months ago

Maybe some validation can be added to the configuration panel to prevent these mistakes?

Don't expect it to happen, the author of the integration is away since ages on that repository (no answers at issues opened by users, and no update of integration since initial release a year ago or something like that :-1:

angelnu commented 3 weeks ago

This custom integration is deprecated as it has been integrated into the core HA since 2024.6.

Please migrate.