Reworked scripts to buttons only, fixes #414

This commit is contained in:
Tomaae 2025-05-01 11:21:10 +02:00
parent ee886e0365
commit 6487398741
No known key found for this signature in database
GPG key ID: 60C51A657EEF2D87
5 changed files with 8 additions and 42 deletions

View file

@ -14,6 +14,7 @@ from .button_types import (
SENSOR_TYPES,
SENSOR_SERVICES,
)
from .exceptions import ApiEntryNotFound
_LOGGER = getLogger(__name__)
@ -54,5 +55,8 @@ class MikrotikScriptButton(MikrotikButton):
"""Representation of a script button."""
async def async_press(self) -> None:
"""Process the button press."""
self.coordinator.run_script(self._data["name"])
"""Run script using Mikrotik API"""
try:
self.coordinator.api.run_script(self._data["name"])
except ApiEntryNotFound as error:
_LOGGER.error("Failed to run script: %s", error)