tchi59
(tchi59)
1
hi,
i did a sensor (temperature sensor) that receive my weather station temperature from mqtt topic.
see below
sensor:
- platform: mqtt
unit_of_measurement: '°C'
name: "thermo"
state_topic: "rtl_433/AlectoV1-Temperature/40"
force_update: true
value_template: "{{ value_json.temperature_F }}"
unfortunatly, even if “unit_of_measurement” is in °C, the temperature is always display in fahrenheit.
i would like to convert it to celsius
do you know how to do so ?
thanks
Regards
petro
(Petro)
2
temperature always converts to your system units. So if you select imperial as your system units, all temperatures will be displayed in ºF.
The only way to avoid this automatic setting is to change the unit_of_measurement to something other than ºF or ºC. Also, do not set the device_class.
unit_of_measurement: 'Celcius'
tchi59
(tchi59)
3
I don’t understand because my homeassistant settings are set to “Celsius” and “Kilogram”
petro
(Petro)
4
Then your unit_of_measurement needs to be ºF so that the system knows the units are in ºF so it can convert it to ºC for you.
and add, device_class: temperature
tchi59
(tchi59)
5
Thx for your help
Seems not working
to be sure please see my configuration.yaml file
# Loads default set of integrations. Do not remove.
default_config:
mqtt:
broker: 192.168.1.22
username: umqtt
password: pass4UMQTT
discovery: true
influxdb:
host: a0d7b954-influxdb
port: 8086
database: homeassistant
username: homeassistant
password: homeassistant
max_retries: 3
default_measurement: state
# Text to speech
tts:
- platform: google_translate
homeassistant:
customize:
binary_sensor.zone1:
device_class: door
customize_domain:
light:
assumed_state: false
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
logger:
default: error
logs:
homeassistant.components.enocean: debug
homeassistant.components.mqtt: debug
api:
switch:
- platform: mqtt
name: "Example_Switch"
command_topic: "room/light"
payload_on: "on"
payload_off: "off"
- platform: mqtt
name: "Switch 1"
command_topic: "tele/sonoff10/LWT"
- platform: mqtt
name: "MQTT"
command_topic: "home/bedroom/switch1/set"
- platform: rpi_gpio
ports:
23: Sirene
light:
- platform: mqtt
name: "LMQTT"
command_topic: "hom/dd"
sensor:
- platform: mqtt
device_class: temperature
unit_of_measurement: '°C'
name: "thermo"
state_topic: "rtl_433/AlectoV1-Temperature/40"
force_update: true
value_template: "{{ value_json.temperature_F }}"
- platform: mqtt
unit_of_measurement: '°C'
name: "thermoLaCrosse"
unit_of_measurement: '°C'
state_topic: "rtl_433/LaCrosse-WS2310/226"
force_update: true
value_template: "{{ value_json.temperature_F }}"
binary_sensor:
- platform: mqtt
name: "en_porte1"
device_class: "window"
state_topic: "fhem/en_porte1/state"
payload_on: "open"
payload_off: "closed"
- platform: mqtt
name: "pir_chambre"
device_class: "motion"
state_topic: "fhem/pir_chambre/state"
payload_on: "on"
payload_off: "off"
- platform: mqtt
name: "pir_bureau"
device_class: "motion"
state_topic: "fhem/pir_bureau/state"
payload_on: "on"
payload_off: "off"
- platform: mqtt
name: "pir_salon"
device_class: "motion"
state_topic: "fhem/pir_salon/state"
payload_on: "on"
payload_off: "off"
- platform: mqtt
name: "pir_entree"
device_class: "motion"
state_topic: "fhem/pir_entree/state"
payload_on: "on"
payload_off: "off"
- platform: rpi_gpio
invert_logic: true
ports:
5: zone1
The mqtt message is sent in Fahrenheint
{“time”:“2022-06-29 16:03:10”,“model”:“AlectoV1-Temperature”,“id”:40,“channel”:1,“battery_ok”:1,“temperature_F”:84.38,“humidity”:20,“mic”:“CHECKSUM”}
I want it to be displayed in Celsius
Thanks again for your support
regards
petro
(Petro)
6
You have to put the units in ºF, not ºC. Are you reading what I’m telling you to do?
Change to ‘°F’
Change to ‘°F’
Change to ‘°F’
You should not have ºC anywhere in your configuration if the device is outputing ºF.
When you tell the system that a value is ºC, then the system thinks “Hey, I don’t need to convert this because it’s already in ºC”.
You’re telling the system not to convert it.
tchi59
(tchi59)
7
Apologies !!!
ok it is working and i do understand now
Thx
1 Like