Skip to content

Commit

Permalink
Added dummy play/pause toggle. Added manifest.json to be compatible w…
Browse files Browse the repository at this point in the history
  • Loading branch information
cinzas committed Mar 21, 2021
1 parent 3a84182 commit 4f67720
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 11 deletions.
2 changes: 1 addition & 1 deletion enigma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from homeassistant.helpers.entity import Entity

# VERSION
VERSION = '1.3'
VERSION = '1.4'

# REQUIREMENTS
REQUIREMENTS = ['beautifulsoup4==4.6.3']
Expand Down
11 changes: 11 additions & 0 deletions enigma/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"domain": "enigma",
"name": "Enigma2 Integration",
"version" : "1.4",
"documentation": "https://github.com/cinzas/homeassistant-enigma-player",
"issue_tracker": "https://github.com/cinzas/homeassistant-enigma-player/issues",
"dependencies": [],
"after_dependencies": [],
"codeowners": ["@cinzas"],
"requirements": ["beautifulsoup4==4.6.3"]
}
55 changes: 46 additions & 9 deletions enigma/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,20 @@

from custom_components.enigma import _LOGGER, DOMAIN as ENIGMA_DOMAIN
from homeassistant.components.media_player.const import (
MEDIA_TYPE_CHANNEL, MEDIA_TYPE_TVSHOW, SUPPORT_NEXT_TRACK, SUPPORT_PLAY,
SUPPORT_PLAY_MEDIA, SUPPORT_PREVIOUS_TRACK, SUPPORT_SELECT_SOURCE,
SUPPORT_TURN_OFF, SUPPORT_TURN_ON, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET,
SUPPORT_VOLUME_STEP)
MEDIA_TYPE_CHANNEL,
MEDIA_TYPE_TVSHOW,
SUPPORT_NEXT_TRACK,
SUPPORT_PLAY,
SUPPORT_PAUSE,
SUPPORT_PLAY_MEDIA,
SUPPORT_PREVIOUS_TRACK,
SUPPORT_SELECT_SOURCE,
SUPPORT_TURN_OFF,
SUPPORT_TURN_ON,
SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_SET,
SUPPORT_VOLUME_STEP
)
from homeassistant.components.media_player import MediaPlayerEntity
from homeassistant.const import (STATE_OFF, STATE_ON, STATE_UNKNOWN)
import homeassistant.helpers.config_validation as cv
Expand All @@ -56,11 +66,19 @@
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10)
MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(seconds=5)

SUPPORT_ENIGMA = SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE | \
SUPPORT_TURN_ON | SUPPORT_TURN_OFF | \
SUPPORT_SELECT_SOURCE | SUPPORT_NEXT_TRACK | \
SUPPORT_PREVIOUS_TRACK | SUPPORT_VOLUME_STEP | \
SUPPORT_PLAY | SUPPORT_PLAY_MEDIA
SUPPORT_ENIGMA = (
SUPPORT_VOLUME_SET
| SUPPORT_VOLUME_MUTE
| SUPPORT_TURN_ON
| SUPPORT_TURN_OFF
| SUPPORT_SELECT_SOURCE
| SUPPORT_NEXT_TRACK
| SUPPORT_PREVIOUS_TRACK
| SUPPORT_VOLUME_STEP
| SUPPORT_PLAY
| SUPPORT_PLAY_MEDIA
| SUPPORT_PAUSE
)

MAX_VOLUME = 100

Expand Down Expand Up @@ -383,6 +401,25 @@ async def async_mute_volume(self, mute):
"""Mute or unmute media player."""
await self.request_call('/web/vol?set=mute')

# SET - Media Play/pause
@asyncio.coroutine
async def async_media_play_pause(self):
"""Simulate play pause media player."""
_LOGGER.debug("Enigma: [play_pause_toogle] - Does nothing")

# SET - Media Play
@asyncio.coroutine
async def async_media_play(self):
"""Send play command."""
_LOGGER.debug("Enigma: [play] - Does nothing")

# SET - Media Pause
@asyncio.coroutine
async def async_media_pause(self):
"""Send media pause command to media player."""
_LOGGER.debug("Enigma: [pause] - Does nothing")


# SET - Change to channel number
@asyncio.coroutine
async def async_play_media(self, media_type, media_id, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion enigma/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@


# VERSION
VERSION = '1.3'
VERSION = '1.4'

# Default value for display (if not passed as argument in data field)
# 20 seconds for timeout
Expand Down

0 comments on commit 4f67720

Please sign in to comment.