@@ -100,6 +100,40 @@ async def refresh_state(
100
100
await execute_platform_entity_command (server , client , command , "async_update" )
101
101
102
102
103
+ class PlatformEntityEnableCommand (PlatformEntityCommand ):
104
+ """Platform entity enable command."""
105
+
106
+ command : Literal [APICommands .PLATFORM_ENTITY_ENABLE ] = (
107
+ APICommands .PLATFORM_ENTITY_ENABLE
108
+ )
109
+
110
+
111
+ @decorators .websocket_command (PlatformEntityEnableCommand )
112
+ @decorators .async_response
113
+ async def enable (
114
+ server : Server , client : Client , command : PlatformEntityEnableCommand
115
+ ) -> None :
116
+ """Enable the platform entity."""
117
+ await execute_platform_entity_command (server , client , command , "enable" )
118
+
119
+
120
+ class PlatformEntityDisableCommand (PlatformEntityCommand ):
121
+ """Platform entity disable command."""
122
+
123
+ command : Literal [APICommands .PLATFORM_ENTITY_DISABLE ] = (
124
+ APICommands .PLATFORM_ENTITY_DISABLE
125
+ )
126
+
127
+
128
+ @decorators .websocket_command (PlatformEntityDisableCommand )
129
+ @decorators .async_response
130
+ async def disable (
131
+ server : Server , client : Client , command : PlatformEntityDisableCommand
132
+ ) -> None :
133
+ """Disable the platform entity."""
134
+ await execute_platform_entity_command (server , client , command , "disable" )
135
+
136
+
103
137
# pylint: disable=import-outside-toplevel
104
138
def load_platform_entity_apis (server : Server ) -> None :
105
139
"""Load the ws apis for all platform entities types."""
@@ -128,6 +162,8 @@ def load_platform_entity_apis(server: Server) -> None:
128
162
)
129
163
130
164
register_api_command (server , refresh_state )
165
+ register_api_command (server , enable )
166
+ register_api_command (server , disable )
131
167
load_alarm_control_panel_api (server )
132
168
load_button_api (server )
133
169
load_climate_api (server )
0 commit comments