Convert sensor data from C to F

I assumed based on this walkthrough you still need SSL. Not so?

https://home-assistant.io/ecosystem/nginx/

No, ha still listens on HTTP port 8123, nginx listens on 443 and forwards to ha

This works! Great job, you saved me a lot of hassle.

1 Like

@fcisler,
Can you provide more details of how you were able to make this work?

I followed all as you described, but still not getting updates.

Thanks

Which portion? You need to give me a little detail as to what your trying to do

For now, just get the tags to show up in HASS.

I think I have got it working with your previous instruction.

Testing now.

Thanks

Got it working.

Is there anyway to limit the number of digits displayed? (see below)

“freezer
2 minutes ago
1.82101669311524 °F
humidity
46.9544448852539”

Also I tried customizing the name and picture, but for some reason it doesn’t apply, no errors in log. (see below)

sensor.freezer:
entity_picture: /local/10.jpg
friendly_name: FREEZER

Something like this in the tagmanager

Rnd{{3},2) or Round({3},2)

Will round it to two digits

Sorry for my ignorance, but where does this go in your code?

{“state”: “<%{2}*9/5+32%>”, “attributes”: {“humidity”:"{3}",“unit_of_measurement”:“°F”}}

Rnd{{3},2) or Round({3},2)

Thanks

{“state”: “<%Round({2}*9/5+32,2)%>”, “attributes”: {“humidity”:"<%Round({3}, 2)%>",“unit_of_measurement”:“°F”}}

If Round isnt correct then it’s Rnd

Thanks, I test and let you know.

I’m getting the following error from the Wireless Tag Manager when I add the code you provided.

“Tag Manager cannot handle URL + verb + content longer than 148 characters”

Any idea how I can stop the following errors, I get separate error for each of my 5 tags?

2017-06-11 17:15:17 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.master_bedroom_temperature fails
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py”, line 222, in async_update_ha_state
yield from self.async_update()
File “/usr/lib/python3.4/asyncio/coroutines.py”, line 141, in coro
res = func(*args, **kw)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/template.py”, line 146, in async_update
self._state = self._template.async_render()
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/template.py”, line 99, in async_render
return self._compiled.render(kwargs).strip()
File “/usr/lib/python3/dist-packages/jinja2/environment.py”, line 969, in render
return self.environment.handle_exception(exc_info, True)
File “/usr/lib/python3/dist-packages/jinja2/environment.py”, line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File “/usr/lib/python3/dist-packages/jinja2/_compat.py”, line 36, in reraise
raise value.with_traceback(tb)
File “”, line 1, in
TypeError: can’t multiply sequence by non-int of type ‘float’

@fcisler
Any idea how I can get Motion Events from the Tag’s together with the Temp and Humity as below?

Call URL: http://HA_IP_ADDRESS:8123/api/states/sensor.{0}

HTTP Verb: {“state”: “<%{2}%>”, “attributes”: {“humidity”:"{3}",“unit_of_measurement”:“°F”}}

Maybe old news by now, but I was able to convert my Wireless Sensor Tag temps from Celsius to Fahrenheit by changing the “unit_system” in the configuration.yaml from “metric” to “imperial”.

If anyone is looking for a clean way to convert F to C using the weather forecast home widget you can use this:

{{ (state_attr('weather.forecast_home','temperature') - 32) * (5/9) }}

I wanted to show the outside temperature on the dashboard in F and C at the same time with should be a simple thing to do but it isn’t.

You can also stick this in your configuration.yaml and select it in an entity card and you’ll get a nice clean Celsius temp readout:

sensor:
  - platform: template
    sensors:
      temperature_in_celsius:
        friendly_name: "Temperature in Celsius"
        unit_of_measurement: "°C"
        value_template: >
          {% set temperature = state_attr('weather.forecast_home', 'temperature') %}
          {% if temperature is not none and temperature | regex_match('^\\d+\\.?\\d*$') %}
            {{ ((temperature | float - 32) * (5/9)) | round(2) }}
          {% else %}
            N/A
          {% endif %}