ESP Home key collector

He had something that worked for the most part, but not quite. Identifying the problem is how you learn to fix it. I It seems you don’t understand how his solution worked, and now you are trying to have him replace it by something he does not understand. But hey. I was just trying to help. I’ll but out now and leave you both to it.

Yes, that’s me! I’m bullying him into making him use something he doesn’t understand when he had a full understanding of what he was doing initially. I don’t understand how his solution worked? What solution? If you can’t follow along and keep up with the conversation, best just be quiet.

did you make any progress?

Where he had an automation in Home assistant, triggering on the change of the text sensor or the tag. Which you don’t seem to get.

that’s exactly how I did it… an automation in HA, triggering the change of the text senosr or the tag…

I want to trigger the trigger in HA not write the code via esphome…does it work?

thank you all :wink:

where is it? what’s the problem with the automation? whether that’s the case or not, you can’t know that unless you sit here and make a bunch of assumptions.

I have no experience with the above. My guess is this would do the trick, clearing the text when typing or on a timeout:

key_collector:
  - id: pincode_reader
    source_id: mykeypad
    min_length: 4
    max_length: 8
    end_keys: "#"
    end_key_required: True
    back_keys: "*"
    clear_keys: "C"
    allowed_keys: "0123456789"
    timeout: 4s
    on_progress:
      - logger.log:
          format: "input progress: '%s', started by '%c'"
          args: [ 'x.c_str()', "(start == 0 ? '~' : start)" ]      
       - text_sensor.template.publish:
          id: text_sensor_pincode
          state: ""
    on_result:
       - text_sensor.template.publish:
          id: text_sensor_pincode
          state: !lambda 'return x.c_str();'   
    on_timeout:
      - logger.log:
          format: "input timeout: '%s', started by '%c'"
          args: [ 'x.c_str()', "(start == 0 ? '~' : start)" ]
       - text_sensor.template.publish:
          id: text_sensor_pincode
          state: ""

Ps. maybe clearing the text in on_timeout is enough, I was not sure if the timeout would also occur when a result is completed. As above, any uncompleted input would also clear any previous entry first. Also, in the automation, ignore the trigger when the text is empty.

ill let “NO EXPERIENCE” Edwin_D take over and he can help you since he is desperate.

desperate :slight_smile: it works!!! thank you!!

Glad to be of help, and @Fallingaway24 - I was not trying to be disrespectful to you or your help, I just figurerd there might be an easier way.

1 Like