Climate can not display 'units', and 'level_style' can not change the font size and color.!

climate can not display ‘units’, and ‘level_style’ can not change the font size and color.
climate.air_bedroom:
widget_type: climate
title: bedroom
entity: climate.air_bedroom
icon_up: mdi-chevron-up-circle-outline
icon_down: mdi-chevron-down-circle-outline
step: 1
units: “°C”
level_up_style: “color: $red”
level_down_style: “color: $green”
level2_style: “font-size: 150%; color: #920446
level_style: “font-size: 250%; color: #8f8f8f

20181129100532

please give your yaml always as codeblock or it is unreadable.

which version from appdaemon are you on?
is something in your logs?
what skin are you using?

appdaemon 3.0.2
no error in logs
when i used the default skin is the same.

appdaemon.yaml
log:
accessfile: /home/appdaemon/.appdaemon/logs/access.log
errorfile: /home/appdaemon/.appdaemon/logs/error.log
logfile: /home/appdaemon/.appdaemon/logs/appdaemon.log
log_generations: 3
log_size: 1000000
appdaemon:
disable_apps: 1
threads: 10
api_port: 5000
api_key: xxxxx
plugins:
HASS:
type: hass
ha_url: http://xxx.xxx.xxx.xxx:8123
ha_key: xxxxx
namespace: default
app_dir: /home/appdaemon/.appdaemon/apps
hadashboard:
dash_url: http://xxx.xxx.xxx.xxx:5050
dash_dir: /home/appdaemon/.appdaemon/conf/dashboards

20181130011825

There are a few errors in the climate widget.

In baseclimate.js

 function OnStateAvailable(self, state)
    {
        self.min = state.attributes.min_temp
        self.max = state.attributes.max_temp
        self.level = state.attributes.temperature
        if ("units" in self.parameters)
        {
            self.set_field(self, "unit", self.parameters.unit)
        }
        else
        {
            self.set_field(self, "unit", state.attributes["unit_of_measurement"])
        }
        set_view(self, state)
    }

the lines

  self.set_field(self, "unit", state.attributes["unit_of_measurement"])

and

   if ("units" in self.parameters)

doesn’t work since the climate entity does not have a unit_of_measurement attribute and the correct parameter to check for is “unit”, not “units”.

Changing this to

 function OnStateAvailable(self, state)
    {
        self.min = state.attributes.min_temp
        self.max = state.attributes.max_temp
        self.level = state.attributes.temperature
        set_view(self, state)
    }

And the widget should work fine, but now

unit: °C # or °F

must be specified in the widget.

Also, the docs mentions

units: 

as an optional argument and this should be

unit:

and should be mandatory

This you can fix by using

color: red!important; font-size: 40px!important;
1 Like

i did try to fix that in the last release, but somehow Andrew and i got mixed up.
i now did a PR to change every “unit” to “units” in the 4 files from the widget.
it should be repaired in the next release.

2 Likes

thanks, now it work fine.