home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.71k stars 28.87k forks source link

Integration: The Things Network, "TypeError: Unexpected type <class 'NoneType'> for value: None" #119381

Closed hansju-11 closed 8 hours ago

hansju-11 commented 3 weeks ago

The problem

After create an integration I got an Error: TypeError: Unexpected type <class 'NoneType'> for value: None

What version of Home Assistant Core has the issue?

core-2024.6.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

TheThingsNetwork

Link to integration documentation on our website

https://www.home-assistant.io/integrations/thethingsnetwork/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

I change the API Key with some ************** in the diagnostic file.

System log has:
Logger: homeassistant.components.thethingsnetwork.coordinator
Quelle: helpers/update_coordinator.py:312
Integration: The Things Network (Dokumentation, Probleme)
Erstmals aufgetreten: 12:08:17 (17 Vorkommnisse)
Zuletzt protokolliert: 12:25:40

Unexpected error fetching TheThingsNetwork_wst-0102030405060708090a data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/thethingsnetwork/coordinator.py", line 51, in _async_update_data
    measurements = await self._client.fetch_data()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ttn_client/client.py", line 139, in fetch_data
    return await self.__storage_api_call(f"?last={fetch_last}&order=received_at")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ttn_client/client.py", line 193, in __storage_api_call
    TTNClient.__add_value(
  File "/usr/local/lib/python3.12/site-packages/ttn_client/client.py", line 238, in __add_value
    raise TypeError(f"Unexpected type {type(new_value)} for value: {new_value}")
TypeError: Unexpected type <class 'NoneType'> for value: None

Additional information

This is the data I got from the TTN Storage Integration {"result":{"end_device_ids":{"device_id":"eui-2cf7f1c0443003fe","application_ids":{"application_id":"wst-0102030405060708090a"},"dev_eui":"2CF7F1C0443003FE","dev_addr":"260B9C79"},"received_at":"2024-06-09T00:13:20.424443130Z","uplink_message":{"f_port":3,"f_cnt":2269,"frm_payload":"AQBaVgAAAAAAAAACAQ4AAAAAJ3k=","decoded_payload":{"Air_Humidity":86,"Air_Temperature":9,"Barometric_Pressure":101050,"Light_Intensity":0,"Rain_Gauge":0,"UV_Index":0,"Wind_Direction_Sensor":270,"Wind_Speed":0},"rx_metadata":[{"gateway_ids":{"gateway_id":"eui-40d63cfffe1f8525","eui":"40D63CFFFE1F8525"},"timestamp":4213980523,"rssi":-84,"channel_rssi":-84,"snr":9.8,"location":{"latitude":53.235421701165706,"longitude":7.466096162697796,"altitude":10,"source":"SOURCE_REGISTRY"},"channel_index":3,"received_at":"2024-06-09T00:13:20.189350088Z"},{"gateway_ids":{"gateway_id":"smart-united-04","eui":"A84041FDFE4CE435"},"timestamp":4197809539,"rssi":-91,"channel_rssi":-91,"snr":14.8,"frequency_offset":"-441","location":{"latitude":53.2354016941179,"longitude":7.46620237827301,"source":"SOURCE_REGISTRY"},"channel_index":3,"received_at":"2024-06-09T00:13:20.229255253Z"}],"settings":{"data_rate":{"lora":{"bandwidth":125000,"spreading_factor":7,"coding_rate":"4/5"}},"frequency":"867100000","timestamp":4213980523},"received_at":"2024-06-09T00:13:20.219791418Z","consumed_airtime":"0.071936s","network_ids":{"net_id":"000013","ns_id":"EC656E0000000181","tenant_id":"ttn","cluster_id":"eu1","cluster_address":"eu1.cloud.thethings.network"}}}} {"result":{"end_device_ids":{"device_id":"eui-2cf7f1c0443003fe","application_ids":{"application_id":"wst-0102030405060708090a"},"dev_eui":"2CF7F1C0443003FE","dev_addr":"260B9C79"},"received_at":"2024-06-09T00:28:26.842086294Z","uplink_message":{"f_port":3,"f_cnt":2270,"frm_payload":"AQBZVgAAAAAAAAACAPsAAAAAJ3g=","decoded_payload":{"Air_Humidity":86,"Air_Temperature":8.9,"Barometric_Pressure":101040,"Light_Intensity":0,"Rain_Gauge":0,"UV_Index":0,"Wind_Direction_Sensor":251,"Wind_Speed":0},"rx_metadata":[{"gateway_ids":{"gateway_id":"eui-40d63cfffe1f8525","eui":"40D63CFFFE1F8525"},"timestamp":825434891,"rssi":-83,"channel_rssi":-83,"snr":8,"location":{"latitude":53.235421701165706,"longitude":7.466096162697796,"altitude":10,"source":"SOURCE_REGISTRY"},"channel_index":2,"received_at":"2024-06-09T00:28:26.606059130Z"},{"gateway_ids":{"gateway_id":"smart-united-04","eui":"A84041FDFE4CE435"},"timestamp":809264415,"rssi":-73,"channel_rssi":-73,"snr":10.8,"frequency_offset":"-450","location":{"latitude":53.2354016941179,"longitude":7.46620237827301,"source":"SOURCE_REGISTRY"},"channel_index":2,"received_at":"2024-06-09T00:28:26.646288510Z"}],"settings":{"data_rate":{"lora":{"bandwidth":125000,"spreading_factor":7,"coding_rate":"4/5"}},"frequency":"868500000","timestamp":825434891},"received_at":"2024-06-09T00:28:26.635645721Z","consumed_airtime":"0.071936s","network_ids":{"net_id":"000013","ns_id":"EC656E0000000181","tenant_id":"ttn","cluster_id":"eu1","cluster_address":"eu1.cloud.thethings.network"}}}}

### Tasks
home-assistant[bot] commented 3 weeks ago

Hey there @angelnu, mind taking a look at this issue as it has been labeled with an integration (thethingsnetwork) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `thethingsnetwork` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign thethingsnetwork` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


thethingsnetwork documentation thethingsnetwork source (message by IssueLinks)

hansju-11 commented 3 weeks ago

home-assistant_thethingsnetwork_2024-06-11T10-31-01.229Z.log

hansju-11 commented 3 weeks ago

the file contains the debug infos. I tried the integration the first time.

angelnu commented 1 week ago

Please check if the latest version corrected the issue. This was reported and fixed in version 2024.6.1

angelnu commented 1 week ago

See https://github.com/home-assistant/core/issues/119132

hansju-11 commented 12 hours ago

Hello Angel, I did the test with 2024.6.4 it is working now. Thank you. --Diese Nachricht wurde von meinem Mobiltelefon gesendet.Am 25.06.24, 03:26 schrieb Angel Nunez Mencias @.***>:

Please check if the latest version corrected the issue. This was reported and fixed in version 2024.6.1 —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

angelnu commented 8 hours ago

Thanks for confirming.

angelnu commented 8 hours ago

@home-assistant close