Je voudrais modifier les données renvoyé a Home assistant d’un capteur de température décalé
Bonjour,
J’ai créer un petit boitier permentant de consulter la qualité de l’air dans une pièce.
Pour cela, j’ai utilisé un capteur scd4x qui renvoi la température l’humidité et le co2. J’y ai égualement intégré trois bande led WS2812b qui changent de couleur en fonction de la température, de l’humidité et du co2 présent dans la pièce. Les données sont égualement transmisent à Home Assistant.
L’humidité et le co2 fonctionnent correctement, mais la température est faussé, le boitier renvoi 24°C alors qu’il fait en réalité 20°C dans la pièce. Je cherche donc à modifier le code YAML pour que la température renvoyé a HA soit la température reçu par le capteur scd4x moins 4°C afin d’obtenir la température réel de la pièce.
Voici le code YAML:
esphome:
name: air-quality-sensor-desk
friendly_name: Air_Quality_Sensor_Desk
esp8266:
board: d1_mini
framework:
version: 2.7.4
logger:
ota:
password: "******************************"
wifi:
ssid: *************
password: *************
manual_ip:
static_ip: 192.168.1.136
gateway: 192.168.1.1
subnet: 255.255.255.0
mqtt:
broker: 192.168.1.127
username: ******
password: *****
i2c:
sda: GPIO4
scl: GPIO5
scan: true
id: bus_a
sensor:
- platform: scd4x
i2c_id: bus_a
co2:
id: CO2
name: "CO2"
on_value_range:
- below: 1400
then:
- light.addressable_set:
id: Strip_CO2
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay : 100ms
- light.addressable_set:
id: Strip_CO2
range_from: 0
range_to: 1
red: 0%
green: 50%
blue: 0%
- above: 1400
below: 1600
then:
- light.addressable_set:
id: Strip_CO2
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay : 100ms
- light.addressable_set:
id: Strip_CO2
range_from: 0
range_to: 3
red: 25%
green: 50%
blue: 0%
- above: 1600
below: 1800
then:
- light.addressable_set:
id: Strip_CO2
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay : 100ms
- light.addressable_set:
id: Strip_CO2
range_from: 0
range_to: 4
red: 50%
green: 50%
blue: 0%
- above: 1800
below: 1900
then:
- light.addressable_set:
id: Strip_CO2
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay : 100ms
- light.addressable_set:
id: Strip_CO2
range_from: 0
range_to: 8
red: 50%
green: 25%
blue: 0%
- above: 1900
below: 2100
then:
- light.addressable_set:
id: Strip_CO2
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay : 100ms
- light.addressable_set:
id: Strip_CO2
range_from: 0
range_to: 9
red: 50%
green: 0%
blue: 0%
- above: 2100
then:
- light.addressable_set:
id: Strip_CO2
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay : 100ms
- light.addressable_set:
id: Strip_CO2
range_from: 0
range_to: 11
red: 50%
green: 0%
blue: 0%
temperature:
name: "Temperature"
id: Temp
on_value_range:
- below: 10
then:
- light.addressable_set:
id: Strip_Temp
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay: 100ms
- light.addressable_set:
id: Strip_Temp
range_from: 0
range_to: 1
red: 0%
green: 0%
blue: 50%
- above: 10
below: 17
then:
- light.addressable_set:
id: Strip_Temp
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay: 100ms
- light.addressable_set:
id: Strip_Temp
range_from: 0
range_to: 3
red: 0%
green: 50%
blue: 50%
- above: 17
below: 22
then:
- light.addressable_set:
id: Strip_Temp
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay: 100ms
- light.addressable_set:
id: Strip_Temp
range_from: 0
range_to: 4
red: 0%
green: 50%
blue: 0%
- above: 22
below: 27
then:
- light.addressable_set:
id: Strip_Temp
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay: 100ms
- light.addressable_set:
id: Strip_Temp
range_from: 0
range_to: 6
red: 50%
green: 50%
blue: 0%
- above: 27
then:
- light.addressable_set:
id: Strip_Temp
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay: 100ms
- light.addressable_set:
id: Strip_Temp
range_from: 0
range_to: 11
red: 50%
green: 0%
blue: 0%
humidity:
name: "Humidity"
id: Hum
# on_value:
# then:
# - light.addressable_set:
# id: Strip_Hum
# range_from: 0
# range_to: 2
# red: 0%
# green: 50%
# blue: 0%
on_value_range:
- below: 35
then:
- light.addressable_set:
id: Strip_Hum
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay : 100ms
- light.addressable_set:
id: Strip_Hum
range_from: 0
range_to: 1
red: 50%
green: 0%
blue: 0%
- above: 35
below: 45
then:
- light.addressable_set:
id: Strip_Hum
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay : 100ms
- light.addressable_set:
id: Strip_Hum
range_from: 0
range_to: 2
red: 50%
green: 50%
blue: 0%
- above: 45
below: 65
then:
- light.addressable_set:
id: Strip_Hum
range_from: 0
range_to: 4
red: 0%
green: 50%
blue: 0%
- above: 65
below: 75
then:
- light.addressable_set:
id: Strip_Hum
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay : 100ms
- light.addressable_set:
id: Strip_Hum
range_from: 0
range_to: 7
red: 50%
green: 50%
blue: 0%
- above: 75
then:
- light.addressable_set:
id: Strip_Hum
range_from: 0
range_to: 11
red: 0%
green: 0%
blue: 0%
- delay : 100ms
- light.addressable_set:
id: Strip_Hum
range_from: 0
range_to: 7
red: 50%
green: 0%
blue: 0%
update_interval: 1s
light:
- platform: fastled_clockless
chipset: WS2812b
id: Strip_Temp
pin: GPIO14
num_leds: 10
rgb_order: GRB
name: "Strip_Temp"
- platform: fastled_clockless
chipset: WS2812b
id: Strip_CO2
pin: GPIO13
num_leds: 10
rgb_order: GRB
name: "Strip_CO2"
- platform: fastled_clockless
chipset: WS2812b
id: Strip_Hum
pin: GPIO12
num_leds: 10
rgb_order: GRB
name: "Strip_Hum"