A custom Home Assistant integration that creates configurable media player entities by linking existing entities and actions. Perfect for creating unified media player controls from separate switches, sensors, and automations.
- Flexible Entity Mapping: Link any Home Assistant entities to media player functions
- Custom Actions: Configure Home Assistant actions for all media player controls
- Dynamic Volume Control: Automatically adapts to your volume entity's min/max range
- Media Information: Display title, artist, album, artwork, position, and duration
- Source Selection: Control input sources from any select entity
- Sequential Configuration: Easy step-by-step setup through the UI
- Real-time Updates: Automatically reflects changes from linked entities
- Open HACS in your Home Assistant instance
- Go to "Integrations"
- Click the "+" button
- Search for "CC Player"
- Install the integration
- Restart Home Assistant
- Download the latest release from the releases page
- Extract the
ccplayer
folder to yourcustom_components
directory - Restart Home Assistant
- Go to Settings → Devices & Services
- Click Add Integration
- Search for "CC Player"
- Follow the configuration steps:
- Power Entity: Switch or input_boolean for on/off control
- Player State Entity: Sensor or input_select indicating player state
- Volume Entity: input_number or number entity for volume control
- Mute Entity: Switch or input_boolean for mute control
- Source Entity: input_select or select for input source selection
- Source List Entity: Sensor or input_text containing available sources
- Volume Step: Percentage step for volume up/down (default: 5%)
- Media Title Entity: Sensor or input_text for current title
- Media Artist Entity: Sensor or input_text for current artist
- Media Album Entity: Sensor or input_text for current album
- Media Image Entity: Image entity for artwork
- Media Position Entity: Sensor or input_number for playback position (in ms)
- Media Duration Entity: Sensor or input_number for media duration (in ms)
Configure Home Assistant actions for each media player function:
- Play Action: Action to start playback
- Pause Action: Action to pause playback
- Stop Action: Action to stop playback
- Next Track Action: Action to skip to next
- Previous Track Action: Action to go to previous
- Seek Action: Action to seek to position (templates available:
{{ position }}
,{{ seek_position }}
) - Play Media Action: Action to play specific media (templates:
{{ media_id }}
,{{ media_type }}
) - And more...
# Example entities you might link to CC Player
input_boolean:
media_player_power:
name: "Media Player Power"
input_select:
media_player_state:
name: "Media Player State"
options:
- "off"
- "playing"
- "paused"
- "idle"
input_number:
media_player_volume:
name: "Media Player Volume"
min: 0
max: 100
step: 1
sensor:
- platform: template
sensors:
current_media_title:
value_template: "{{ states('sensor.kodi_title') }}"
When configuring actions in the CC Player setup, you can use any Home Assistant action:
Simple Service Call:
service: media_player.media_play
target:
entity_id: media_player.kodi
Script Execution:
service: script.turn_on
target:
entity_id: script.play_music
Template-based Seek:
service: kodi.call_method
data:
entity_id: media_player.kodi
method: Player.Seek
playerid: 1
value:
percentage: "{{ position_pct }}"
CC Player provides several template variables for actions:
{{ position }}
: Seek position in seconds{{ seek_position }}
: Calculated seek position{{ position_pct }}
: Position as percentage of duration
{{ media_id }}
: Media content ID{{ media_type }}
: Media content type{{ media_content_id }}
: Alias for media_id{{ media_content_type }}
: Alias for media_type
input_boolean
- For power, mute controlsinput_select
- For player state, source selectioninput_number
- For volume, position, durationinput_text
- For media information
switch
- For power, mute controlssensor
- For state monitoring, media infoselect
- For source selectionnumber
- For volume controlimage
- For media artwork
CC Player automatically maps these states from your player state entity:
Entity State | Media Player State |
---|---|
playing , play |
Playing |
paused , pause |
Paused |
stopped , stop |
Idle |
idle |
Idle |
buffering |
Buffering |
on , true |
On |
off , false |
Off |
- Check Home Assistant logs for errors
- Ensure all required files are in
custom_components/ccplayer/
- Restart Home Assistant after installation
- Verify linked entities exist and have valid states
- Check entity IDs are spelled correctly
- Ensure linked entities are not in "unknown" or "unavailable" states
- Test actions manually in Developer Tools
- Check action syntax in YAML mode
- Verify service calls and entity references
- Ensure volume entity has
min
andmax
attributes - Check volume entity accepts
set_value
service - Verify volume step configuration
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Note: Replace yourusername
with your actual GitHub username in all URLs.