From da6bf9349d1e33bf143a115b4f2a3754d6754472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20T=C3=B3rtola?= <44505946+rtortola@users.noreply.github.com> Date: Sat, 27 Jun 2020 04:01:01 +0200 Subject: [PATCH] Minor bugfixes --- .../samsungtv_custom/media_player.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/custom_components/samsungtv_custom/media_player.py b/custom_components/samsungtv_custom/media_player.py index 598a2c2..6450065 100644 --- a/custom_components/samsungtv_custom/media_player.py +++ b/custom_components/samsungtv_custom/media_player.py @@ -12,7 +12,11 @@ import requests from homeassistant import util -from homeassistant.components.media_player import MediaPlayerEntity, PLATFORM_SCHEMA +from homeassistant.components.media_player import ( + MediaPlayerEntity, + PLATFORM_SCHEMA, + DEVICE_CLASS_TV, +) from homeassistant.components.media_player.const import ( MEDIA_TYPE_CHANNEL, SUPPORT_NEXT_TRACK, @@ -38,8 +42,10 @@ CONF_NAME, CONF_PORT, CONF_TIMEOUT, + CONF_ID, + CONF_TOKEN, STATE_OFF, - STATE_ON, + STATE_ON ) import homeassistant.helpers.config_validation as cv from homeassistant.util import dt as dt_util @@ -49,14 +55,16 @@ MEDIA_TYPE_KEY = "send_key" DEFAULT_NAME = "Samsung TV Remote" DEFAULT_PORT = 55000 -DEFAULT_TIMEOUT = 2 -KEY_PRESS_TIMEOUT = 1.2 +DEFAULT_TIMEOUT = 1.5 +KEY_PRESS_TIMEOUT = 0.3 KNOWN_DEVICES_KEY = "samsungtv_known_devices" SOURCES = {"TV": "KEY_TV", "HDMI": "KEY_HDMI"} CONF_SOURCELIST = "sourcelist" CONF_APPLIST = "applist" CONF_PROTOCOL = "protocol" -MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(seconds=2) +CONF_ID = "" +CONF_TOKEN = "" +MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(seconds=1) MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10) SUPPORT_SAMSUNGTV = (