Hello everyone. I need help, I’m trying my hand at HA. I created a simple code to control the PWM module. however, after uploading to Wemos Dmini, the display does not show me the current status in numerical form. I only get PWM:0.0%. what am I doing wrong. This is my code:
name: pid-mini
friendly_name: PID MINI
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "LPfvDZQ39grzmeVEPtp2tX0S144rNmTa6mjWN6NA/4s="
ota:
password: "2561d3fd6170948cba84ee811d6 b1bb1"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Pid-Mini Fallback Hotspot"
password: "atDIjPiDofhY"
captive_portal:
dallas:
- pin: D6
sensor:
- platform: dallas
address: 0x280008037073a910 # Zastąp to adresem swojego czujnika DS18B20
name: "DS18B20 Sensor"
id: ds18b20_sensor
- platform: wifi_signal
name: "WiFi Signal"
id: wifi_signal_strength
update_interval: 10s
- platform: uptime
name: "Uptime"
update_interval: 10s
- platform: template
name: "PWM Percentage"
id: pwm_percentage
update_interval: 10s
lambda: |-
auto pwm_value = id(pwm_percentage).state;
return (pwm_value / 255.0) * 100.0;
switch:
- platform: template
name: "Setpoint Updated"
id: setpoint_updated
turn_on_action:
- sensor.template.publish:
id: pwm_percentage
state: !lambda |-
auto setpoint = id(pwm_percentage).state;
return setpoint + 1;
turn_off_action:
- sensor.template.publish:
id: pwm_percentage
state: !lambda |-
auto setpoint = id(pwm_percentage).state;
return setpoint;
binary_sensor:
- platform: gpio
pin:
number: D5
mode:
input: True
inverted: False
name: "Increase Button"
on_press:
then:
- lambda: |-
id(console_fan_thermostat).target_temperature += 1;
id(console_fan_thermostat).publish_state();
- platform: gpio
pin:
number: D8
mode:
input: True
inverted: False
name: "Decrease Button"
on_press:
then:
- lambda: |-
id(console_fan_thermostat).target_temperature -= 1;
id(console_fan_thermostat).publish_state();
output:
- platform: esp8266_pwm
id: pwm_output
pin: D7
climate:
- platform: pid
name: "Console Fan Thermostat"
id: console_fan_thermostat
sensor: ds18b20_sensor
default_target_temperature: 30.0 °C
heat_output: pwm_output
control_parameters:
kp: 0.3
ki: 0.001
kd: 6
max_integral: 0.0
output_averaging_samples: 5
derivative_averaging_samples: 5
deadband_parameters:
threshold_high: 0.4 °C
threshold_low: -1.0 °C
kp_multiplier: 0.0
ki_multiplier: 0.0
kd_multiplier: 0.0
deadband_output_averaging_samples: 15
i2c:
sda: GPIO5
scl: GPIO4
scan: true
font:
- file: "arial.ttf"
id: font_10
size: 10
- file: "arial.ttf"
id: font_12
size: 12
- file: "arial.ttf"
id: font_14
size: 14
- file: "arial.ttf"
id: font_24
size: 24
display:
- platform: ssd1306_i2c
model: SH1106_128X64
address: 0x3c
id: my_display
pages:
- id: page1
lambda: |-
it.printf(30, 11, id(font_24), " %.1f°C", id(ds18b20_sensor).state);
it.printf(0, 0, id(font_10), "T: %.1f°C", id(console_fan_thermostat).target_temperature);
it.printf(0, 41, id(font_10), "S: %.1f°C", id(pwm_percentage).state);
it.printf(0, 51, id(font_10), "PWM: %.1f%%", id(pwm_percentage).state);
it.printf(75, 0, id(font_10), "WiFI: %.1f dBm", id(wifi_signal_strength).state);