I am trying to create a text_sensor (it’d be fine if it were input_number as well) that will be updated when my key_collector runs the on_result action.
So let’s say somebody enters 1234 and presses # (within the timeout time frame); then I’d like the output to be written to a sensor that I can work with in Home Assistant.
Currently, the code below will literally cause the sensor to be set to {{ states(pincode_reader)}}. I tried all sort of variants of this (for example, {{ states("pincode_reader")}}, {{ %s }}) or different !lambdas, the latter of which always fail.
/config/esphome/zz_testespvan.yaml: In lambda function:
/config/esphome/zz_testespvan.yaml:151:30: error: 'class esphome::key_collector::KeyCollector' has no member named 'state'
state: !lambda "return id(pincode_reader).state;"
^~~~~
While I find the Home Assistant documentation incredibly helpful, I can never wrap my head around the ESPHome docs.
I mean, I was aware that there was x.c_str(), but didn’t realize this was usable anywhere else. I’ll keep this in mind when there is another thing I don’t understand about ESPHome
You can use a nodemcu as well as generic ESP8266, wemos d1, or esp32.
I am currently not at home, so unfortunately I cannot look at my hardware setup, but I believe I was using an ESP32 in my approach.
You can simply adapt the yaml configuration from above by changing the used pins to those available on nodemcu.
Sorry, I am on mobile, so I don’t have all the links available to me atm… But you can search for which pins should work on nodemcu, it might even be on https://esphome.io on the nodemcu page.
You could also safe yourself a lot of annoyance (at least I thought so) by using Wiegand compatible hardware instead
My Keypad never worked correctly (might have been me messing up somewhere, might have been a hardware issue, as it came from my used parts drawer), so I bought one of those for under 20 bucks (if I remember correctly) and everything worked perfectly.