ESPHome not accepting HA binary sensor?

I am trying to extend the functionality of my NSPanel with the feedback of a HA binary_sensor (on/off) but for some reason it won’t accept this. I added both under binary_sensor as well as under ‘sensor’ section. After uploading the panel becomes unresponsive…luckily I can still update the config though
Any idea what I am doing wrong?
Note that it is not the lambda as without that it also won’t properly startup

Please don’t post pictures of text. Post the correctly formatted text.

It should go under binary_sensor: as you want a binary sensor.

What error is esphome throwing up when you attempt to validate the config?

Does the config work without the on_value lambda?

Hi, it is listed under binary_sensor (I tried the others too … even if that made no sense). The nspanel screen just stops in its setup process. Without the lambda it starts but that does not serve my purpose.
Tests executed:

  • use without lambda: setup process finishes (see sample below)
  • use lambda of working setup (battery) with the binary_sensor: not working
  • use another HA binary_sensor: not working
    A careful, preliminary conclusion seems to be that ‘binary_sensor’ has issues with lambda.
# WORKS: Battery warning, output use in display (bottom)
  - platform: homeassistant
    id: battery_low
    entity_id: input_boolean.battery_low
    on_state:
      then:
        - lambda: |-
            int symbol=36;
            if (id(battery_low).state) {
            symbol=37;
            }
            id(disp1).send_command_printf("Home.battery.pic=%i", symbol);
            
# DOES NOT WORK:
#  - platform: homeassistant
#    id: motion_detected
#    entity_id: binary_sensor.tapo_camera_545d_motion
#    on_state:
#      then:
#        - lambda: |-
#            int symbol=38;
#            if (id(motion_detected).state) {
#              symbol=39;
#            }
#            id(disp1).send_command_printf("Home.motioncam.pic=%i", symbol); 

# ESP starts normally but cannot use
#  - platform: homeassistant
#    id: motion_detected
#    entity_id: binary_sensor.tapo_camera_545d_motion

Or that your lambda is invalid. Which was why I asked what happens if you don’t include it.

Lambdas are not included in the automatic configuration check while you are typing out the config. The only place you will see an error with a lambda is in the log while compiling.

So try to compile it and watch the log for errors.

OK… understand … the esphome log window shows nothing though. I will try to do some more tests to try and exclude issues with lambda then.