'Simple' task with fan speed is driving me nuts!

and as per this post

try this - it validates ok

display:
  - platform: lcd_pcf8574
    dimensions: 16x2
    address: 0x27
    lambda: |-
      if (id(weed_fan).state = OFF) {it.print(8, 1, "F: OFF");}
      else if (id(weed_fan).speed = '0') {it.print(8, 1, "F: LOW");}
      else if (id(weed_fan).speed = '1') {it.print(8, 1, "F: MED");}
      else {it.print(8, 1, "F: HIGH");}
      it.printf(0, 0, "T:%.1f", id(weed_temperature).state);
      it.printf(8, 0, "H:%.1f", id(weed_humidity).state);
      it.printf(0, 1, "U:%.1f", id(weed_uptime).state);

Me neither, but YAML is pedantic, you had the correct state in your post you just changed it in your code :man_facepalming: :crazy_face:

I changed that but it was still complaining, so I took your code and deleted out all the nested ifs (because its too easy to run into trouble with them) and ran with just one if/else.

It still complained so I got rid of your previous statements in the lambda and just ran with the one if so that I could get the validator to tell me where the error was, but that worked ok it didn’t complain about anything so I added the non if statements back in and that worked ok.

Then I googled “esphome nested if” and found that thread and added the nested ifs back in - let me know if it works for you.