home assistant v0.5.010

This commit is contained in:
e2002
2022-03-17 20:02:52 +03:00
parent c995e789e8
commit 5fd0a1b98c
2 changed files with 14 additions and 5 deletions

View File

@@ -5,5 +5,5 @@
"dependencies": ["http", "mqtt"], "dependencies": ["http", "mqtt"],
"codeowners": ["@e2002"], "codeowners": ["@e2002"],
"requirements": [], "requirements": [],
"version": "0.4.323" "version": "0.5.010"
} }

View File

@@ -8,7 +8,7 @@ from homeassistant.helpers.aiohttp_client import async_get_clientsession
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
VERSION = '0.4.323' VERSION = '0.5.010'
DOMAIN = "yoradio" DOMAIN = "yoradio"
@@ -67,16 +67,25 @@ class yoradioApi():
self.root_topic = root_topic self.root_topic = root_topic
async def set_command(self, command): async def set_command(self, command):
self.mqtt.async_publish(self.root_topic + '/command', command) try:
self.mqtt.async_publish(self.root_topic + '/command', command)
except:
await self.mqtt.async_publish(self.hass, self.root_topic + '/command', command)
async def set_volume(self, volume): async def set_volume(self, volume):
command = "vol " + str(volume) command = "vol " + str(volume)
self.mqtt.async_publish(self.root_topic + '/command', command) try:
self.mqtt.async_publish(self.root_topic + '/command', command)
except:
await self.mqtt.async_publish(self.hass, self.root_topic + '/command', command)
async def set_source(self, source): async def set_source(self, source):
number = source.split('.') number = source.split('.')
command = "play " + number[0] command = "play " + number[0]
self.mqtt.async_publish(self.root_topic + '/command', command) try:
self.mqtt.async_publish(self.root_topic + '/command', command)
except:
await self.mqtt.async_publish(self.hass, self.root_topic + '/command', command)
async def load_playlist(self, msg): async def load_playlist(self, msg):
try: try: