DeerMaximum / Technische-Alternative-CMI

Custom Home Assistant integration to read data from a C.M.I.
MIT License
43 stars 4 forks source link

Not all mandatory fields are filled #103

Open gelbetomate opened 2 days ago

gelbetomate commented 2 days ago

Version of the custom_component

Home Assistant integration to read Values from C.M.I. v1.9.4

Home Assistant

Core 2024.11.3 Supervisor 2024.11.4 Operating System 13.2 Frontend 20241106.2

Describe the bug

Hi, This is my first try of your integration and it looks cool. I had another setup running flawlessly since a few years using this json api. There are some reasons to replace it, so I gave this integration a try on my HA test environment. I turned the old setup off, to not mess with this integration. What I want to say, I understand how it works and what are the limitations with timings etc.

My TA setup is a CMI, 2 UVR16x2 and an old KNX interface on node 48. With the old setup I never requested a json for this node 48. This integration with the following setup and messages now always stops when it tries to get data from this not supported node.

(sorry for the German UI shots, didn't find a hot switch to English ;-))

image

in the logs I see it catches node 1 and it catches node 2. After that it tries to read node 48 and than this appears: (saying too many requests, try later)

image

after I wait long enough and press the ok button, I get this message: (saying mandatory fields are not filled!??)

image

I've done this more than once now, also trying all combinations of both the check boxes.

Is there any way to predefine the nodes to read before? I didn't find an option. Or any other thoughts, if this is not the issue?

BR

Debug log

I'm adding just the part where it fails, as I have a lot of entries in the json from the UVR16x2 nodes:

2024-11-29 19:28:23.022 DEBUG (MainThread) [custom_components.ta_cmi] Try to fetch device type: 48
2024-11-29 19:28:23.023 DEBUG (MainThread) [ta_cmi] Make request to device 48 with parameters: I,O
2024-11-29 19:28:23.023 DEBUG (MainThread) [ta_cmi] Sending request to http://192.168.178.34/INCLUDE/api.cgi?jsonparam=I,O&jsonnode=48 with None
2024-11-29 19:28:23.035 DEBUG (MainThread) [ta_cmi] Received payload: {
"Header":{
"Version":7,
"Device":"84",
"Timestamp":1732908501
},
"Data":{
},
"Status":"DEVICE NOT SUPPORTED",
"Status code":5
}
2024-11-29 19:28:23.035 DEBUG (MainThread) [ta_cmi] Failed response received: {"Header": {"Version": 7, "Device": "84", "Timestamp": 1732908501}, "Data": {}, "Status": "DEVICE NOT SUPPORTED", "Status code": 5}
2024-11-29 19:28:23.036 WARNING (MainThread) [custom_components.ta_cmi] Error while communicating with a device (48): Device not supported
gelbetomate commented 1 day ago

I'm trying to debug my case a little bit and so I'm detailing another try this time without http://

image

the request finds the nodes 1,2,48

2024-12-01 11:06:57.138 DEBUG (MainThread) [ta_cmi] Receive list of nodes from C.M.I
2024-12-01 11:06:57.139 DEBUG (MainThread) [ta_cmi] Sending request to http://192.168.178.34/INCLUDE/can_nodes.cgi?_=1 with None
2024-12-01 11:06:57.153 DEBUG (MainThread) [ta_cmi] Received payload: 1;2;48;
2024-12-01 11:06:57.153 DEBUG (MainThread) [ta_cmi] Received list of nodes from C.M.I: 1;2;48;
2024-12-01 11:06:57.154 DEBUG (MainThread) [custom_components.ta_cmi] Sleep mode for 75 seconds to prevent rate limiting

image

after 75 seconds it fetches I,O from node one (UVR16x2)...

2024-12-01 11:08:12.155 DEBUG (MainThread) [custom_components.ta_cmi] Try to fetch device type: 1
2024-12-01 11:08:12.155 DEBUG (MainThread) [ta_cmi] Make request to device 1 with parameters: I,O
2024-12-01 11:08:12.155 DEBUG (MainThread) [ta_cmi] Sending request to http://192.168.178.34/INCLUDE/api.cgi?jsonparam=I,O&jsonnode=1 with None
2024-12-01 11:08:13.115 DEBUG (MainThread) [ta_cmi] Received payload: {
"Header":{
"Version":7,
"Device":"87",
"Timestamp":1733051291
},
"Data":{
"Inputs":[
{
"Number":1,
"AD":"A",
"Value":{
"Value":30.0,
"Unit":"1"
}
},
{
"Number":2,
"AD":"A",
"Value":{
"Value":1.3,
"Unit":"1"
}
},
{
"Number":3,
"AD":"A",
"Value":{
"Value":33.8,
"Unit":"1"
}
},
{
"Number":4,
"AD":"A",
"Value":{
"Value":46.1,
"Unit":"1"
}
},
{
"Number":5,
"AD":"A",
"Value":{
"Value":29.8,
"Unit":"1"
}
},
{
"Number":6,
"AD":"A",
"Value":{
"Value":29.9,
"Unit":"1"
}
},
{
"Number":7,
"AD":"A",
"Value":{
"Value":2.7,
"Unit":"1"
}
},
{
"Number":8,
"AD":"A",
"Value":{
"Value":3.1,
"Unit":"1"
}
},
{
"Number":9,
"AD":"A",
"Value":{
"Value":40.7,
"Unit":"1"
}
},
{
"Number":10,
"AD":"D",
"Value":{
"Value":1,
"Unit":"43"
}
},
{
"Number":11,
"AD":"D",
"Value":{
"Value":1,
"Unit":"43"
}
},
{
"Number":12,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
},
{
"Number":13,
"AD":"A",
"Value":{
"Value":19.7,
"Unit":"1"
}
},
{
"Number":14,
"AD":"D",
"Value":{
"Value":1,
"Unit":"43"
}
},
{
"Number":15,
"AD":"D",
"Value":{
"Value":1,
"Unit":"43"
}
},
{
"Number":16,
"AD":"A",
"Value":{
"Value":35.1,
"Unit":"1"
}
}],
"Outputs":[
{
"Number":1,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
},
{
"Number":2,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
},
{
"Number":5,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
},
{
"Number":6,
"AD":"D",
"Value":{
"Value":1,
"Unit":"43"
}
},
{
"Number":7,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
},
{
"Number":8,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
},
{
"Number":9,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
},
{
"Number":10,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
},
{
"Number":11,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
},
{
"Number":13,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
},
{
"Number":14,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
},
{
"Number":15,
"AD":"A",
"Value":{
"State":0,
"Value":0.0,
"Unit":"8"
}
},
{
"Number":16,
"AD":"A",
"Value":{
"State":0,
"Value":0.00,
"Unit":"13"
}
}]},
"Status":"OK",
"Status code":0
}
2024-12-01 11:08:13.116 DEBUG (MainThread) [custom_components.ta_cmi] Sleep mode for 75 seconds to prevent rate limiting

image

next 75 seconds it now fetches again from node 1 I,O,D,Sg,Sd,St,Ss, but fails

2024-12-01 11:09:28.118 DEBUG (MainThread) [custom_components.ta_cmi] Try to fetch available device channels: 1
2024-12-01 11:09:28.118 DEBUG (MainThread) [ta_cmi] Update device: 1
2024-12-01 11:09:28.119 DEBUG (MainThread) [ta_cmi] Make request to device 1 with parameters: I,O,D,Sg,Sd,St,Ss
2024-12-01 11:09:28.119 DEBUG (MainThread) [ta_cmi] Sending request to http://192.168.178.34/INCLUDE/api.cgi?jsonparam=I,O,D,Sg,Sd,St,Ss&jsonnode=1 with None
2024-12-01 11:09:28.163 DEBUG (MainThread) [ta_cmi] Received payload: {
"Header":{
"Version":7,
"Device":"87",
"Timestamp":1733051367
},
"Data":{
},
"Status":"FAIL",
"Status code":2
}
2024-12-01 11:09:28.163 DEBUG (MainThread) [ta_cmi] Failed response received: {"Header": {"Version": 7, "Device": "87", "Timestamp": 1733051367}, "Data": {}, "Status": "FAIL", "Status code": 2}
2024-12-01 11:09:28.164 DEBUG (MainThread) [custom_components.ta_cmi] Sleep mode for 75 seconds to prevent rate limiting

image

next 75 seconds it fetches AM from node 1 but fails with too many requests, is 75 seconds long enough??

2024-12-01 11:10:43.165 DEBUG (MainThread) [custom_components.ta_cmi] Try to fetch device type: 1
2024-12-01 11:10:43.165 DEBUG (MainThread) [ta_cmi] Make request to device 1 with parameters: AM
2024-12-01 11:10:43.166 DEBUG (MainThread) [ta_cmi] Sending request to http://192.168.178.34/INCLUDE/api.cgi?jsonparam=AM&jsonnode=1 with None
2024-12-01 11:10:43.179 DEBUG (MainThread) [ta_cmi] Received payload: {
"Header":{
"Version":7,
"Device":"87",
"Timestamp":1733051442
},
"Data":{
},
"Status":"TOO MANY REQUESTS",
"Status code":4
}
2024-12-01 11:10:43.179 DEBUG (MainThread) [ta_cmi] Failed response received: {"Header": {"Version": 7, "Device": "87", "Timestamp": 1733051442}, "Data": {}, "Status": "TOO MANY REQUESTS", "Status code": 4}
2024-12-01 11:10:43.180 DEBUG (MainThread) [custom_components.ta_cmi] Sleep mode for 75 seconds to prevent rate limiting

next 75 seconds it fetches I,O from node 2, the second UVR16x2

2024-12-01 11:11:58.182 DEBUG (MainThread) [custom_components.ta_cmi] Try to fetch device type: 2
2024-12-01 11:11:58.182 DEBUG (MainThread) [ta_cmi] Make request to device 2 with parameters: I,O
2024-12-01 11:11:58.182 DEBUG (MainThread) [ta_cmi] Sending request to http://192.168.178.34/INCLUDE/api.cgi?jsonparam=I,O&jsonnode=2 with None
2024-12-01 11:11:58.869 DEBUG (MainThread) [ta_cmi] Received payload: {
"Header":{
"Version":7,
"Device":"87",
"Timestamp":1733051517
},
"Data":{
"Inputs":[
{
"Number":1,
"AD":"A",
"Value":{
"Value":6.0,
"Unit":"1"
}
},
{
"Number":2,
"AD":"A",
"Value":{
"Value":23.1,
"Unit":"1"
}
},
{
"Number":3,
"AD":"A",
"Value":{
"Value":36.5,
"Unit":"1"
}
},
{
"Number":4,
"AD":"A",
"Value":{
"Value":45.8,
"Unit":"1"
}
},
{
"Number":5,
"AD":"A",
"Value":{
"Value":23.9,
"Unit":"1"
}
},
{
"Number":7,
"AD":"A",
"Value":{
"Value":42.7,
"Unit":"1"
}
},
{
"Number":8,
"AD":"A",
"Value":{
"Value":3.9,
"Unit":"1"
}
},
{
"Number":9,
"AD":"A",
"Value":{
"Value":4.5,
"Unit":"1"
}
},
{
"Number":10,
"AD":"A",
"Value":{
"Value":2.2,
"Unit":"1"
}
},
{
"Number":11,
"AD":"A",
"Value":{
"Value":6.7,
"Unit":"1"
}
},
{
"Number":12,
"AD":"A",
"Value":{
"Value":11.7,
"Unit":"1"
}
}],
"Outputs":[
{
"Number":1,
"AD":"A",
"Value":{
"State":1,
"Value":30,
"Unit":"0"
}
},
{
"Number":2,
"AD":"D",
"Value":{
"Value":1,
"Unit":"43"
}
},
{
"Number":3,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
},
{
"Number":7,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
},
{
"Number":8,
"AD":"D",
"Value":{
"Value":1,
"Unit":"43"
}
},
{
"Number":10,
"AD":"D",
"Value":{
"Value":0,
"Unit":"43"
}
}]},
"Status":"OK",
"Status code":0
}
2024-12-01 11:11:58.870 DEBUG (MainThread) [custom_components.ta_cmi] Sleep mode for 75 seconds to prevent rate limiting

next 75 seconds the request seems to be to early again and the I,O,D,Sg,Sd,St,Ss request on node 2 stops on too many requests

2024-12-01 11:13:13.873 DEBUG (MainThread) [custom_components.ta_cmi] Try to fetch available device channels: 2
2024-12-01 11:13:13.873 DEBUG (MainThread) [ta_cmi] Update device: 2
2024-12-01 11:13:13.873 DEBUG (MainThread) [ta_cmi] Make request to device 2 with parameters: I,O,D,Sg,Sd,St,Ss
2024-12-01 11:13:13.874 DEBUG (MainThread) [ta_cmi] Sending request to http://192.168.178.34/INCLUDE/api.cgi?jsonparam=I,O,D,Sg,Sd,St,Ss&jsonnode=2 with None
2024-12-01 11:13:13.892 DEBUG (MainThread) [ta_cmi] Received payload: {
"Header":{
"Version":7,
"Device":"87",
"Timestamp":1733051593
},
"Data":{
},
"Status":"TOO MANY REQUESTS",
"Status code":4
}
2024-12-01 11:13:13.893 DEBUG (MainThread) [ta_cmi] Failed response received: {"Header": {"Version": 7, "Device": "87", "Timestamp": 1733051593}, "Data": {}, "Status": "TOO MANY REQUESTS", "Status code": 4}
2024-12-01 11:13:13.893 DEBUG (MainThread) [custom_components.ta_cmi] Sleep mode for 75 seconds to prevent rate limiting

next 75 seconds, now it turns to the last found node 48 (knx interface) but also has too many requests

2024-12-01 11:14:28.894 DEBUG (MainThread) [custom_components.ta_cmi] Try to fetch device type: 48
2024-12-01 11:14:28.895 DEBUG (MainThread) [ta_cmi] Make request to device 48 with parameters: I,O
2024-12-01 11:14:28.895 DEBUG (MainThread) [ta_cmi] Sending request to http://192.168.178.34/INCLUDE/api.cgi?jsonparam=I,O&jsonnode=48 with None
2024-12-01 11:14:28.907 DEBUG (MainThread) [ta_cmi] Received payload: {
"Header":{
"Version":7,
"Device":"84",
"Timestamp":1733051668
},
"Data":{
},
"Status":"TOO MANY REQUESTS",
"Status code":4
}
2024-12-01 11:14:28.908 DEBUG (MainThread) [ta_cmi] Failed response received: {"Header": {"Version": 7, "Device": "84", "Timestamp": 1733051668}, "Data": {}, "Status": "TOO MANY REQUESTS", "Status code": 4}

so the setup stops and results in this dialog

image

pressing the ok button

the dialog promptly changes to

image

there is no additional log entry.

The fully automatic setup approach is really tricky with this json API. Maybe a pre definition of the nodes and an option to increase the waiting time could help?

btw. I can't see the reason why the setup interrupts. There is no log and there are no additional devices created. so I guessed the process stops. Is there a time limit for the setup itself and needs to be increased, too?