I’ve created a code in esphome but now I ran into 2 issues.
- I can’t display global variable on the screen connected to my esp32.
- I can’t send data back to hassio via homeassistant sensor (it does not show up in hassio like my other sensors that are coming from this esp).
Code:
globals:
- id: bbq_desired_temp
type: int
initial_value: "0"
- id: probe1_desired_temp
type: int
initial_value: "0"
sensor:
- platform: max6675
id: maintemp
name: "BBQ Main"
cs_pin: GPIO5
accuracy_decimals: 0
device_class: "temperature"
state_class: "measurement"
unit_of_measurement: "°C"
update_interval: 30s
- platform: max6675
id: probe1
name: "Probe 1"
cs_pin: GPIO32
accuracy_decimals: 0
device_class: "temperature"
state_class: "measurement"
unit_of_measurement: "°C"
update_interval: 30s
- platform: homeassistant
id: hass_desired_probe1
name: "Desired Probe 1"
entity_id: sensor.desired_probe1
attribute: probe1_desired_temp
The code for my screen:
- id: page4
lambda: |-
if(true){
it.strftime(40, 0, id(font_14), "%I:%M%p", id(my_time).now());
}
it.print(5, 16, id(font_12), "Probe 1");
it.printf(10, 34, id(font_14), "%.1f C", id(probe1).state);
it.print(82, 16, id(font_12), "Desired");
it.printf(82, 34, id(font_14), "%.1f C", id(probe1_desired_temp));
it.line(5, 28, 64, 28);
it.line(80, 28, 105, 28);
Everything shows up but the id(probe1_desired_temp) part just duplicates the id(probe1).state for some reason.