Documentation update. Two temperature measurement from one device (DS18B20).

This commit is contained in:
2026-09-20 22:01:11 +03:00
parent d33b5cc3fe
commit cc276b35e0
4 changed files with 63 additions and 26 deletions
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -144,10 +144,13 @@ one_wire:
id: one_wire_gpio_1 id: one_wire_gpio_1
pin: GPIO23 pin: GPIO23
# Sensor usage
sensor: sensor:
# DS18B20 1st sensor
- platform: dallas_temp - platform: dallas_temp
name: Temperature name: Temperature
id: sensor_dallas_temp_1 id: sensor_dallas_temp_1
index: 0
one_wire_id: one_wire_gpio_1 one_wire_id: one_wire_gpio_1
update_interval: 10s update_interval: 10s
resolution: 12 resolution: 12
@@ -156,38 +159,71 @@ sensor:
internal: true internal: true
on_value: on_value:
then: then:
# Topic 1: Raw temperature value
- mqtt.publish: - mqtt.publish:
topic: !lambda |- topic: !lambda return id(custom_prefix) + "/sensor/barrel/1/temperature/state";
return id(custom_prefix) + "/barrel_1/sensor/temperature/state"; payload: !lambda return String(x).c_str();
payload: !lambda 'return String(x).c_str();'
# Topic 2: Temperature + 5 degrees
- mqtt.publish:
topic: !lambda |-
return id(custom_prefix) + "/barrel_2/sensor/temperature/state";
payload: !lambda 'return String(x + 1.0).c_str();'
# Topic 3: Temperature - 5 degrees
- mqtt.publish:
topic: !lambda |-
return id(custom_prefix) + "/barrel_3/sensor/temperature/state";
payload: !lambda 'return String(x + 2.0).c_str();'
# Topic 4: Custom offset (+2.5 degrees)
- mqtt.publish:
topic: !lambda |-
return id(custom_prefix) + "/barrel_4/sensor/temperature/state";
payload: !lambda 'return String(x + 3.0).c_str();'
- script.execute: - script.execute:
id: set_led_state id: set_led_state
state_name: "MQTT_SUCCESS" state_name: MQTT_SUCCESS
# DS18B20 2nd sensor
- platform: dallas_temp
name: Temperature
id: sensor_dallas_temp_2
index: 1
one_wire_id: one_wire_gpio_1
update_interval: 10s
resolution: 12
unit_of_measurement: °C
accuracy_decimals: 1
internal: true
on_value:
then:
- mqtt.publish:
topic: !lambda return id(custom_prefix) + "/sensor/barrel/2/temperature/state";
payload: !lambda return String(x + 1.0).c_str();
- script.execute:
id: set_led_state
state_name: MQTT_SUCCESS
# Factory Reset — hold BOOT button 10 seconds # DHT22
- platform: dht
id: sensor_dht_1
pin: GPIO22
humidity:
name: Room Humidity
id: sensor_dht_1_humidity
internal: true
on_value:
then:
- mqtt.publish:
topic: !lambda |-
return id(custom_prefix) + "/sensor/room/1/humidity/state";
payload: !lambda 'return String(x).c_str();'
- script.execute:
id: set_led_state
state_name: MQTT_SUCCESS
temperature:
name: Room Temperature
id: sensor_dht_1_temperature
internal: true
on_value:
then:
- mqtt.publish:
topic: !lambda |-
return id(custom_prefix) + "/sensor/room/1/temperature/state";
payload: !lambda 'return String(x).c_str();'
- script.execute:
id: set_led_state
state_name: MQTT_SUCCESS
update_interval: 15s
# Factory Reset — hold BOOT button 10 seconds
binary_sensor: binary_sensor:
- platform: gpio - platform: gpio
name: GPIO Binary Sensor name: GPIO Binary Sensor
id: boot_button id: boot_button
internal: true
pin: pin:
number: GPIO0 number: GPIO0
mode: mode:
@@ -204,10 +240,11 @@ button:
- platform: factory_reset - platform: factory_reset
name: Factory Reset name: Factory Reset
id: button_factory_reset id: button_factory_reset
internal: true
text_sensor: text_sensor:
- platform: wifi_info - platform: wifi_info
ip_address: ip_address:
name: "Device IP Address" name: "Device IP Address"
mac_address: mac_address:
name: "Device Unique MAC Address" name: "Device Unique MAC Address"