Closed avano closed 3 months ago
The design principle was to either return data or an UnexpectedResponse as we are returning the entire data from Jablotron instead of parsing the PG's
We could change it so it returns only a list of programmableGates or an empty list. But IIRC you also needed the states in order to map the cloud component ID?
@fdegier The problem is that I'm not able to recognize connection fail from not having the gates. For thermo devices it works well so I would find it resonable to have it unified.
I suggest to return the data whenever they are valid. For gates it would mean for example that 'states' is present in the data.
The design principle was to either return data or an UnexpectedResponse as we are returning the entire data from Jablotron instead of parsing the PG's
We could change it so it returns only a list of programmableGates or an empty list. But IIRC you also needed the states in order to map the cloud component ID?
@fdegier The problem is that I'm not able to recognize connection fail from not having the gates. For thermo devices it works well so I would find it resonable to have it unified.
I suggest to return the data whenever they are valid. For gates it would mean for example that 'states' is present in the data.
For thermo devices we return states
and not a key specific to thermo devices. And that could be an empty list.
Right, my interation does not need full data and only programmableGates would be enough but I do not want you to do such breakin changes.
I still think you can easily detect whether the response was valid by checking states
key instead of programmableGates
to allow returnin the data with empty programmableGates.
Right, my interation does not need full data and only programmableGates would be enough but I do not want you to do such breakin changes. I still think you can easily detect whether the response was valid by checking
states
key instead ofprogrammableGates
to allow returnin the data with empty programmableGates.
The thing is, if a user doesn't have programmable keys, the key is not even present. So I would return a dict with only states
.
Exactly. As you mentioned earlier. For gates you return all data so this is correct. I'm already checking presence of programmableGates
so it would work just fine.
Exactly. As you mentioned earlier. For gates you return all data so this is correct. I'm already checking presence of
programmableGates
so it would work just fine.
That is the current situation: https://github.com/fdegier/JablotronPy/blob/255fd4d7fbadbf46da4dc919394cbb393330dc9d/jablotronpy/jablotronpy.py#L278
Exactly. As you mentioned earlier. For gates you return all data so this is correct. I'm already checking presence of
programmableGates
so it would work just fine.That is the current situation: https://github.com/fdegier/JablotronPy/blob/255fd4d7fbadbf46da4dc919394cbb393330dc9d/jablotronpy/jablotronpy.py#L278
And I suggest:
if status and 'states' in data:
return data
Exactly. As you mentioned earlier. For gates you return all data so this is correct. I'm already checking presence of
programmableGates
so it would work just fine.That is the current situation: https://github.com/fdegier/JablotronPy/blob/255fd4d7fbadbf46da4dc919394cbb393330dc9d/jablotronpy/jablotronpy.py#L278
And I suggest:
if status and 'states' in data:
return data
Sorry, I misread the "I'm already checking presence of".
Currently we have:
get_services
currently returns data['services']
get_thermo_devices
returns data['states']
get_keyboard_segments
returns data['keyboards']
get_service_history
returns data['events']
get_session_id
returns data
get_sections
returns data
get_programmable_gates
returns data
Shall we unify them all to only check if the request was successful and then returning data
?
I'm trying not to introduce breaking changes so I suggest to keep the data format and fix the code so it only throws when the API does not respond properly. It means checking status and if necessary also presence of some key in data but for sessions, sections and gates it might be optional as the existence of the key is not required there.
New version 0.6.3 allows empty PG
Included in new release.
Just for the record, the bump of jablotronpy
library is not included in 0.6.1
release, but after changing it manually in my installation it works OK
when trying to log in with the 0.6.0 version I only get:
It fails on this line
calling the
get_programmable_gates
manually using jablotronpy library, it returns{'service-states': {'last-event-time': '2024-06-17T12:08:29+0200', 'service-name': '<name>'}, 'states': []}
(with addingprint(data)
there) and raises the exception hereIn the jablotron UI I only have 1
section
and 1keypad
- previously I used thesection
to arm/disarm the alarm using this integration