Can functions be used in a floor map?

I want to use functions in a floor map like this:

config:
  label: UG
  functions:
    thermometercolor: "=temp => temp < 19 ? 'blue' : temp > 27 ? 'red' : temp > 23
      ? 'orange' : temp > 21 ? 'yellow' : 'green'"

And then change icon colors of markers:

  - component: oh-plan-marker
    config:
      icon: f7:thermometer
      iconcolor: =fn.thermometercolor(#'MyThermostat_Temperature')
      item: MyThermostat
      name: Thermostat marker

But the icon shows up white. Am I doing wrong or is it simply not supported? I verified that #‘MyThermostat_Temperature’ returns a dimensionless number.

I don’t use the floor plan pages, but I’m fairly certain that the answer is “not supported”.

The functions configuration is only available in the oh-context component. You cannot add functions to the page configuration, and there’s no place in the overall page floor plan page to add an oh-context component.

It is a reasonable idea, however, to be able to add a context with functions and constants to an entire page. So, it might be worth putting in a feature request in the MainUI repository to see if this gets any traction from the UI devs.

Agree - it would make life so much easier if you use floor plans with repetitive configuration selections… Currently I have this for all my thermostats in my floor plans - very DRY work…

      icon: "= ( #'TCOG1Essen_Temperature'  < 18 ) ? 'f7:thermometer_snowflake' : (
        #'TCOG1Essen_Temperature' > 25 ) ? 'f7:thermometer_sun' :
        'f7:thermometer'"
      iconColor: "= ( #'TCOG1Essen_Temperature' < 19 ) ? 'blue' : (
        #'TCOG1Essen_Temperature' > 27 ) ? 'red' : ( #'TCOG1Essen_Temperature' >
        23 ) ? 'orange' : ( #'TCOG1Essen_Temperature' > 21 ) ? 'yellow' :
        'green'"

…for each single thermostat.