Espresense eps32 pin functions

Hi

I have a couple of eps32 with espresense installed.
In the espresense config set up, is it possible to add some extra functions.

I have added dht11 to one of them, and I get the humanity and temperature. But when I add a ads7830 and a photoresistor to pin 21 and 22, I can’t get any data, not in mqtt explorer or in HA.
What do I have to to more, to get some data?

Then
If I want to use the button function and add something to for example pin 13. How do I set up HA, so I can use the button to set ON / OFF to the pin.

Thanks for help!

I don’t think you can add any old sensor. I don’t see the ads7830 mentioned.

Theres a whole documentation section on the espresence website. It tells you righ at the top of the page, which sensors are supported and clearly your sensor isnt listed there so, perhaps thats why you arent seeing any data returned, ya?? Reading the documentation shouldnt be seen as optional and if you would have, you would have answered your own questions.

Yep, thats the page I pointed to :slight_smile:

OK, I misunderstood the documentation
I thought I could use the i2c anyhow.

Thank you!

The second question, my lack of knowledge in add/type something by my self.

How do I turn a pin to ON/OFF (high/low) with the built in button or switch function?

Have I got it right?

If I use the switch / button function, I need a psychical button to push so the electricity will get through or not (ON/OFF).

and
If I use the LED function, I get a state value, that I can change to ON/OFF via HA

but can I somehow change (toggle) the pull up/pull down value on the button/switch function so I get its value permanent via psychical button?
I can change the value ON OFF via MQTT

Please point me to where in the docs you are referring to?

That is my problem.
I cant find it in the documentation

From the espresense UI

From MQTT Explorer

Skärmbild från 2023-11-27 00-13-25

From HA

Skärmbild från 2023-11-27 00-13-58
Skärmbild från 2023-11-27 00-14-23

When I push my psychical button which I have connect to pin 12, the switch will change to switch = ON. When I release it, it turns back to switch = OFF.

If I publish via mqtt explorer I can change the state to switch = ON (without pushing psychical button)
and when I push my psychical button, it returns to switch = OFF

What I want to do:
switch = OFF
Push psychical button switch = ON. It will be ON until I push my button again, then it will turn back to switch = OFF

Parallel, I will have a input_boolean so when switch = ON my input_boolean turns on and start a automation. If I turn input_boolean off, I want my switch to change to switch = OFF without push the psychical button.

I suspect you should try the espresence forum.

Nor me.

Why do you think you need the input_boolean too? Why not start the automation when the switch turns on?

So the problem is its acting like a momentary button and you want it to act like a locking switch? It really helps if you know the lingo lol. I havnt personally tested the button or switch features in espresence since its relatively new but traditionally the difference between a button and a switch is a button is momentary and a switch is locking, so a switch will stay On after you let go and a button will turn off if its not being pressed. They have specified both button and switch so id assume this is how they already work. Is this not the case or are you mixing them up?

Yes, I’m not the best developer :slight_smile:

For the moment, I only have a push button and try out with.

So I did a input_boolean, so when it is on, it activate a script which send a mqtt message ON and when input_boolan turns off, another script to send mqtt message OFF.

I did this automation, probably not the most beautiful one, but it works.

Thanks for helping out!

alias: ESPresense Kontoret Knapp1
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.espresense_kontoret_switch
    to: "ON"
    id: Sensor knapp ON
    for:
      hours: 0
      minutes: 0
      seconds: 0
    enabled: true
  - platform: state
    entity_id:
      - sensor.espresense_kontoret_switch
    to: "OFF"
    id: Sensor knapp OFF
    for:
      hours: 0
      minutes: 0
      seconds: 0
    enabled: true
    from: "ON"
  - platform: state
    entity_id:
      - input_boolean.knapp_espresense_kontor
    to: "on"
    id: Toggle Knapp ON
    from: "off"
  - platform: state
    entity_id:
      - input_boolean.knapp_espresense_kontor
    to: "off"
    id: Toggle Knapp OFF
    from: "on"
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - Sensor knapp ON
            enabled: true
        sequence:
          - service: input_boolean.turn_on
            data: {}
            target:
              entity_id: input_boolean.knapp_espresense_kontor
            enabled: true
          - delay:
              hours: 0
              minutes: 0
              seconds: 1
              milliseconds: 0
          - service: script.1701031791862
            data: {}
      - conditions:
          - condition: trigger
            id:
              - Sensor knapp OFF
            enabled: true
        sequence:
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id: input_boolean.knapp_espresense_kontor
      - conditions:
          - condition: trigger
            id:
              - Toggle Knapp ON
        sequence:
          - service: script.1701031791862
            data: {}
      - conditions:
          - condition: trigger
            id:
              - Toggle Knapp OFF
        sequence:
          - service: script.espresense_kontoret_off
            data: {}
mode: single

Thats weird they have a switch and a button but they both work the same, ill have to play with one of mine and see whats going on. We all started at the beginning and didnt know anything but, the workaround you did to fix it tells me youll do just fine with this stuff. If it helps, you can make a latch switch from a momentary switch by making a simple circuit. Here is a guide

1 Like