updating to latest
This commit is contained in:
24
custom_components/hacs/api/check_local_path.py
Normal file
24
custom_components/hacs/api/check_local_path.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""API Handler for check_local_path"""
|
||||
from homeassistant.components import websocket_api
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import voluptuous as vol
|
||||
|
||||
from custom_components.hacs.helpers.functions.path_exsist import async_path_exsist
|
||||
|
||||
|
||||
@websocket_api.async_response
|
||||
@websocket_api.websocket_command(
|
||||
{vol.Required("type"): "hacs/check_path", vol.Optional("path"): cv.string}
|
||||
)
|
||||
async def check_local_path(_hass, connection, msg):
|
||||
"""Handle get media player cover command."""
|
||||
path = msg.get("path")
|
||||
exist = {"exist": False}
|
||||
|
||||
if path is None:
|
||||
return
|
||||
|
||||
if await async_path_exsist(path):
|
||||
exist["exist"] = True
|
||||
|
||||
connection.send_message(websocket_api.result_message(msg["id"], exist))
|
||||
Reference in New Issue
Block a user