Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command: Add SET_CLOSURE_AND_ORIENTATION #955

Merged
merged 1 commit into from
Sep 2, 2023

Conversation

fetzerch
Copy link
Contributor

@fetzerch fetzerch commented Sep 2, 2023

Add SET_CLOSURE_AND_ORIENTATION to the command enum. This command is supported by Somfy J4 io Protect motors and allows to set the blind closure as well as the slide orientation in one command.

I would like to add support for this command to the home assistant overkiz integration in the future. But for now I'd already find it helpful if the command was available in the python-overkiz-api.

The main advantage for using this command (compared to individual commands) is that the slides will not change the orientation if the motor is already in the correct closure position. There's also no need to wait for the target position to be reached before modifying the orientation. It's also helpful for automating multiple motors, because it allows that in less commands overall.

Add SET_CLOSURE_AND_ORIENTATION to the command enum. This command
is supported by Somfy J4 io Protect motors and allows to set the blind
closure as well as the slide orientation in one command.

The main advantage for using this command (compared to individual
commands) is that the slides will not change the orientation if the
motor is already in the correct closure position. There's also no need
to wait for the target position to be reached before modifying the
orientation. It's also helpful for automating multiple motors, because
it allows that in less commands overall.
@tetienne
Copy link
Collaborator

tetienne commented Sep 2, 2023

Many thanks for your contribution. Have you an example of device definition to add in comment of your PR?

@fetzerch
Copy link
Contributor Author

fetzerch commented Sep 2, 2023

Wow, thanks for your instant feedback @tetienne. Sure, here you go:

Relevant part of /setup.

        {
            "creationTime": 1589998486000,
            "lastUpdateTime": 1589998486000,
            "label": "Esszimmer (Terrasse)",
            "deviceURL": "io://XXXX-XXXX-XXXX/XXXXXXX",
            "shortcut": false,
            "controllableName": "io:ExteriorVenetianBlindIOComponent",
            "metadata": "{\"tahoma\":{\"slateOrientationPreference\":\"180\"}}",
            "definition": {
                "commands": [
                    {
                        "commandName": "addLockLevel",
                        "nparams": 2
                    },
                    {
                        "commandName": "advancedRefresh",
                        "nparams": 2
                    },
                    {
                        "commandName": "close",
                        "nparams": 0
                    },
                    {
                        "commandName": "delayedStopIdentify",
                        "nparams": 1
                    },
                    {
                        "commandName": "down",
                        "nparams": 0
                    },
                    {
                        "commandName": "getName",
                        "nparams": 0
                    },
                    {
                        "commandName": "identify",
                        "nparams": 0
                    },
                    {
                        "commandName": "my",
                        "nparams": 0
                    },
                    {
                        "commandName": "open",
                        "nparams": 0
                    },
                    {
                        "commandName": "refreshMemorized1Position",
                        "nparams": 0
                    },
                    {
                        "commandName": "removeLockLevel",
                        "nparams": 1
                    },
                    {
                        "commandName": "resetLockLevels",
                        "nparams": 0
                    },
                    {
                        "commandName": "setClosureAndOrientation",
                        "nparams": 2
                    },
                    {
                        "commandName": "setClosure",
                        "nparams": 1
                    },
                    {
                        "commandName": "setMemorized1Orientation",
                        "nparams": 1
                    },
                    {
                        "commandName": "setMemorized1Position",
                        "nparams": 1
                    },
                    {
                        "commandName": "setName",
                        "nparams": 1
                    },
                    {
                        "commandName": "setPosition",
                        "nparams": 1
                    },
                    {
                        "commandName": "setSecuredPosition",
                        "nparams": 1
                    },
                    {
                        "commandName": "setOrientation",
                        "nparams": 1
                    },
                    {
                        "commandName": "startIdentify",
                        "nparams": 0
                    },
                    {
                        "commandName": "stop",
                        "nparams": 0
                    },
                    {
                        "commandName": "stopIdentify",
                        "nparams": 0
                    },
                    {
                        "commandName": "up",
                        "nparams": 0
                    },
                    {
                        "commandName": "wink",
                        "nparams": 1
                    },
                    {
                        "commandName": "runManufacturerSettingsCommand",
                        "nparams": 2
                    },
                    {
                        "commandName": "keepOneWayControllersAndDeleteNode",
                        "nparams": 0
                    },
                    {
                        "commandName": "pairOneWayController",
                        "nparams": 2
                    },
                    {
                        "commandName": "sendIOKey",
                        "nparams": 0
                    },
                    {
                        "commandName": "setConfigState",
                        "nparams": 1
                    },
                    {
                        "commandName": "unpairAllOneWayControllersAndDeleteNode",
                        "nparams": 0
                    },
                    {
                        "commandName": "unpairAllOneWayControllers",
                        "nparams": 0
                    },
                    {
                        "commandName": "unpairOneWayController",
                        "nparams": 2
                    }
                ],
                "states": [
                    {
                        "type": "DataState",
                        "qualifiedName": "core:AdditionalStatusState"
                    },
                    {
                        "type": "ContinuousState",
                        "qualifiedName": "core:ClosureState"
                    },
                    {
                        "eventBased": true,
                        "type": "DataState",
                        "qualifiedName": "core:CommandLockLevelsState"
                    },
                    {
                        "type": "DiscreteState",
                        "values": [
                            "good",
                            "low",
                            "normal",
                            "verylow"
                        ],
                        "qualifiedName": "core:DiscreteRSSILevelState"
                    },
                    {
                        "type": "DataState",
                        "qualifiedName": "core:ManufacturerDiagnosticsState"
                    },
                    {
                        "type": "DataState",
                        "qualifiedName": "core:ManufacturerSettingsState"
                    },
                    {
                        "type": "ContinuousState",
                        "qualifiedName": "core:Memorized1OrientationState"
                    },
                    {
                        "type": "ContinuousState",
                        "qualifiedName": "core:Memorized1PositionState"
                    },
                    {
                        "type": "DiscreteState",
                        "values": [
                            "false",
                            "true"
                        ],
                        "qualifiedName": "core:MovingState"
                    },
                    {
                        "type": "DataState",
                        "qualifiedName": "core:NameState"
                    },
                    {
                        "type": "DiscreteState",
                        "values": [
                            "closed",
                            "open"
                        ],
                        "qualifiedName": "core:OpenClosedState"
                    },
                    {
                        "type": "ContinuousState",
                        "qualifiedName": "core:PriorityLockTimerState"
                    },
                    {
                        "type": "ContinuousState",
                        "qualifiedName": "core:RSSILevelState"
                    },
                    {
                        "type": "ContinuousState",
                        "qualifiedName": "core:SecuredPositionState"
                    },
                    {
                        "type": "ContinuousState",
                        "qualifiedName": "core:SlateOrientationState"
                    },
                    {
                        "type": "DiscreteState",
                        "values": [
                            "available",
                            "unavailable"
                        ],
                        "qualifiedName": "core:StatusState"
                    },
                    {
                        "type": "ContinuousState",
                        "qualifiedName": "core:TargetClosureState"
                    },
                    {
                        "type": "DiscreteState",
                        "values": [
                            "comfortLevel1",
                            "comfortLevel2",
                            "comfortLevel3",
                            "comfortLevel4",
                            "environmentProtection",
                            "humanProtection",
                            "userLevel1",
                            "userLevel2"
                        ],
                        "qualifiedName": "io:PriorityLockLevelState"
                    },
                    {
                        "type": "DiscreteState",
                        "values": [
                            "LSC",
                            "SAAC",
                            "SFC",
                            "UPS",
                            "externalGateway",
                            "localUser",
                            "myself",
                            "rain",
                            "security",
                            "temperature",
                            "timer",
                            "user",
                            "wind"
                        ],
                        "qualifiedName": "io:PriorityLockOriginatorState"
                    }
                ],
                "dataProperties": [
                    {
                        "value": "500",
                        "qualifiedName": "core:identifyInterval"
                    }
                ],
                "widgetName": "PositionableExteriorVenetianBlind",
                "uiProfiles": [
                    "StatefulVenetianBlind",
                    "StatefulOrientableAndCloseable",
                    "OrientableAndCloseable",
                    "OpenClose"
                ],
                "uiClass": "ExteriorVenetianBlind",
                "qualifiedName": "io:ExteriorVenetianBlindIOComponent",
                "type": "ACTUATOR"
            },
            "states": [
                {
                    "name": "core:NameState",
                    "type": 3,
                    "value": "Esszimmer (Terra"
                },
                {
                    "name": "core:PriorityLockTimerState",
                    "type": 1,
                    "value": 0
                },
                {
                    "name": "core:CommandLockLevelsState",
                    "type": 3,
                    "value": "[]",
                    "lastUpdateTime": 1689827408000
                },
                {
                    "name": "core:StatusState",
                    "type": 3,
                    "value": "available"
                },
                {
                    "name": "core:DiscreteRSSILevelState",
                    "type": 3,
                    "value": "good"
                },
                {
                    "name": "core:RSSILevelState",
                    "type": 2,
                    "value": 98.0
                },
                {
                    "name": "core:ManufacturerSettingsState",
                    "type": 11,
                    "value": {
                        "x_time": "enable",
                        "roll_end_limit_state": "Manual_validated",
                        "setting_state": "User mode",
                        "current_position": 0,
                        "kinematics": "EVB_alternative",
                        "unroll_end_limit_state": "Manual_validated",
                        "current_tilt": 0
                    }
                },
                {
                    "name": "core:Memorized1OrientationState",
                    "type": 1,
                    "value": 58
                },
                {
                    "name": "core:MovingState",
                    "type": 6,
                    "value": false
                },
                {
                    "name": "core:SlateOrientationState",
                    "type": 1,
                    "value": 0
                },
                {
                    "name": "core:ClosureState",
                    "type": 1,
                    "value": 0
                },
                {
                    "name": "core:OpenClosedState",
                    "type": 3,
                    "value": "open"
                },
                {
                    "name": "core:SecuredPositionState",
                    "type": 1,
                    "value": 0
                },
                {
                    "name": "core:TargetClosureState",
                    "type": 1,
                    "value": 0
                },
                {
                    "name": "core:Memorized1PositionState",
                    "type": 1,
                    "value": 100
                }
            ],
            "attributes": [
                {
                    "name": "core:SupportedManufacturerSettingsCommands",
                    "type": 10,
                    "value": [
                        "dead_man_up",
                        "dead_man_down",
                        "dead_man_stop",
                        "dead_man_impulse_up",
                        "dead_man_impulse_down",
                        "enter_settings_mode",
                        "enter_auxiliary_parameter_settings_mode",
                        "save_upper_end_limit",
                        "save_lower_end_limit",
                        "stop_after_save_limit",
                        "save_settings",
                        "save_flat_slats_position",
                        "save_evb_tilting_travel",
                        "set_evb_tilting_travel_pulse",
                        "save_my_position",
                        "delete_my_position",
                        "set_choregraphy_disable_variator_down_move_min",
                        "set_choregraphy_disable_variator_up_move_min",
                        "set_choregraphy_enable_variator_down_move_min",
                        "set_choregraphy_enable_variator_up_move_min",
                        "set_kinematics",
                        "set_obstacle_detection",
                        "reset_actuator",
                        "double_power_cut",
                        "eject_from_setting_mode",
                        "set_x_time"
                    ]
                },
                {
                    "name": "core:FirmwareRevision",
                    "type": 3,
                    "value": "5128194A12"
                },
                {
                    "name": "core:Manufacturer",
                    "type": 3,
                    "value": "Somfy"
                }
            ],
            "available": true,
            "enabled": true,
            "placeOID": "820b99c2-ed17-4e11-a7c8-2d300e80f093",
            "type": 1,
            "widget": "PositionableExteriorVenetianBlind",
            "oid": "765ba1c1-eb08-4ea6-9760-7cdb87dcdbf4",
            "uiClass": "ExteriorVenetianBlind"
        },

And here's the trace from the TaHoma webinterface calling the command:

{
	"actions": [
		{
			"commands": [
				{
					"name": "setClosureAndOrientation",
					"parameters": [
						93,
						22
					]
				}
			],
			"deviceURL": "io://XXXX-XXXX-XXXX/XXXXXXX"
		}
	],
	"label": "Büro (Süd) - Positionieren auf 93 % - Ausrichtung 22% - TaHoma PC"
}

And for completeness here's how it's displayed in the web interface:

grafik

@tetienne tetienne merged commit 5316256 into iMicknl:main Sep 2, 2023
5 checks passed
@tetienne
Copy link
Collaborator

tetienne commented Sep 2, 2023

Perfect!

@fetzerch fetzerch deleted the closure-and-orientation branch September 2, 2023 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants