substitutions:
ds18b20_1: GPIO12
ds18b20_2: '0x5600000DB4C24E28'
computer_power: GPIO4
computer_restart: GPIO5
status: GPIO13
# # Example configuration entry
# globals:
# - id: elevator_relay
# type: int
# restore_value: yes
# initial_value: '0'
# Example configuration entry
dallas:
- pin: $ds18b20_1
# Individual sensors
sensor:
- platform: dallas
address: $ds18b20_2
name: "Chassis_Temperature"
unit_of_measurement: °C
switch:
## 电源
- platform: gpio
name: "Computer_Power"
pin: $computer_power
id: relay1
internal: true
on_turn_on:
- delay: 0.2s
- switch.turn_off: relay1
## 重启
- platform: gpio
name: "Computer_Restart"
pin: $computer_restart
id: relay2
internal: true
on_turn_on:
- delay: 0.2s
- switch.turn_off: relay2
## 电脑
- platform: template
name: "7700K"
lambda: |-
if (id(relay3).state) {
return true;
} else {
return false;
}
turn_on_action:
- if:
condition:
binary_sensor.is_off: relay3
then:
- switch.turn_on: relay1
# - delay: 1s
# - lambda: |-
# id(elevator_relay) += 1;
turn_off_action:
# - switch.turn_on: relay1
- mqtt.publish:
topic: computer/shell_command/shutdown
payload: action
## 重启8266
# switch:
- platform: restart
name: "esp_restart"
internal: true
binary_sensor:
## 电脑开机状态
- platform: gpio
pin:
number: $status
mode: INPUT_PULLUP
inverted: True
name: "Status"
id: relay3
internal: true
|