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"],
"codeowners": ["@e2002"],
"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__)
VERSION = '0.4.323'
VERSION = '0.5.010'
DOMAIN = "yoradio"
@@ -67,16 +67,25 @@ class yoradioApi():
self.root_topic = root_topic
async def set_command(self, 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):
command = "vol " + str(volume)
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):
number = source.split('.')
command = "play " + number[0]
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):
try: