add analog sensor to esptest2
This commit is contained in:
@@ -1,131 +0,0 @@
|
|||||||
esphome:
|
|
||||||
name: espfan
|
|
||||||
platform: ESP8266
|
|
||||||
board: d1_mini
|
|
||||||
|
|
||||||
# Enable logging
|
|
||||||
logger:
|
|
||||||
|
|
||||||
# Enable Home Assistant API
|
|
||||||
api:
|
|
||||||
password: "feelhome123"
|
|
||||||
|
|
||||||
ota:
|
|
||||||
password: "feelhome123"
|
|
||||||
|
|
||||||
wifi:
|
|
||||||
ssid: "lauIOT"
|
|
||||||
password: "superiot1"
|
|
||||||
domain: .home.cabestan.be
|
|
||||||
|
|
||||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
||||||
ap:
|
|
||||||
ssid: "EspFan Fallback Hotspot"
|
|
||||||
password: "jTlMOFiFOzog"
|
|
||||||
|
|
||||||
captive_portal:
|
|
||||||
|
|
||||||
web_server:
|
|
||||||
port: 80
|
|
||||||
|
|
||||||
|
|
||||||
time:
|
|
||||||
- platform: sntp
|
|
||||||
id: esptime
|
|
||||||
timezone: "Europe/Brussels"
|
|
||||||
on_time:
|
|
||||||
# Every 5 minutes
|
|
||||||
- seconds: /10
|
|
||||||
then:
|
|
||||||
- lambda: |-
|
|
||||||
ESP_LOGD("custom", "Test sensor is : %.1f [min: %.1f | max: %.1f] state: \n", id(tsensor).state, id(tmin).state, id(tmax).state );
|
|
||||||
|
|
||||||
if( id(tsensor).state < id(tmin).state ) {
|
|
||||||
auto call = id(my_fan).turn_off();
|
|
||||||
call.perform();
|
|
||||||
ESP_LOGD("custom", "Temp is low, so turn off");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto call = id(my_fan).turn_on();
|
|
||||||
call.perform();
|
|
||||||
|
|
||||||
id(my_fan).speed = ( id(tsensor).state - id(tmin).state ) / ( id(tmax).state - id(tmin).state ) *100 ;
|
|
||||||
|
|
||||||
ESP_LOGD("custom", "Threshold = %.1f % \n", ( id(tsensor).state - id(tmin).state ) / ( id(tmax).state - id(tmin).state ) *100 );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fan:
|
|
||||||
- platform: speed
|
|
||||||
output: output_fan
|
|
||||||
name: "Fan"
|
|
||||||
restore_mode: ALWAYS_ON
|
|
||||||
id: my_fan
|
|
||||||
|
|
||||||
dallas:
|
|
||||||
- pin: GPIO4
|
|
||||||
update_interval: 5s
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
number:
|
|
||||||
- platform: template
|
|
||||||
name: "Sensibilité"
|
|
||||||
optimistic: true
|
|
||||||
min_value: 0
|
|
||||||
max_value: 100
|
|
||||||
initial_value: 80
|
|
||||||
step: 1
|
|
||||||
id: sensivity
|
|
||||||
|
|
||||||
- platform: template
|
|
||||||
name: "T Max"
|
|
||||||
optimistic: true
|
|
||||||
min_value: 20
|
|
||||||
max_value: 60
|
|
||||||
initial_value: 35
|
|
||||||
step: 1
|
|
||||||
id: tmax
|
|
||||||
|
|
||||||
- platform: template
|
|
||||||
name: "T Min"
|
|
||||||
optimistic: true
|
|
||||||
min_value: 0
|
|
||||||
max_value: 20
|
|
||||||
initial_value: 20
|
|
||||||
step: 1
|
|
||||||
id: tmin
|
|
||||||
|
|
||||||
|
|
||||||
sensor:
|
|
||||||
- platform: dallas
|
|
||||||
address: 0x5f0000041a8f8628
|
|
||||||
name: "Battery Charger Temp"
|
|
||||||
id: tsensor
|
|
||||||
|
|
||||||
|
|
||||||
# sensor:
|
|
||||||
# - platform: pulse_counter
|
|
||||||
# pin:
|
|
||||||
# number: D2
|
|
||||||
# name: Fan Speed
|
|
||||||
# id: fan_rpm
|
|
||||||
# unit_of_measurement: 'RPM'
|
|
||||||
# filters:
|
|
||||||
# - multiply: 1
|
|
||||||
# update_interval: 3s
|
|
||||||
# count_mode:
|
|
||||||
# rising_edge: INCREMENT
|
|
||||||
# falling_edge: DISABLE
|
|
||||||
|
|
||||||
# Example output entry
|
|
||||||
output:
|
|
||||||
- platform: esp8266_pwm
|
|
||||||
id: output_fan
|
|
||||||
pin: D1
|
|
||||||
max_power: 100%
|
|
||||||
frequency: 25000 Hz
|
|
||||||
110
espgaz.yaml
110
espgaz.yaml
@@ -1,110 +0,0 @@
|
|||||||
esphome:
|
|
||||||
name: espgaz
|
|
||||||
platform: ESP32
|
|
||||||
board: esp-wrover-kit
|
|
||||||
|
|
||||||
on_boot:
|
|
||||||
priority: 200
|
|
||||||
then:
|
|
||||||
- light.turn_on:
|
|
||||||
id: cam_light
|
|
||||||
brightness: 65%
|
|
||||||
# - mqtt.publish:
|
|
||||||
# topic: espgaz/last_update
|
|
||||||
# payload: "Something happened!"
|
|
||||||
|
|
||||||
# deep_sleep:
|
|
||||||
# run_duration: 50sec
|
|
||||||
# sleep_duration: 550sec
|
|
||||||
|
|
||||||
logger:
|
|
||||||
|
|
||||||
api:
|
|
||||||
encryption:
|
|
||||||
key: !secret api_encryption_key
|
|
||||||
|
|
||||||
ota:
|
|
||||||
password: !secret ota_key
|
|
||||||
|
|
||||||
wifi:
|
|
||||||
ssid: "lauIOT"
|
|
||||||
password: "superiot1"
|
|
||||||
domain: .home.cabestan.be
|
|
||||||
|
|
||||||
ap:
|
|
||||||
ssid: "Espgaz Fallback Hotspot"
|
|
||||||
password: !secret ap_secret
|
|
||||||
|
|
||||||
captive_portal:
|
|
||||||
|
|
||||||
web_server:
|
|
||||||
port: 80
|
|
||||||
|
|
||||||
time:
|
|
||||||
- platform: sntp
|
|
||||||
id: esptime
|
|
||||||
timezone: "Europe/Brussels"
|
|
||||||
on_time:
|
|
||||||
- seconds: /30
|
|
||||||
then:
|
|
||||||
- light.turn_on:
|
|
||||||
id: cam_light
|
|
||||||
brightness: 65%
|
|
||||||
- delay: 1s
|
|
||||||
- mqtt.publish:
|
|
||||||
topic: espgaz/last_update
|
|
||||||
payload: !lambda |-
|
|
||||||
char out[32];
|
|
||||||
sprintf(out,"%f",id(my_uptime).state);
|
|
||||||
return out;
|
|
||||||
- delay: 5s
|
|
||||||
- light.turn_off:
|
|
||||||
id: cam_light
|
|
||||||
|
|
||||||
mqtt:
|
|
||||||
broker: 192.168.30.10
|
|
||||||
username: espgaz
|
|
||||||
password: "65eg64e8r7g98"
|
|
||||||
id: esp_mqtt
|
|
||||||
|
|
||||||
sensor:
|
|
||||||
- platform: uptime
|
|
||||||
name: Uptime Sensor
|
|
||||||
id: my_uptime
|
|
||||||
|
|
||||||
esp32_camera:
|
|
||||||
name: cam_gas_counter
|
|
||||||
ae_level: 1
|
|
||||||
external_clock:
|
|
||||||
pin: GPIO0
|
|
||||||
frequency: 20MHz
|
|
||||||
i2c_pins:
|
|
||||||
sda: GPIO26
|
|
||||||
scl: GPIO27
|
|
||||||
data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
|
|
||||||
vsync_pin: GPIO25
|
|
||||||
href_pin: GPIO23
|
|
||||||
pixel_clock_pin: GPIO22
|
|
||||||
power_down_pin: GPIO32
|
|
||||||
jpeg_quality: 10
|
|
||||||
special_effect: grayscale
|
|
||||||
max_framerate: 2fps
|
|
||||||
resolution: 1600x1200
|
|
||||||
idle_framerate: 0.1fps
|
|
||||||
|
|
||||||
esp32_camera_web_server:
|
|
||||||
- port: 8080
|
|
||||||
mode: snapshot
|
|
||||||
|
|
||||||
output:
|
|
||||||
- platform: ledc
|
|
||||||
pin: GPIO4
|
|
||||||
id: gpio_4
|
|
||||||
channel: 2
|
|
||||||
|
|
||||||
## GPIO_4 is the flash light pin
|
|
||||||
light:
|
|
||||||
- platform: monochromatic
|
|
||||||
output: gpio_4
|
|
||||||
name: PWM light
|
|
||||||
id: cam_light
|
|
||||||
Reference in New Issue
Block a user