conson-xp 1.0.1__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {conson_xp-1.0.1 → conson_xp-1.2.0}/PKG-INFO +1 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/pyproject.toml +26 -2
- conson_xp-1.2.0/src/xp/__init__.py +9 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/api/main.py +18 -3
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/api/models/api.py +13 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/api/models/discover.py +12 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/api/routers/conbus_blink.py +18 -6
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/api/routers/conbus_custom.py +11 -3
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/api/routers/conbus_datapoint.py +10 -3
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/api/routers/conbus_output.py +29 -9
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/api/routers/errors.py +6 -5
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/__init__.py +1 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/api.py +1 -5
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/api_start_commands.py +14 -8
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus.py +9 -37
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_actiontable_commands.py +21 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_autoreport_commands.py +21 -11
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_blink_commands.py +53 -21
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_config_commands.py +7 -4
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_custom_commands.py +13 -4
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_datapoint_commands.py +28 -8
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_discover_commands.py +15 -4
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_lightlevel_commands.py +50 -11
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_linknumber_commands.py +21 -11
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_msactiontable_commands.py +25 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_output_commands.py +46 -12
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_raw_commands.py +17 -6
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_receive_commands.py +15 -7
- conson_xp-1.2.0/src/xp/cli/commands/conbus/conbus_scan_commands.py +58 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/file_commands.py +26 -15
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/homekit/homekit.py +14 -8
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/homekit/homekit_start_commands.py +5 -5
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/module_commands.py +26 -19
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/reverse_proxy_commands.py +24 -18
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/server/server_commands.py +18 -18
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/telegram/telegram.py +4 -12
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/telegram/telegram_blink_commands.py +10 -8
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/telegram/telegram_checksum_commands.py +19 -8
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/telegram/telegram_discover_commands.py +2 -4
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/telegram/telegram_linknumber_commands.py +11 -8
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/telegram/telegram_parse_commands.py +10 -9
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/telegram/telegram_version_commands.py +8 -4
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/main.py +5 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/utils/click_tree.py +23 -3
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/utils/datapoint_type_choice.py +20 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/utils/decorators.py +165 -14
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/utils/error_handlers.py +49 -18
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/utils/formatters.py +95 -10
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/utils/serial_number_type.py +18 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/utils/system_function_choice.py +20 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/utils/xp_module_type.py +20 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/connection/__init__.py +1 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/connection/exceptions.py +5 -5
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/__init__.py +1 -1
- conson_xp-1.2.0/src/xp/models/actiontable/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/actiontable/actiontable.py +17 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/actiontable/msactiontable_xp20.py +10 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/actiontable/msactiontable_xp24.py +20 -3
- conson_xp-1.2.0/src/xp/models/actiontable/msactiontable_xp33.py +65 -0
- conson_xp-1.2.0/src/xp/models/conbus/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/conbus/conbus.py +34 -4
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/conbus/conbus_autoreport.py +20 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/conbus/conbus_blink.py +22 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/conbus/conbus_client_config.py +22 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/conbus/conbus_connection_status.py +16 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/conbus/conbus_custom.py +21 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/conbus/conbus_datapoint.py +22 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/conbus/conbus_discover.py +18 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/conbus/conbus_lightlevel.py +20 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/conbus/conbus_linknumber.py +20 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/conbus/conbus_output.py +22 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/conbus/conbus_raw.py +17 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/conbus/conbus_receive.py +16 -2
- conson_xp-1.2.0/src/xp/models/homekit/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/homekit/homekit_accessory.py +15 -1
- conson_xp-1.2.0/src/xp/models/homekit/homekit_config.py +102 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/homekit/homekit_conson_config.py +32 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/log_entry.py +49 -9
- conson_xp-1.2.0/src/xp/models/protocol/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/protocol/conbus_protocol.py +130 -21
- conson_xp-1.2.0/src/xp/models/telegram/__init__.py +1 -0
- conson_xp-1.2.0/src/xp/models/telegram/action_type.py +31 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/telegram/datapoint_type.py +36 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/telegram/event_telegram.py +46 -10
- conson_xp-1.2.0/src/xp/models/telegram/event_type.py +15 -0
- conson_xp-1.2.0/src/xp/models/telegram/input_action_type.py +69 -0
- conson_xp-1.2.0/src/xp/models/telegram/input_type.py +17 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/telegram/module_type.py +69 -19
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/telegram/module_type_code.py +43 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/telegram/output_telegram.py +30 -6
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/telegram/reply_telegram.py +56 -11
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/telegram/system_function.py +35 -3
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/telegram/system_telegram.py +18 -4
- conson_xp-1.2.0/src/xp/models/telegram/telegram.py +28 -0
- conson_xp-1.2.0/src/xp/models/telegram/telegram_type.py +19 -0
- conson_xp-1.2.0/src/xp/models/telegram/timeparam_type.py +51 -0
- conson_xp-1.2.0/src/xp/models/write_config_type.py +33 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/__init__.py +1 -1
- conson_xp-1.2.0/src/xp/services/conbus/__init__.py +1 -0
- conson_xp-1.2.0/src/xp/services/conbus/actiontable/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/actiontable/actiontable_service.py +33 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/actiontable/msactiontable_service.py +40 -3
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/actiontable/msactiontable_xp24_serializer.py +36 -4
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/actiontable/msactiontable_xp33_serializer.py +45 -5
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_autoreport_get_service.py +17 -8
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_autoreport_set_service.py +29 -16
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_blink_all_service.py +40 -21
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_blink_service.py +37 -13
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_custom_service.py +29 -13
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_datapoint_queryall_service.py +40 -16
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_datapoint_service.py +33 -12
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_discover_service.py +43 -7
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_lightlevel_get_service.py +22 -14
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_lightlevel_set_service.py +40 -20
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_linknumber_get_service.py +18 -10
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_linknumber_set_service.py +34 -8
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_output_service.py +33 -13
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_raw_service.py +36 -16
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_receive_service.py +38 -6
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/conbus_scan_service.py +45 -19
- conson_xp-1.2.0/src/xp/services/homekit/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/homekit/homekit_cache_service.py +31 -6
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/homekit/homekit_conbus_service.py +33 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/homekit/homekit_config_validator.py +97 -15
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/homekit/homekit_conson_validator.py +51 -7
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/homekit/homekit_dimminglight.py +47 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/homekit/homekit_dimminglight_service.py +35 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/homekit/homekit_hap_service.py +71 -18
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/homekit/homekit_lightbulb.py +35 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/homekit/homekit_lightbulb_service.py +30 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/homekit/homekit_module_service.py +23 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/homekit/homekit_outlet.py +47 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/homekit/homekit_outlet_service.py +44 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/homekit/homekit_service.py +113 -19
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/log_file_service.py +37 -41
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/module_type_service.py +26 -5
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/protocol/__init__.py +1 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/protocol/conbus_protocol.py +115 -20
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/protocol/protocol_factory.py +40 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/protocol/telegram_protocol.py +38 -7
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/reverse_proxy_service.py +79 -14
- conson_xp-1.2.0/src/xp/services/server/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/server/base_server_service.py +102 -14
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/server/cp20_server_service.py +12 -4
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/server/server_service.py +26 -11
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/server/xp130_server_service.py +11 -3
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/server/xp20_server_service.py +11 -3
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/server/xp230_server_service.py +11 -3
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/server/xp24_server_service.py +33 -6
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/server/xp33_server_service.py +41 -8
- conson_xp-1.2.0/src/xp/services/telegram/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/telegram/telegram_blink_service.py +19 -31
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/telegram/telegram_checksum_service.py +10 -10
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/telegram/telegram_discover_service.py +58 -29
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/telegram/telegram_link_number_service.py +27 -40
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/telegram/telegram_output_service.py +46 -49
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/telegram/telegram_service.py +41 -41
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/telegram/telegram_version_service.py +4 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/utils/__init__.py +1 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/utils/dependencies.py +0 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/utils/serialization.py +6 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/utils/time_utils.py +6 -11
- conson_xp-1.2.0/tests/__init__.py +1 -0
- conson_xp-1.2.0/tests/integration/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/telegram_test_data.py +13 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_actiontable_integration.py +18 -10
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_blink_integration.py +11 -11
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_checksum_integration.py +1 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_conbus_autoreport_integration.py +70 -20
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_conbus_blink_integration.py +24 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_conbus_datapoint_integration.py +32 -15
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_conbus_lightlevel_integration.py +34 -0
- conson_xp-1.2.0/tests/integration/test_conbus_linknumber_integration.py +394 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_conbus_raw_integration.py +32 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_discovery_integration.py +7 -7
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_event_telegram_integration.py +18 -16
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_homekit_config_integration.py +23 -3
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_link_number_integration.py +10 -10
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_module_integration.py +27 -25
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_reverse_proxy_integration.py +24 -15
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_xp20_action_table_integration.py +9 -9
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_xp24_action_table_integration.py +31 -7
- conson_xp-1.2.0/tests/unit/__init__.py +1 -0
- conson_xp-1.2.0/tests/unit/test_cli/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_cli/test_click_tree.py +22 -22
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_cli/test_conbus_actiontable_commands.py +27 -11
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_cli/test_conbus_blink_commands.py +6 -6
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_cli/test_formatters.py +8 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_cli/test_serial_number_type.py +19 -0
- conson_xp-1.2.0/tests/unit/test_connection/__init__.py +1 -0
- conson_xp-1.2.0/tests/unit/test_encoding/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_encoding/test_latin1_edge_cases.py +14 -9
- conson_xp-1.2.0/tests/unit/test_models/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_conbus_client_send.py +17 -15
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_conbus_linknumber.py +12 -10
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_event_telegram.py +11 -9
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_log_entry.py +15 -15
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_module_type.py +20 -18
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_system_telegram_enhancements.py +13 -13
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_version_telegram.py +0 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_xp20_action_table.py +14 -14
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_xp24_action_table.py +11 -11
- conson_xp-1.2.0/tests/unit/test_services/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_actiontable_service.py +16 -16
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_base_server_service.py +5 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_blink_service.py +13 -13
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_conbus_blink_service.py +14 -14
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_conbus_lightlevel_service.py +15 -15
- conson_xp-1.2.0/tests/unit/test_services/test_conbus_linknumber_service.py +392 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_conbus_raw_service.py +11 -11
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_conbus_reverse_proxy_service.py +20 -20
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_discovery_service.py +20 -20
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_homekit_cache_service.py +19 -19
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_homekit_config_validator.py +18 -2
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_homekit_conson_service.py +3 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_homekit_services.py +49 -45
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_link_number_service.py +14 -14
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_log_file_service.py +34 -22
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_module_type_service.py +29 -27
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_protocol.py +29 -27
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_telegram_input_service.py +18 -16
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_telegram_protocol.py +21 -21
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_telegram_service.py +51 -49
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_xp20_action_table_serializer.py +14 -14
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_xp24_action_table_serializer.py +10 -11
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_xp24_action_table_service.py +23 -23
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_xp33_action_table_serializer.py +17 -17
- conson_xp-1.2.0/tests/unit/test_utils/__init__.py +1 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_utils/test_checksum.py +1 -1
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_utils/test_event_helper.py +17 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_utils/test_time_utils.py +16 -16
- conson_xp-1.0.1/src/xp/__init__.py +0 -8
- conson_xp-1.0.1/src/xp/cli/commands/conbus/conbus_scan_commands.py +0 -125
- conson_xp-1.0.1/src/xp/models/actiontable/__init__.py +0 -0
- conson_xp-1.0.1/src/xp/models/actiontable/msactiontable_xp33.py +0 -42
- conson_xp-1.0.1/src/xp/models/conbus/__init__.py +0 -0
- conson_xp-1.0.1/src/xp/models/homekit/__init__.py +0 -0
- conson_xp-1.0.1/src/xp/models/homekit/homekit_config.py +0 -50
- conson_xp-1.0.1/src/xp/models/protocol/__init__.py +0 -0
- conson_xp-1.0.1/src/xp/models/telegram/__init__.py +0 -0
- conson_xp-1.0.1/src/xp/models/telegram/action_type.py +0 -17
- conson_xp-1.0.1/src/xp/models/telegram/event_type.py +0 -8
- conson_xp-1.0.1/src/xp/models/telegram/input_action_type.py +0 -37
- conson_xp-1.0.1/src/xp/models/telegram/input_type.py +0 -9
- conson_xp-1.0.1/src/xp/models/telegram/telegram.py +0 -19
- conson_xp-1.0.1/src/xp/models/telegram/telegram_type.py +0 -12
- conson_xp-1.0.1/src/xp/models/telegram/timeparam_type.py +0 -24
- conson_xp-1.0.1/src/xp/models/write_config_type.py +0 -18
- conson_xp-1.0.1/src/xp/services/conbus/__init__.py +0 -0
- conson_xp-1.0.1/src/xp/services/conbus/actiontable/__init__.py +0 -0
- conson_xp-1.0.1/src/xp/services/homekit/__init__.py +0 -0
- conson_xp-1.0.1/src/xp/services/server/__init__.py +0 -0
- conson_xp-1.0.1/src/xp/services/telegram/__init__.py +0 -0
- conson_xp-1.0.1/tests/__init__.py +0 -0
- conson_xp-1.0.1/tests/integration/__init__.py +0 -0
- conson_xp-1.0.1/tests/integration/test_conbus_linknumber_integration.py +0 -469
- conson_xp-1.0.1/tests/unit/__init__.py +0 -0
- conson_xp-1.0.1/tests/unit/test_cli/__init__.py +0 -0
- conson_xp-1.0.1/tests/unit/test_connection/__init__.py +0 -0
- conson_xp-1.0.1/tests/unit/test_encoding/__init__.py +0 -1
- conson_xp-1.0.1/tests/unit/test_models/__init__.py +0 -0
- conson_xp-1.0.1/tests/unit/test_services/__init__.py +0 -0
- conson_xp-1.0.1/tests/unit/test_services/test_conbus_linknumber_service.py +0 -427
- conson_xp-1.0.1/tests/unit/test_utils/__init__.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/LICENSE +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/README.md +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/api/__init__.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/api/models/__init__.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/api/routers/__init__.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/api/routers/conbus.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/__main__.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/__init__.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/homekit/__init__.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/server/__init__.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/telegram/__init__.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/utils/__init__.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/models/response.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/actiontable/actiontable_serializer.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/services/conbus/actiontable/msactiontable_xp20_serializer.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/utils/checksum.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/utils/event_helper.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/.coverage +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/conftest.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/.coverage +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_api/.coverage +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_api/__init__.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_conbus_receive_integration.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_output_integration.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_system_reply_telegram_integration.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/integration/test_version_integration.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_api/__init__.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_cli/test_datapoint_type_choice.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_cli/test_decorators.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_cli/test_error_handlers.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_cli/test_system_function_choice.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_connection/test_connection_init.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_connection/test_exceptions.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_conbus.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_conbus_discover.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_reply_telegram.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_system_telegram.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_write_config_type.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_models/test_xp24_action_telegram.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_checksum_service.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_server_service.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_version_service.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_xp24_action_service.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_services/test_xp_server_services.py +0 -0
- {conson_xp-1.0.1 → conson_xp-1.2.0}/tests/unit/test_utils/test_serialization.py +0 -0
|
@@ -20,7 +20,7 @@ dependencies = [
|
|
|
20
20
|
]
|
|
21
21
|
requires-python = ">=3.11"
|
|
22
22
|
readme = "README.md"
|
|
23
|
-
version = "1.0
|
|
23
|
+
version = "1.2.0"
|
|
24
24
|
|
|
25
25
|
[project.license]
|
|
26
26
|
file = "LICENSE"
|
|
@@ -41,6 +41,9 @@ dev = [
|
|
|
41
41
|
"pytest-cov>=7.0",
|
|
42
42
|
"black>=25.9",
|
|
43
43
|
"flake8>=7.3",
|
|
44
|
+
"flake8-docstrings>=1.7.0",
|
|
45
|
+
"flake8-docstrings-complete>=1.3.0",
|
|
46
|
+
"interrogate>=1.7.0",
|
|
44
47
|
"mypy>=1.18",
|
|
45
48
|
"ruff>=0.13.0",
|
|
46
49
|
"vulture>=2.14",
|
|
@@ -165,10 +168,12 @@ test-cov = "env PYTHONPATH=src python -m pytest tests/ --quiet --cov=src/xp --co
|
|
|
165
168
|
lint = "ruff check --fix src/ tests/"
|
|
166
169
|
format = "black src/ tests/"
|
|
167
170
|
typecheck = "mypy src/ tests/"
|
|
171
|
+
flake8 = "flake8 src/ tests/"
|
|
172
|
+
interrogate = "interrogate -vv src/"
|
|
168
173
|
vulture = "vulture src/ tests/"
|
|
169
174
|
refurb = "refurb src/ tests/"
|
|
170
175
|
isort = "isort src/ tests/"
|
|
171
|
-
bump-version = "pdm bump -v
|
|
176
|
+
bump-version = "pdm bump -v minor"
|
|
172
177
|
env = "echo ${PATH}"
|
|
173
178
|
install = "pdm install"
|
|
174
179
|
install-dev = "pdm install -G dev"
|
|
@@ -189,6 +194,8 @@ composite = [
|
|
|
189
194
|
"lint",
|
|
190
195
|
"format",
|
|
191
196
|
"typecheck",
|
|
197
|
+
"flake8",
|
|
198
|
+
"interrogate",
|
|
192
199
|
"vulture",
|
|
193
200
|
"refurb",
|
|
194
201
|
"isort",
|
|
@@ -222,6 +229,23 @@ version-files = [
|
|
|
222
229
|
"src/xp/__init__.py:__version__",
|
|
223
230
|
]
|
|
224
231
|
|
|
232
|
+
[tool.interrogate]
|
|
233
|
+
ignore-init-method = true
|
|
234
|
+
ignore-init-module = false
|
|
235
|
+
fail-under = 95
|
|
236
|
+
exclude = [
|
|
237
|
+
"tests",
|
|
238
|
+
"docs",
|
|
239
|
+
"build",
|
|
240
|
+
"dist",
|
|
241
|
+
]
|
|
242
|
+
verbose = 1
|
|
243
|
+
quiet = false
|
|
244
|
+
whitelist-regex = []
|
|
245
|
+
color = true
|
|
246
|
+
generate-badge = "."
|
|
247
|
+
badge-format = "svg"
|
|
248
|
+
|
|
225
249
|
[build-system]
|
|
226
250
|
requires = [
|
|
227
251
|
"pdm-backend",
|
|
@@ -18,7 +18,11 @@ logger = logging.getLogger(__name__)
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def load_api_config() -> dict[str, Any]:
|
|
21
|
-
"""Load API configuration from api.yml or environment variables.
|
|
21
|
+
"""Load API configuration from api.yml or environment variables.
|
|
22
|
+
|
|
23
|
+
Returns:
|
|
24
|
+
Dictionary containing API configuration settings.
|
|
25
|
+
"""
|
|
22
26
|
config = {
|
|
23
27
|
"title": "XP Protocol API",
|
|
24
28
|
"description": "REST API for XP Protocol Conbus operations",
|
|
@@ -63,6 +67,9 @@ def create_app(container: ServiceContainer) -> FastAPI:
|
|
|
63
67
|
|
|
64
68
|
Args:
|
|
65
69
|
container: Optional ServiceContainer instance. If not provided, a new one will be created.
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
Configured FastAPI application instance.
|
|
66
73
|
"""
|
|
67
74
|
config = load_api_config()
|
|
68
75
|
|
|
@@ -92,13 +99,21 @@ def create_app(container: ServiceContainer) -> FastAPI:
|
|
|
92
99
|
# Health check endpoint
|
|
93
100
|
@fastapi.get("/health")
|
|
94
101
|
async def health_check() -> dict[str, str]:
|
|
95
|
-
"""
|
|
102
|
+
"""Return health status of the API.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
Dictionary containing status and service information.
|
|
106
|
+
"""
|
|
96
107
|
return {"status": "healthy", "service": "xp-api"}
|
|
97
108
|
|
|
98
109
|
# Root endpoint
|
|
99
110
|
@fastapi.get("/")
|
|
100
111
|
async def root() -> dict[str, str]:
|
|
101
|
-
"""
|
|
112
|
+
"""Return API information and available endpoints.
|
|
113
|
+
|
|
114
|
+
Returns:
|
|
115
|
+
Dictionary containing API metadata and endpoint links.
|
|
116
|
+
"""
|
|
102
117
|
return {
|
|
103
118
|
"message": "XP Protocol API",
|
|
104
119
|
"version": config["version"],
|
|
@@ -6,7 +6,13 @@ from pydantic import BaseModel, Field
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class ApiResponse(BaseModel):
|
|
9
|
-
"""Response model for successful Input operation.
|
|
9
|
+
"""Response model for successful Input operation.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
success: Operation success status.
|
|
13
|
+
result: Result value.
|
|
14
|
+
description: Description of the result.
|
|
15
|
+
"""
|
|
10
16
|
|
|
11
17
|
success: bool = Field(default=True, description="Operation success status")
|
|
12
18
|
result: Optional[str] = Field(default=None, description="Result")
|
|
@@ -14,7 +20,12 @@ class ApiResponse(BaseModel):
|
|
|
14
20
|
|
|
15
21
|
|
|
16
22
|
class ApiErrorResponse(BaseModel):
|
|
17
|
-
"""Response model for failed Input operation.
|
|
23
|
+
"""Response model for failed Input operation.
|
|
24
|
+
|
|
25
|
+
Attributes:
|
|
26
|
+
success: Operation success status (always False).
|
|
27
|
+
error: Error message describing what went wrong.
|
|
28
|
+
"""
|
|
18
29
|
|
|
19
30
|
success: bool = Field(default=False, description="Operation success status")
|
|
20
31
|
error: str = Field(..., description="Error message")
|
|
@@ -6,7 +6,12 @@ from pydantic import BaseModel, Field
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class DiscoverResponse(BaseModel):
|
|
9
|
-
"""Response model for successful discover operation.
|
|
9
|
+
"""Response model for successful discover operation.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
success: Operation success status.
|
|
13
|
+
devices: List of discovered device information strings.
|
|
14
|
+
"""
|
|
10
15
|
|
|
11
16
|
success: bool = Field(default=True, description="Operation success status")
|
|
12
17
|
devices: List[str] = Field(
|
|
@@ -15,7 +20,12 @@ class DiscoverResponse(BaseModel):
|
|
|
15
20
|
|
|
16
21
|
|
|
17
22
|
class DiscoverErrorResponse(BaseModel):
|
|
18
|
-
"""Response model for failed discover operation.
|
|
23
|
+
"""Response model for failed discover operation.
|
|
24
|
+
|
|
25
|
+
Attributes:
|
|
26
|
+
success: Operation success status (always False).
|
|
27
|
+
error: Error message describing what went wrong.
|
|
28
|
+
"""
|
|
19
29
|
|
|
20
30
|
success: bool = Field(default=False, description="Operation success status")
|
|
21
31
|
error: str = Field(..., description="Error message")
|
|
@@ -29,10 +29,16 @@ async def blink_on(
|
|
|
29
29
|
request: Request,
|
|
30
30
|
serial_number: str = "1702033007",
|
|
31
31
|
) -> Union[ApiResponse, ApiErrorResponse, JSONResponse]:
|
|
32
|
-
"""
|
|
33
|
-
|
|
32
|
+
"""Turn on device blinking.
|
|
33
|
+
|
|
34
|
+
Sends a blink on telegram to make the device blink.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
request: FastAPI request object.
|
|
38
|
+
serial_number: Serial number of the device.
|
|
34
39
|
|
|
35
|
-
|
|
40
|
+
Returns:
|
|
41
|
+
API response with blink result or error.
|
|
36
42
|
"""
|
|
37
43
|
service = request.app.state.container.get_container().resolve(ConbusBlinkService)
|
|
38
44
|
|
|
@@ -74,10 +80,16 @@ async def blink_off(
|
|
|
74
80
|
request: Request,
|
|
75
81
|
serial_number: str = "1702033007",
|
|
76
82
|
) -> Union[ApiResponse, ApiErrorResponse, JSONResponse]:
|
|
77
|
-
"""
|
|
78
|
-
|
|
83
|
+
"""Turn off device blinking.
|
|
84
|
+
|
|
85
|
+
Sends a blink off telegram to stop the device from blinking.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
request: FastAPI request object.
|
|
89
|
+
serial_number: Serial number of the device.
|
|
79
90
|
|
|
80
|
-
|
|
91
|
+
Returns:
|
|
92
|
+
API response with blink result or error.
|
|
81
93
|
"""
|
|
82
94
|
service = request.app.state.container.get_container().resolve(ConbusBlinkService)
|
|
83
95
|
|
|
@@ -30,10 +30,18 @@ async def custom_function(
|
|
|
30
30
|
function_code: str = "02",
|
|
31
31
|
data: str = "00",
|
|
32
32
|
) -> Union[ApiResponse, ApiErrorResponse, JSONResponse]:
|
|
33
|
-
"""
|
|
34
|
-
|
|
33
|
+
"""Execute a custom function on a device.
|
|
34
|
+
|
|
35
|
+
Sends a custom telegram with specified function code and data.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
request: FastAPI request object.
|
|
39
|
+
serial_number: Serial number of the device.
|
|
40
|
+
function_code: Function code to execute.
|
|
41
|
+
data: Data to send with the function.
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
Returns:
|
|
44
|
+
API response with custom function result or error.
|
|
37
45
|
"""
|
|
38
46
|
service = request.app.state.container.get_container().resolve(ConbusCustomService)
|
|
39
47
|
# SendDatapoint telegram and receive responses
|
|
@@ -30,10 +30,17 @@ async def datapoint_devices(
|
|
|
30
30
|
datapoint: DataPointType = DataPointType.SW_VERSION,
|
|
31
31
|
serial_number: str = "1702033007",
|
|
32
32
|
) -> Union[ApiResponse, ApiErrorResponse, JSONResponse]:
|
|
33
|
-
"""
|
|
34
|
-
|
|
33
|
+
"""Query a datapoint value from a device.
|
|
34
|
+
|
|
35
|
+
Sends a datapoint query telegram and retrieves the requested datapoint value.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
request: FastAPI request object.
|
|
39
|
+
datapoint: Type of datapoint to query (default: SW_VERSION).
|
|
40
|
+
serial_number: Serial number of the device.
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
Returns:
|
|
43
|
+
API response with datapoint value or error.
|
|
37
44
|
"""
|
|
38
45
|
service = request.app.state.container.get_container().resolve(
|
|
39
46
|
ConbusDatapointService
|
|
@@ -32,10 +32,18 @@ async def input_action(
|
|
|
32
32
|
serial: str = "1702033007",
|
|
33
33
|
device_input: int = 0,
|
|
34
34
|
) -> Union[ApiResponse, ApiErrorResponse, JSONResponse]:
|
|
35
|
-
"""
|
|
36
|
-
|
|
35
|
+
"""Initiate Input operation to find devices on the network.
|
|
36
|
+
|
|
37
|
+
Sends a broadcast Input telegram and collects responses from all connected devices.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
request: FastAPI request object.
|
|
41
|
+
action: Action type to perform (default: OFF_PRESS).
|
|
42
|
+
serial: Serial number of the device.
|
|
43
|
+
device_input: Device input number.
|
|
37
44
|
|
|
38
|
-
|
|
45
|
+
Returns:
|
|
46
|
+
API response with operation result or error.
|
|
39
47
|
"""
|
|
40
48
|
service = request.app.state.container.get_container().resolve(ConbusOutputService)
|
|
41
49
|
|
|
@@ -77,10 +85,16 @@ async def output_status(
|
|
|
77
85
|
request: Request,
|
|
78
86
|
serial_number: str,
|
|
79
87
|
) -> Union[ApiResponse, ApiErrorResponse, JSONResponse]:
|
|
80
|
-
"""
|
|
81
|
-
|
|
88
|
+
"""Query output status from a device.
|
|
89
|
+
|
|
90
|
+
Sends a status query telegram and retrieves the output state.
|
|
82
91
|
|
|
83
|
-
|
|
92
|
+
Args:
|
|
93
|
+
request: FastAPI request object.
|
|
94
|
+
serial_number: Serial number of the device to query.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
API response with output status or error.
|
|
84
98
|
"""
|
|
85
99
|
service = request.app.state.container.get_container().resolve(ConbusOutputService)
|
|
86
100
|
|
|
@@ -119,10 +133,16 @@ async def output_state(
|
|
|
119
133
|
request: Request,
|
|
120
134
|
serial_number: str,
|
|
121
135
|
) -> Union[ApiResponse, ApiErrorResponse, JSONResponse]:
|
|
122
|
-
"""
|
|
123
|
-
|
|
136
|
+
"""Query module state from a device.
|
|
137
|
+
|
|
138
|
+
Sends a state query telegram and retrieves the module state.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
request: FastAPI request object.
|
|
142
|
+
serial_number: Serial number of the device to query.
|
|
124
143
|
|
|
125
|
-
|
|
144
|
+
Returns:
|
|
145
|
+
API response with module state or error.
|
|
126
146
|
"""
|
|
127
147
|
service = request.app.state.container.get_container().resolve(ConbusOutputService)
|
|
128
148
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"""Error handling utilities for API endpoints."""
|
|
2
|
+
|
|
1
3
|
from starlette import status
|
|
2
4
|
from starlette.responses import JSONResponse
|
|
3
5
|
|
|
@@ -7,15 +9,14 @@ from xp.api.models.discover import DiscoverErrorResponse
|
|
|
7
9
|
def handle_service_error(
|
|
8
10
|
error: str, default_status_code: int = status.HTTP_500_INTERNAL_SERVER_ERROR
|
|
9
11
|
) -> JSONResponse:
|
|
10
|
-
"""
|
|
11
|
-
Handle service errors by creating a standardized JSON error response.
|
|
12
|
+
"""Handle service errors by creating a standardized JSON error response.
|
|
12
13
|
|
|
13
14
|
Args:
|
|
14
|
-
error: Service response object with success and error attributes
|
|
15
|
-
default_status_code: HTTP status code to use (defaults to 500)
|
|
15
|
+
error: Service response object with success and error attributes.
|
|
16
|
+
default_status_code: HTTP status code to use (defaults to 500).
|
|
16
17
|
|
|
17
18
|
Returns:
|
|
18
|
-
JSONResponse with error details
|
|
19
|
+
JSONResponse with error details.
|
|
19
20
|
"""
|
|
20
21
|
error_msg = error or "Unknown service error"
|
|
21
22
|
|
|
@@ -38,6 +38,7 @@ from xp.cli.commands.conbus.conbus_datapoint_commands import (
|
|
|
38
38
|
)
|
|
39
39
|
from xp.cli.commands.conbus.conbus_discover_commands import send_discover_telegram
|
|
40
40
|
from xp.cli.commands.conbus.conbus_lightlevel_commands import (
|
|
41
|
+
xp_lightlevel_get,
|
|
41
42
|
xp_lightlevel_off,
|
|
42
43
|
xp_lightlevel_on,
|
|
43
44
|
xp_lightlevel_set,
|
|
@@ -8,9 +8,5 @@ from click_help_colors import HelpColorsGroup
|
|
|
8
8
|
cls=HelpColorsGroup, help_headers_color="yellow", help_options_color="green"
|
|
9
9
|
)
|
|
10
10
|
def api() -> None:
|
|
11
|
-
"""
|
|
12
|
-
API server management commands.
|
|
13
|
-
|
|
14
|
-
Manage the FastAPI server for XP Protocol operations.
|
|
15
|
-
"""
|
|
11
|
+
"""Manage the FastAPI server for XP Protocol operations."""
|
|
16
12
|
pass
|
|
@@ -58,31 +58,37 @@ def start_api_server(
|
|
|
58
58
|
log_level: str,
|
|
59
59
|
access_log: bool,
|
|
60
60
|
) -> None:
|
|
61
|
-
"""
|
|
62
|
-
Start the FastAPI server.
|
|
61
|
+
r"""Start the FastAPI server.
|
|
63
62
|
|
|
64
63
|
This command starts the XP Protocol FastAPI server using uvicorn.
|
|
65
64
|
The server provides REST API endpoints for Conbus operations.
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
Args:
|
|
67
|
+
context: Click context object.
|
|
68
|
+
host: Host to bind the server to.
|
|
69
|
+
port: Port to bind the server to.
|
|
70
|
+
reload: Enable auto-reload for development.
|
|
71
|
+
workers: Number of worker processes.
|
|
72
|
+
log_level: Log level for the server.
|
|
73
|
+
access_log: Enable/disable access log.
|
|
68
74
|
|
|
69
|
-
|
|
75
|
+
Examples:
|
|
76
|
+
\b
|
|
70
77
|
# Start server on default host and port
|
|
71
78
|
xp api start
|
|
72
79
|
|
|
73
|
-
|
|
80
|
+
\b
|
|
74
81
|
# Start server on specific host and port
|
|
75
82
|
xp api start --host 0.0.0.0 --port 8080
|
|
76
83
|
|
|
77
|
-
|
|
84
|
+
\b
|
|
78
85
|
# Start development server with auto-reload
|
|
79
86
|
xp api start --reload
|
|
80
87
|
|
|
81
|
-
|
|
88
|
+
\b
|
|
82
89
|
# Start production server with multiple workers
|
|
83
90
|
xp api start --host 0.0.0.0 --workers 4 --no-access-log
|
|
84
91
|
"""
|
|
85
|
-
|
|
86
92
|
# Validate workers and reload options
|
|
87
93
|
if reload and workers > 1:
|
|
88
94
|
click.echo(
|
|
@@ -8,9 +8,7 @@ from click_help_colors import HelpColorsGroup
|
|
|
8
8
|
cls=HelpColorsGroup, help_headers_color="yellow", help_options_color="green"
|
|
9
9
|
)
|
|
10
10
|
def conbus() -> None:
|
|
11
|
-
"""
|
|
12
|
-
Conbus client operations for sending telegrams to remote servers
|
|
13
|
-
"""
|
|
11
|
+
"""Perform Conbus client operations for sending telegrams to remote servers."""
|
|
14
12
|
pass
|
|
15
13
|
|
|
16
14
|
|
|
@@ -21,9 +19,7 @@ def conbus() -> None:
|
|
|
21
19
|
help_options_color="green",
|
|
22
20
|
)
|
|
23
21
|
def conbus_blink() -> None:
|
|
24
|
-
"""
|
|
25
|
-
Conbus client operations for sending blink telegrams to remote servers
|
|
26
|
-
"""
|
|
22
|
+
"""Perform Conbus client operations for sending blink telegrams to remote servers."""
|
|
27
23
|
pass
|
|
28
24
|
|
|
29
25
|
|
|
@@ -34,9 +30,7 @@ def conbus_blink() -> None:
|
|
|
34
30
|
help_options_color="green",
|
|
35
31
|
)
|
|
36
32
|
def conbus_output() -> None:
|
|
37
|
-
"""
|
|
38
|
-
Conbus input operations to remote servers
|
|
39
|
-
"""
|
|
33
|
+
"""Perform Conbus input operations to remote servers."""
|
|
40
34
|
pass
|
|
41
35
|
|
|
42
36
|
|
|
@@ -47,9 +41,7 @@ def conbus_output() -> None:
|
|
|
47
41
|
help_options_color="green",
|
|
48
42
|
)
|
|
49
43
|
def conbus_datapoint() -> None:
|
|
50
|
-
"""
|
|
51
|
-
Conbus datapoint operations for querying module datapoints
|
|
52
|
-
"""
|
|
44
|
+
"""Perform Conbus datapoint operations for querying module datapoints."""
|
|
53
45
|
pass
|
|
54
46
|
|
|
55
47
|
|
|
@@ -61,11 +53,7 @@ def conbus_datapoint() -> None:
|
|
|
61
53
|
short_help="Link number operations",
|
|
62
54
|
)
|
|
63
55
|
def conbus_linknumber() -> None:
|
|
64
|
-
"""
|
|
65
|
-
Link number operations for modules.
|
|
66
|
-
|
|
67
|
-
Set or get the link number for specific modules.
|
|
68
|
-
"""
|
|
56
|
+
"""Set or get the link number for specific modules."""
|
|
69
57
|
pass
|
|
70
58
|
|
|
71
59
|
|
|
@@ -77,11 +65,7 @@ def conbus_linknumber() -> None:
|
|
|
77
65
|
short_help="Auto report status operations",
|
|
78
66
|
)
|
|
79
67
|
def conbus_autoreport() -> None:
|
|
80
|
-
"""
|
|
81
|
-
Auto report status operations for modules.
|
|
82
|
-
|
|
83
|
-
Get or set the auto report status for specific modules.
|
|
84
|
-
"""
|
|
68
|
+
"""Get or set the auto report status for specific modules."""
|
|
85
69
|
pass
|
|
86
70
|
|
|
87
71
|
|
|
@@ -93,11 +77,7 @@ def conbus_autoreport() -> None:
|
|
|
93
77
|
short_help="Light level operations",
|
|
94
78
|
)
|
|
95
79
|
def conbus_lightlevel() -> None:
|
|
96
|
-
"""
|
|
97
|
-
Light level operations for modules.
|
|
98
|
-
|
|
99
|
-
Control light level (dimming) of outputs on Conbus modules.
|
|
100
|
-
"""
|
|
80
|
+
"""Control light level (dimming) of outputs on Conbus modules."""
|
|
101
81
|
pass
|
|
102
82
|
|
|
103
83
|
|
|
@@ -109,11 +89,7 @@ def conbus_lightlevel() -> None:
|
|
|
109
89
|
short_help="MSActionTable operations",
|
|
110
90
|
)
|
|
111
91
|
def conbus_msactiontable() -> None:
|
|
112
|
-
"""
|
|
113
|
-
msactiontable operations for modules.
|
|
114
|
-
|
|
115
|
-
Download msactiontable on Conbus modules.
|
|
116
|
-
"""
|
|
92
|
+
"""Download msactiontable on Conbus modules."""
|
|
117
93
|
pass
|
|
118
94
|
|
|
119
95
|
|
|
@@ -125,11 +101,7 @@ def conbus_msactiontable() -> None:
|
|
|
125
101
|
short_help="ActionTable operations",
|
|
126
102
|
)
|
|
127
103
|
def conbus_actiontable() -> None:
|
|
128
|
-
"""
|
|
129
|
-
ActionTable operations for modules.
|
|
130
|
-
|
|
131
|
-
Download ActionTable from Conbus modules.
|
|
132
|
-
"""
|
|
104
|
+
"""Download ActionTable from Conbus modules."""
|
|
133
105
|
pass
|
|
134
106
|
|
|
135
107
|
|
{conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_actiontable_commands.py
RENAMED
|
@@ -22,13 +22,28 @@ from xp.services.conbus.actiontable.actiontable_service import (
|
|
|
22
22
|
@click.pass_context
|
|
23
23
|
@connection_command()
|
|
24
24
|
def conbus_download_actiontable(ctx: Context, serial_number: str) -> None:
|
|
25
|
-
"""Download action table from XP module
|
|
25
|
+
"""Download action table from XP module.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
ctx: Click context object.
|
|
29
|
+
serial_number: 10-digit module serial number.
|
|
30
|
+
"""
|
|
26
31
|
service = ctx.obj.get("container").get_container().resolve(ActionTableService)
|
|
27
32
|
|
|
28
33
|
def progress_callback(progress: str) -> None:
|
|
34
|
+
"""Handle progress updates during action table download.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
progress: Progress message string.
|
|
38
|
+
"""
|
|
29
39
|
click.echo(progress)
|
|
30
40
|
|
|
31
41
|
def finish_callback(actiontable: ActionTable) -> None:
|
|
42
|
+
"""Handle successful completion of action table download.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
actiontable: Downloaded action table object.
|
|
46
|
+
"""
|
|
32
47
|
output = {
|
|
33
48
|
"serial_number": serial_number,
|
|
34
49
|
"actiontable": asdict(actiontable),
|
|
@@ -36,6 +51,11 @@ def conbus_download_actiontable(ctx: Context, serial_number: str) -> None:
|
|
|
36
51
|
click.echo(json.dumps(output, indent=2, default=str))
|
|
37
52
|
|
|
38
53
|
def error_callback(error: str) -> None:
|
|
54
|
+
"""Handle errors during action table download.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
error: Error message string.
|
|
58
|
+
"""
|
|
39
59
|
click.echo(error)
|
|
40
60
|
|
|
41
61
|
with service:
|
{conson_xp-1.0.1 → conson_xp-1.2.0}/src/xp/cli/commands/conbus/conbus_autoreport_commands.py
RENAMED
|
@@ -22,14 +22,14 @@ from xp.services.conbus.conbus_autoreport_set_service import ConbusAutoreportSet
|
|
|
22
22
|
@connection_command()
|
|
23
23
|
@click.pass_context
|
|
24
24
|
def get_autoreport_command(ctx: Context, serial_number: str) -> None:
|
|
25
|
-
"""
|
|
26
|
-
Get the current auto report status for a specific module.
|
|
25
|
+
r"""Get the current auto report status for a specific module.
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
Args:
|
|
28
|
+
ctx: Click context object.
|
|
29
|
+
serial_number: 10-digit module serial number.
|
|
29
30
|
|
|
30
31
|
Examples:
|
|
31
|
-
|
|
32
|
-
\b
|
|
32
|
+
\b
|
|
33
33
|
xp conbus autoreport get 0123450001
|
|
34
34
|
"""
|
|
35
35
|
# Get service from container
|
|
@@ -38,6 +38,11 @@ def get_autoreport_command(ctx: Context, serial_number: str) -> None:
|
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
def on_finish(service_response: ConbusAutoreportResponse) -> None:
|
|
41
|
+
"""Handle successful completion of auto report status retrieval.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
service_response: Auto report response object.
|
|
45
|
+
"""
|
|
41
46
|
click.echo(json.dumps(service_response.to_dict(), indent=2))
|
|
42
47
|
|
|
43
48
|
with service:
|
|
@@ -53,15 +58,15 @@ def get_autoreport_command(ctx: Context, serial_number: str) -> None:
|
|
|
53
58
|
@connection_command()
|
|
54
59
|
@click.pass_context
|
|
55
60
|
def set_autoreport_command(ctx: Context, serial_number: str, status: str) -> None:
|
|
56
|
-
"""
|
|
57
|
-
Set the auto report status for a specific module.
|
|
61
|
+
r"""Set the auto report status for a specific module.
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
Args:
|
|
64
|
+
ctx: Click context object.
|
|
65
|
+
serial_number: 10-digit module serial number.
|
|
66
|
+
status: Auto report status - either 'on' or 'off'.
|
|
61
67
|
|
|
62
68
|
Examples:
|
|
63
|
-
|
|
64
|
-
\b
|
|
69
|
+
\b
|
|
65
70
|
xp conbus autoreport set 0123450001 on
|
|
66
71
|
xp conbus autoreport set 0123450001 off
|
|
67
72
|
"""
|
|
@@ -72,6 +77,11 @@ def set_autoreport_command(ctx: Context, serial_number: str, status: str) -> Non
|
|
|
72
77
|
status_bool = status.lower() == "on"
|
|
73
78
|
|
|
74
79
|
def on_finish(service_response: ConbusAutoreportResponse) -> None:
|
|
80
|
+
"""Handle successful completion of auto report status setting.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
service_response: Auto report response object.
|
|
84
|
+
"""
|
|
75
85
|
click.echo(json.dumps(service_response.to_dict(), indent=2))
|
|
76
86
|
|
|
77
87
|
with service:
|