Input_text as input for input_select

I hear your cry…
Tbh, templating isn’t the best documented bit in HA, especially not what/which to use when, let alone how…Different types of entities, device_trackers, sensors, being template or not, and needing them to be in browser or server side.
these could have been done differently, I know, its just I had this working syntax at hand and copied it…

When in doubt I always go back to @andrey’s primer on this: home-assistant-custom-ui/docs/templates.md at master · andrey-git/home-assistant-custom-ui · GitHub, and, as a nice and valuable addition to that, use the ‘Tiles’ templating by @eddi89 : https://github.com/c727/home-assistant-tiles

trial, hit and error come hand in hand though, as shown in the input_text/select in my travel package…
cheers,
Marius

1 Like

i think this page explains that pretty good

but thats the serverside part. which was all we had untill the custom UI came along.
i didnt even know there were templating possibilities on client side. :wink:

i guess you would normally first use the server side possibilities. and then if you run out of options you get the clientside possibilities.

the difference is something like:

variabele = some_sensor_state * 2
print (variable)

or

print (some_sensor_state * 2)

in the first case you can reuse the variable in the second case not.
and the first case depends on the speed from the server and the second on the speed from the device showing it.

1 Like

shouldn’t have left that out, sorry

As far as I understand it, it is advisable to try to use client side templating as much as possible, since it relieves the processor.

exactly, and since mine is a Pi3, i am trying to be as lightweight as possible on it :wink:

did you ever look at the load on the RPI?
HA does nothing to it :wink:
with just HA i had not even a cpu usage from 8%

the more you use clientside, the longer it takes to load your pages.
i would go with the serverside, but thats a choice.

I didn’t even know there was such a thing as custom UI! :slight_smile:

Thanks @Mariusthvdb & @ReneTode!

1 Like

only Hassio on the Pi.

will have to rebuild a lot, and then some (in the packages…)

23

anyways,
thanks for thinking along!

1 Like

You should try to use server-side whenever possible.

Server-side templates are jinja2
Client-side is JavaScript.