Shame,
I don’t think it would work with a jailbroken switch having nintendo servers disabled, right?
Nope, it reads a friends online status, so that would require Nintendo online services.
@Sennevds
the orig. instructions states a ‘template’ directory and in the post linked below ‘media_player_template’ is written. Which one is it?
Noob-Question: How do I download the files from the GitHub components folder?
hi i just found this the other day and i am loving it thanks to everyone involved in making this. this should really be a core function of HASSIO imo.
one question though: is this integration still maintained? On Github it says discontinued?
reason i am asking is that i am missing one feature: “Browse Media” for the media player. it would be awesome to have this
The code owner is still active on GitHub, so the ‘not maintained’ label is a bit misleading.
There was a PR merged 2 weeks ago, but it appears not to have been versioned yet. I’m sure you know, but just in case, you’ll either need to download manually to get it, or make sure you install the ‘master’ version via HACS.
If you post your feature request as an issue on GitHub with the ‘enhancement’ label, it might get some attention - there are other coders who seem to be submitting PRs.
I’m the original creator of the integration. I’m not actively maintaining the integration myself but if someone creates a PR I will review it and merge it.
is it somehow possible to increase the button size (play, pause, next, etc) ?
i suppose i would have to edit the code of the integration itself?
The integration does nothing with the UI it’s only the connection between home assistant and a external device
thanks for the clarification.
then i guess this won’t be possible
Did you ever get this working? I also have a TDAI and would love to get it working in some fashion in HA but am struggling to figure out how…
I did manage to get this to work. In summary, Lyngdorf has a tcp interface to receive commands. I set up media_template to interface with a Node-RED interface via MQTT commands.
That said, someone is in the works to create a full Lyngdorf integration - am eagerly waiting for that!
First, you’ll need to create some sensors using MQTT (to receive the tcp commands and volume control), and also a boolean status to detect power mode:
mqtt:
sensor:
- name: "TDAI-TCP"
state_topic: "/tdai/tcp"
- name: "TDAI-SetVol"
state_topic: "/tdai/setvolume"
input_boolean:
tdai_powerstatus:
name: TDAI Power
icon: mdi:receiver
initial: off
This is the media template configuration. Not everything is working but it suffices for me.
media_player:
- platform: media_player_template
media_players:
tdai_1120:
friendly_name: TDAI-1120
device_class: receiver
current_source_template: "{{ states('sensor.tdai_1120_source') }}"
current_volume_template: "{{ states('sensor.tdai_1120_volume') }}"
value_template: >
{% if is_state("input_boolean.tdai_powerstatus", "on") -%}
on
{%- else -%}
off
{%- endif %}
turn_on:
service: mqtt.publish
data:
topic: "tdai/tcp"
payload: "!ON"
turn_off:
service: mqtt.publish
data:
topic: "tdai/tcp"
payload: "!OFF"
volume_up:
service: mqtt.publish
data:
topic: "tdai/tcp"
payload: "!VOLUP"
volume_down:
service: mqtt.publish
data:
topic: "tdai/tcp"
payload: "!VOLDN"
inputs:
Computer:
service: mqtt.publish
data:
topic: "tdai/tcp"
payload: "!SRC(6)"
Spotify:
service: mqtt.publish
data:
topic: "tdai/tcp"
payload: "!SRC(8)"
Chromecast:
service: mqtt.publish
data:
topic: "tdai/tcp"
payload: "!SRC(7)"
set_volume:
service: input_text.set_value
data:
entity_id: input_text.selected_volume
value: "{{volume}}"
mute:
service: mqtt.publish
data:
topic: "tdai/tcp"
payload: "!MUTE"
# service: input_number.set_value
# data:
# entity_id: input_number.selected_is_muted
# value: "{{is_muted}}"
# current_is_muted_template: >
# {{ states('input_boolean.is_muted') }}
# album_art_template: "{{ states('input_text.album_art') }}"
# title_template: "{{ states('input_text.title') }}"
# album_template: "{{ states('input_text.album') }}"
# artist_template: "{{ states('input_text.artist') }}"
Lastly, you need to install Node-RED, and import the code here. You will need to update all nodes indicated “TDAI TCP” with your TDAI’s IP address.
[{"id":"817bda0157563770","type":"tab","label":"TDAI","disabled":false,"info":"","env":[]},{"id":"1e25f439db7c41f2","type":"function","z":"817bda0157563770","name":"VOL","func":"msg.payload = \"!VOL?\\n\"\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":560,"wires":[["5adc54bbd5e1f1b4"]]},{"id":"21dc72af88200195","type":"inject","z":"817bda0157563770","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":620,"y":520,"wires":[[]]},{"id":"5adc54bbd5e1f1b4","type":"tcp request","z":"817bda0157563770","name":"TDAI TCP","server":"192.168.3.14","port":"84","out":"char","ret":"string","splitc":"\\n","newline":"","trim":false,"tls":"","x":1010,"y":560,"wires":[["a2481608fb510172"]]},{"id":"c19b2d05ba8ae091","type":"poll-state","z":"817bda0157563770","name":"TDAI Power","server":"8ceaa1a2.5a09f","version":3,"exposeAsEntityConfig":"","updateInterval":"10","updateIntervalType":"num","updateIntervalUnits":"seconds","outputInitially":true,"outputOnChanged":true,"entityId":"input_boolean.tdai_powerstatus","stateType":"str","ifState":"on","ifStateType":"str","ifStateOperator":"is","outputs":2,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":610,"y":580,"wires":[["1e25f439db7c41f2","1fc49fb532090529"],[]]},{"id":"a2481608fb510172","type":"function","z":"817bda0157563770","name":"Parse VOL","func":"msg.payload = msg.payload.toString('utf8')\nlet trim = msg.payload.trim()\nlet text = trim.split('(')[1]\nlet output = text.slice(0,-1)\nmsg.payload = output / 10\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":560,"wires":[["03895453be07f1c9"]]},{"id":"03895453be07f1c9","type":"ha-sensor","z":"817bda0157563770","name":"TDAI Volume","entityConfig":"0ffbecd6a8416847","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1330,"y":560,"wires":[[]]},{"id":"1fc49fb532090529","type":"function","z":"817bda0157563770","name":"SRCNAME","func":"msg.payload = \"!SRCNAME?\\n\"\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":850,"y":500,"wires":[["ee2e4b89572a97f0"]]},{"id":"ee2e4b89572a97f0","type":"tcp request","z":"817bda0157563770","name":"TDAI TCP","server":"192.168.3.14","port":"84","out":"char","ret":"string","splitc":"\\n","newline":"","trim":false,"tls":"","x":1010,"y":500,"wires":[["e8c6b9573b656402"]]},{"id":"e8c6b9573b656402","type":"function","z":"817bda0157563770","name":"Parse SRC","func":"msg.payload = msg.payload.toString('utf8')\nlet trim = msg.payload.trim()\nlet text = trim.split('\"')[1]\nmsg.payload = text\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":500,"wires":[["51eb191e94cb82ea"]]},{"id":"51eb191e94cb82ea","type":"ha-sensor","z":"817bda0157563770","name":"TDAI Source","entityConfig":"b0f71ceab7f4a062","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1330,"y":500,"wires":[[]]},{"id":"0998489497d46ce2","type":"mqtt in","z":"817bda0157563770","name":"TDAI-TCP","topic":"tdai/tcp","qos":"0","datatype":"auto-detect","broker":"de32d2e0f0f9525e","nl":false,"rap":true,"rh":0,"inputs":0,"x":300,"y":360,"wires":[["729487b213e153ab"]]},{"id":"e679d3429217cac4","type":"tcp request","z":"817bda0157563770","name":"TDAI TCP","server":"192.168.3.14","port":"84","out":"char","ret":"string","splitc":"\\n","newline":"","trim":false,"tls":"","x":610,"y":360,"wires":[[]]},{"id":"729487b213e153ab","type":"function","z":"817bda0157563770","name":"TCP Input","func":"msg.payload = msg.payload + '\\n'\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":360,"wires":[["e679d3429217cac4","4b8f6b9e6a0faee1"]]},{"id":"910f7fc789cc5cda","type":"function","z":"817bda0157563770","name":"PWR","func":"msg.payload = \"!PWR?\\n\"\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":700,"wires":[["15a103e255b62575"]]},{"id":"15a103e255b62575","type":"tcp request","z":"817bda0157563770","name":"TDAI TCP","server":"192.168.3.14","port":"84","out":"char","ret":"buffer","splitc":"\\n","newline":"","trim":false,"tls":"","x":1010,"y":700,"wires":[["bdf1e35213934646"]]},{"id":"bdf1e35213934646","type":"function","z":"817bda0157563770","name":"Parse PWR","func":"msg.payload = msg.payload.toString('utf8')\nlet trim = msg.payload.trim()\nlet text = trim.split('(')[1]\nlet output = text.slice(0,-1)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":700,"wires":[["87f83d4f9fef106c"]]},{"id":"1a614b9dff49fbc8","type":"poll-state","z":"817bda0157563770","name":"Powered on?","server":"8ceaa1a2.5a09f","version":3,"exposeAsEntityConfig":"","updateInterval":"60","updateIntervalType":"num","updateIntervalUnits":"seconds","outputInitially":true,"outputOnChanged":true,"entityId":"media_player.room","stateType":"str","ifState":"unavailable","ifStateType":"str","ifStateOperator":"is_not","outputs":2,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":610,"y":700,"wires":[["910f7fc789cc5cda"],[]]},{"id":"64e5674550ee4c62","type":"api-call-service","z":"817bda0157563770","name":"TDAI is on","server":"8ceaa1a2.5a09f","version":5,"debugenabled":true,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.tdai_powerstatus"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1510,"y":680,"wires":[[]]},{"id":"87f83d4f9fef106c","type":"switch","z":"817bda0157563770","name":"PWR status","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"!PWR(ON)","vt":"str"},{"t":"cont","v":"!PWR(OFF)","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1330,"y":700,"wires":[["64e5674550ee4c62"],["8cf2286bc9be0ab8"]]},{"id":"8cf2286bc9be0ab8","type":"api-call-service","z":"817bda0157563770","name":"TDAI is off","server":"8ceaa1a2.5a09f","version":5,"debugenabled":true,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.tdai_powerstatus"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1510,"y":740,"wires":[[]]},{"id":"29b65025d6def908","type":"api-call-service","z":"817bda0157563770","name":"TDAI is on","server":"8ceaa1a2.5a09f","version":5,"debugenabled":true,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.tdai_powerstatus"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":850,"y":380,"wires":[[]]},{"id":"4b8f6b9e6a0faee1","type":"switch","z":"817bda0157563770","name":"Parse input trigger","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"!ON","vt":"str"},{"t":"cont","v":"!OFF","vt":"str"},{"t":"cont","v":"SRC","vt":"str"},{"t":"cont","v":"!VOL","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":630,"y":420,"wires":[["29b65025d6def908"],["911ee78b2a565feb"],["1fc49fb532090529"],["1e25f439db7c41f2"]]},{"id":"911ee78b2a565feb","type":"api-call-service","z":"817bda0157563770","name":"TDAI is off","server":"8ceaa1a2.5a09f","version":5,"debugenabled":true,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.tdai_powerstatus"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":850,"y":420,"wires":[[]]},{"id":"8ceaa1a2.5a09f","type":"server","name":"HomeAssistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"0ffbecd6a8416847","type":"ha-entity-config","server":"8ceaa1a2.5a09f","deviceConfig":"30f7e9dc29c13dea","name":"tdai.volume","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"TDAI-1120 Volume"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"dB"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"b0f71ceab7f4a062","type":"ha-entity-config","server":"8ceaa1a2.5a09f","deviceConfig":"30f7e9dc29c13dea","name":"tdai.source","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"TDAI-1120 Source"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"de32d2e0f0f9525e","type":"mqtt-broker","name":"HA-MQTT","broker":"localhost","port":"1883","clientid":"core-mosquitto","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"30f7e9dc29c13dea","type":"ha-device-config","name":"TDAI-1120","hwVersion":"","manufacturer":"Lyngdorf","model":"","swVersion":""}]
I got my current Netflix activity in a mediaplayer template card with this
Now I’m going to try and supply some sort of epsiode image to it and find a way to trigger the node-red flow to fill it.This will be a bigger challenge
does anybody have any idea how to set this up with a denon pma 900 hne? it uses heos integration, i am trying to get speaker a, b, and a+b buttons.
i was able to telnet into the amp and see these commands when i press the speaker button on the actual amp.
-
PSSPK A
-
PSSPK B
-
PSSPK AB
-
PSSPK OFF
there is no button on the remote for speaker(s) and the heos app does not show back a command when switching the toggle
thank you!
Hello,
with the entity “number.omnilink_zone_2_volume” I can adjust my media player volume but with this configuration the volume selection doesn’t work:
media_player:
platform: media_player_template
media_players:
2bagno:
value_template: >
{% if is_state("switch.omnilink_zone_2", "on") -%}
on
{%- else -%}
off
{%- endif %}
turn_on:
service: switch.turn_on
data_template:
entity_id: switch.omnilink_zone_2
turn_off:
service: switch.turn_off
data_template:
entity_id: switch.omnilink_zone_2
set_volume:
service: number.set_value
data:
entity_id: number.omnilink_zone_2_volume
value: "{{volume}}"
what am I doing wrong?
Looks like you are trying to set up with omnilink now that it has support for audio. Please let me know how it goes for you, so far I’m not sure how to get this to work. I’ve installed Media_player.template but I’m not sure where to put the config you have above. I was hoping I would see a media entity that I could make a card for using the Mushroom Media Card.
Did you find a solution to this?
If you can telnet into your device, I’m thinking you should also be able to ssh into it as well, right? If yes, then you should be able to configure a shell_command integration in your configuration.yaml like the following.
shell_command:
shutdown_macmini3: ssh -o UserKnownHostsFile=/config/.ssh/known_hosts -i /config/.ssh/id_rsa [email protected] sudo shutdown -h now
To get this to work, you need to first add the ssh login credentials of the device into a local UserKnownHostsFile, so it won’t ask for a password and simply would do a login-and-run-command action.
So in the above example, when I press a button, macmini shuts down.
Similar thing is also possible for JSON commands using a rest_command integration if your receiver supports them.
which would be something like the following.
This example selects source input of a bias led device in my case (usb_capture or led_device).
rest_command:
hyperhdr_usb_capture:
url: http://192.168.xx.xx:8090/json-rpc
method: POST
headers:
accept: 'application/json, text/html'
user-agent: 'Mozilla/5.0 {{ useragent }}'
payload: '{ "command":"componentstate", "componentstate": { "component":"VIDEOGRABBER", "state": {{ state }} } }'
content_type: 'application/json; charset=utf-8'
hyperhdr_led_device:
url: http://192.168.xx.xx:8090/json-rpc
method: POST
headers:
accept: 'application/json, text/html'
user-agent: 'Mozilla/5.0 {{ useragent }}'
payload: '{ "command":"componentstate", "componentstate": { "component":"LEDDEVICE", "state": {{ state }} } }'
content_type: 'application/json; charset=utf-8'
I hope this helps.
Hi again, it seems that amp does not support JSON API or the ssh but only uses the ancient telnet method.
You will have to use the telnet integration.
You should be able to do what you want this way.
Maybe you might want to use buttons instead of switches.
However, If your amp asks for a password with telnet, I don’t know how the telnet integration supports passwords.
Hi @Sennevds,
I just realized I’m getting this error in the log:
Log details (WARNING)
Logger: homeassistant.helpers.entity
Source: helpers/entity.py:1607
First occurred: 5:12:52 PM (3 occurrences)
Last logged: 5:12:52 PM
* Entity media_player.receiver (<class 'custom_components.media_player_template.media_player.MediaPlayerTemplate'>) is using deprecated supported features values which will be removed in HA Core 2025.1.
Instead it should use <MediaPlayerEntityFeature.PAUSE|SEEK|VOLUME_SET|VOLUME_MUTE|PREVIOUS_TRACK|NEXT_TRACK|TURN_ON|TURN_OFF|VOLUME_STEP|SELECT_SOURCE|STOP|PLAY|SELECT_SOUND_MODE: 89535>,
please create a bug report at https://github.com/Sennevds/media_player.template/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Apparently there already is an issue posted on the GitHub.
Have you abandoned the project or will you fix it at some point?
I have made a example universal media player and a template media player for a android device running the hass app:
- platform: universal
unique_id: bluscream_phone
name: "Bluscream's Phone"
device_class: tv
commands:
turn_on:
service: notify.mobile_app_timos_handy
data:
message: command_media
data:
media_command: play
turn_off:
service: notify.mobile_app_timos_handy
data:
message: command_media
data:
media_command: pause
volume_set:
service: notify.mobile_app_timos_handy
data:
message: command_volume_level
data:
media_stream: music_stream
command: "{{ volume_level }}"
volume_up:
service: notify.mobile_app_timos_handy
data:
message: command_media
data:
media_command: volume_up
volume_down:
service: notify.mobile_app_timos_handy
data:
message: command_media
data:
media_command: volume_down
volume_mute:
service: notify.mobile_app_timos_handy
data:
message: "command_volume_level"
data:
media_stream: "music_stream"
command: "{{0 if is_volume_muted else 15}}"
media_play:
service: notify.mobile_app_timos_handy
data:
message: command_media
data:
media_command: play
media_pause:
service: notify.mobile_app_timos_handy
data:
message: command_media
data:
media_command: pause
media_stop:
service: notify.mobile_app_timos_handy
data:
message: command_media
data:
media_command: stop
media_previous_track:
service: notify.mobile_app_timos_handy
data:
message: command_media
data:
media_command: previous
media_next_track:
service: notify.mobile_app_timos_handy
data:
message: command_media
data:
media_command: next
attributes:
state: sensor.timos_handy_media_session
is_volume_muted: >
{{ "on" if states('sensor.timos_handy_volume_level_music') == 0 else "off" }}
volume_level: sensor.timos_handy_volume_level_music
# source: media_player.receiver|source
# source_list: media_player.receiver|source_list
- platform: media_player_template
media_players:
receiver:
unique_id: bluscream_phone2
friendly_name: "Bluscream's Phone 2"
device_class: receiver
# current_source_template: "{{ states('input_text.selected_source') }}"
value_template: >
{{ 'on' if is_state("sensor.timos_handy_media_session", "Playing") else 'off' }}
turn_on:
service: notify.mobile_app_timos_handy
data:
message: command_media
data:
media_command: play
turn_off:
service: notify.mobile_app_timos_handy
data:
message: command_media
data:
media_command: pause
volume_up:
service: notify.mobile_app_timos_handy
data:
message: command_media
data:
media_command: volume_up
volume_down:
service: notify.mobile_app_timos_handy
data:
message: command_media
data:
media_command: volume_down
# inputs:
# source 1:
# service: input_boolean.turn_on
# data_template:
# entity_id: input_boolean.source_1
# source 2:
# service: input_boolean.turn_on
# data_template:
# entity_id: input_boolean.source_2
set_volume:
service: notify.mobile_app_timos_handy
data:
message: "command_volume_level"
data:
media_stream: "music_stream"
command: "{{volume}}"
mute:
service: notify.mobile_app_timos_handy
data:
message: "command_volume_level"
data:
media_stream: "music_stream"
command: "{{0 if is_muted else 15}}"
current_is_muted_template: >
{{ "on" if states('sensor.timos_handy_volume_level_music') == 0 else "off" }}
# album_art_template: "{{ state_attr('sensor.timos_handy_media_session','title_com.bambuna.podcastaddict') }}"
title_template: "{{ state_attr('sensor.timos_handy_media_session','title_com.bambuna.podcastaddict') }}"
album_template: "{{ state_attr('sensor.timos_handy_media_session','album_com.bambuna.podcastaddict') }}"
artist_template: "{{ state_attr('sensor.timos_handy_media_session','artist_com.bambuna.podcastaddict:') }}"
Please leave some feedback and also tell me how i can do it without knowing the app package name