I’m trying to use a global variable as a flag in some routines within esphome.
Unfortunately when I try to expose them in the log, the whole chip crashes and reboots. Thankfully it’s up long enough to redownload a new build with the logger lines commented out. I’ve tried both type int and bool. They both cause crashes. It must be in the printf type, %d or %s. Not sure what a Boolean type should be?
globals:
- id: p5flag
type: int
initial_value: '0'
restore_value: yes
binary_sensor:
- platform: gpio
pin: GPIO4
id: esph_house_auger_sensor_from_mcu
name: "esph House Auger Sensor from MCU"
filters:
- invert
on_state:
then:
- logger.log:
format: "P5FLAG = %i"
args: [ 'id(p5flag)' ]
#
# Ive also tried this
#
globals:
- id: p5flag
type: bool
initial_value: 'true'
restore_value: yes
binary_sensor:
- platform: gpio
pin: GPIO4
id: esph_house_auger_sensor_from_mcu
name: "esph House Auger Sensor from MCU"
filters:
- invert
on_state:
then:
- logger.log:
format: "P5FLAG = %s"
args: [ 'id(p5flag)' ]
Any tips on the proper format for a bool global appreciated. Also how do you test it in a condition? Is lambda the only way?