Thank you for posting, will be copying a lot of this to make a tablet display
Does that entity properly show the current title of the content playing?
Hi all,
Hereās another addition Iāve recently added that makes designing remote controls much easier by associating the button press with a specific remote command. No need for automations.
In the button_tapped function of each custom_ui file, add:
if (ev.model.entity.remote_service){
var remote_device = ev.model.entity.remote_service.device;
var remote_command = ev.model.entity.remote_service.command;
var remote_entity_id = ev.model.entity.remote_service.entity_id;
this.hass.callService("remote", "send_command", { "device":remote_device, "command":remote_command, "entity_id": remote_entity_id});
return
}
These few lines add the ability to associate a service of a remote entity directly with a press of the tile. Just add a section under an entityās config with remote_service. Tabbed into the remote service should be (1) device, (2) command, and (3) entity_id. The entity id here is the id of the remote that youād like to trigger when the button is pressed. All three of these are required.
As an example:
input_text.dummy_media_controls:
custom_ui_state_card: state-card-tiles
config:
columns: 1
row_height: 54px
gap: 8px
entities:
- entity: light.null
label: Living Room Television
column: 1
column_span: 1
row: 1
row_span: 1
icon: mdi:power
icon_size: 18px
remote_service:
device: '123456789'
command: 'PowerToggle'
entity_id: 'remote.harmony_hub'
I hope that makes sense. It has been working great for me.
@eddi89 - whatās your preferred means for feature requests/feature additions? PRs on github? Posts on this forum?
Anyone know how to do this with Custom UI Tiles? Basically Iām trying to have the entity picture of a media player on the left and text details of what the media player is playing on the right.
Iād also like to use Tiles to show my cameras (so I can fit more on the screen than HA allows at one time). Any thoughts on how to do that as well?
Thanks in advance
I have 6 favourite radiochannels and the TV as sound sources for my sonos.
When i play the diffrent channels i get some diffrent results in the state in my media_player.sonos_living_room
Its the state āmedia_titleā i use for sensor.sonos_titel.
I would love to be able to detect when the state is āmixmegapol_instream_se_aacp?ā, āRIX FMā, āNRJā, āRockklassikerā, āVinyl FMā or āā (null)
And instead set the sensor.sonos_titel to ānot availibleā.
But if the state is anything else, that should be set. (like āSpending My Timeā or āBohemian Rhapsodyā in the case from down below)
Diffrent state on diffrent radio channel
Mix Megapol
media_title: mixmegapol_instream_se_aacp?
media_title: Spending My Time
Rix FM
media_title: RIX FM
Bandit Rock
media_title: Bohemian Rhapsody
NRJ
media_title: NRJ
Rockklassiker
media_title: Rockklassiker
Vinyl
media_title: Vinyl FM
TV
media_title:
would one be able to use an input_select also? Looking for ways to have Tiles use several of them hereā¦
Yes, certainly possible. That said, Iād recommend going the more_info route for selecting the option. Else, a UI for selecting an option would have to be designed. Perhaps not, but Iād go with more_info dialogs. Thatās what Iāve done for our HVAC, for example.
eddi89 doesnāt post on here anymore unfortunately (https://github.com/c727/home-assistant-tiles/issues/14), but he is very responsive on this projectās GitHub page: https://github.com/c727/home-assistant-tiles
It certainly is worth doing some PRs because I really like the additions youāve made to the UI code.
He and I are in touch. In fact, heās already added the remote feature I wrote about less than 12 hours ago!
I think Iād first try accessing the attribute directly from the tile in lieu of adding a sensor.
But that is not the problem, i can show the ārawā value from the attribute.
But what i want to do is āfilter outā sertain values that from some radio channels is irelevant, and replace them with a generic value.
Since some radio channel reports a strange string (mixmegapol_instream_se_aacp?) instead of the song title on the āsong titleā attribute.
must have missed that, is in in your code posted here? or maybe you can share?
not posted here - still working out a number of kinks.
That said, itās similar to other nest control input_select projects youāll find on the forum. Still not quite happy with it, but when I am, Iāll post it!
Iām not sure I completely understand the issue, but it sounds like a label_template is what youāre looking for. Perhaps looking for an underscore and branch to a different attribute or string then? Perhaps something like:
label_template: ' if (attributes.song_title.contains("_")) { return DO SOMETHING} else {return state}'
ok thanks, please do
Thank you very much for sharing! i used a lot of your code in my own set-up and it is looking amazing.
Thank you very much for sharing. Very nice and useful.
Chrome shows this warning the console:
Deprecation] Styling master document from stylesheets defined in HTML Imports is deprecated, and is planned to be removed in M65, around March 2018. Please refer to https://goo.gl/EGXzpw for possible migration paths.
And I think it refers to this plugin. Or maybe to the panel functionality that one can use with this plugin.
@andrewjfreyer: Are you aware of that problem and is it something that can be fixed on your side? This will soon stop working.
EDIT: Or actually @eddi89 I guess. I confused the author. Sorry.
Has anyone successfully used math in their label templating? Iām trying to show temperature sensors and round them to just the whole number (ie. ā69ā instead of ā69.3ā). Iāve tried a few different ways without any luck.
entities:
- entity: sensor.home_temperature
label: {{ states.sensor.home_temperature.state | round }}
label_sec: Home
For anyone else searching - I couldnāt find a way to do this through Jinja templating, but it works with javascript (which I missed in the tiles readme):
label_template: "return Math.round(state) + 'ĀŗF'"