Pin is used in multiple places

I’m having a similar issue but with a component…

binary_sensor:
  - platform: tt21100
    name: "Home"
    index: 0

touchscreen:
  - platform: tt21100
    address: 0x24
    interrupt_pin: GPIO3

which still follows the documentation for the tt21100 touch screen.

Also, there are some reports about this available on the ESPHome Github repository - So I think, it should be fixed soon.

The changelog points to the answer.

The error can be bypassed by specifically adding another config item to all of the duplicate pin definitions. See the Pin Schema for details.

2 Likes

There is an issue open on GitHub for similar problems under ESPHome 2023.12.0. #5246 is a good example, there are a couple there that have next to no info for the same issue:

I had the same issue with my water meter: “multiple use of a pin.”
change the pin schema as below and it works (allow_other_uses: true)

sensor:
  - platform: pulse_counter
    pin:
      number: GPIO27
      allow_other_uses: true
    update_interval : 6s
    name: "water pulse"
    id: water_pulse

  - platform: pulse_meter
    pin:
      number: GPIO27
      allow_other_uses: true
    name: "Water Pulse Meter"
    unit_of_measurement: "liter/min"
    icon: "mdi:water"
    total:
      name: "Water Total"
      unit_of_measurement: "liter"
9 Likes

Apologies for the maybe stupid question here, but how would I apply this to the following where there are 3 sensors on the same 2 pins for I2C?


i2c:
  - id: bus_a
    sda: GPIO4
    scl: GPIO5
    scan: true
  - id: bus_b
    sda: GPIO4
    scl: GPIO5
    scan: true
  - id: bus_c
    sda: GPIO4
    scl: GPIO5
    scan: true
    frequency: 200kHz

Same issue but I also had this with my ultrasonic distance sensor. I found this post on it that said to use template sensors to get the values:

Is allow_other_uses the “better” option than template sensors?

1 Like

The answer is given above.

And please post your code properly.

1 Like

The documented option is allow_other_uses

Can’t people read the release notes?

3 Likes

Nick’s message should be marked as the solution, as it was the first to give the correct answer.

Yeah and yet it seems i need to repeat it ad infinitum.

1 Like

Not trying to sound confrontational or ungreatful here but might that say something about the ease of finding the solution to those of us who aren’t regularly coding this (or any other) stuff, and even being able to apply it when we do?

“It was on display in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign on the door saying 'Beware of the Leopard” :wink:

Before asking I did Google on things I thought might be relevant, I did try to search the HA forum, I did try to see if there was anything the the ESPHome editor pointed out that I could understand and I did look for the changelog.

Even when you (kindly) pointed me at the changelog, it wasn’t what I expected (the layout) and even reading the reference to ‘pin scheema’, I can’t make it work?

Now to be clear here, I’m not expecting anyone to help me and if they do, to what level, just that I thought that HA / ESPHome were supposed to be making this easier for those of us for whom coding might be a mystic art but still don’t mind giving it a go? (and they are of course, for a given understanding of the word ‘easier’). :wink:

Cheers.

1 Like

I am not a coder but the change was really clear in the changelog. And the solution was written. What more do people need

1 Like

In my case, something that actually works for them I guess? ;-(

I’ve just been running the issue round ChatGPT and that can’t help either so I’ll either have to wait to see if:

It gets overcome in a later ESPHome update,

I find a solution that worked for someone that fits my particular situation,

A good coder friend of mine can give me a few mins of his time and give it a look over for me,

Someone here looks at my existing code and spots the potential ‘gotcha’ and why the ‘fix’ doesn’t work for me.

I don’t actually ever want to toggle the backlight off and on so I might have a poke about and see if I can remove that bit of code and so the potential clash of pin numbers?

And I did and that seems to have side-stepped working round the issue for now. :wink:

Not to be confrontational either, but this just required reading and it was reasonable to assume that someone that can build ESPHome devices at least understand the config options and logs, so giving a pointer should be enough. This really wasn’t a hard change.

I saw this question asked three times over the span of hours on the forum (all of which Nick answered, I think) and in all cases it simply was a matter of looking at the logs and changelogs. This also mean that people didn’t even search the forum.

Even if someone doesn’t understand the correct answer given to them, it’s their prerogative to ask for clarification and to quantify their skill level upfront. Not understanding and answer doesn’t make the answer any less valid. Credit where credit is due.

Sela (I rest my case).

2 Likes

Not to be confrontational either…

See how condescending that statement has become!

And all it would have taken is one simple answer, and yet, just take a look at all the back and forth because the people that Did know the answer couldn’t be bothered typing in three lines of code for those that don’t code on a daily basis.

I Was under the impression that the forum was designed to help others, and not berate them for not understanding the formatting of the code to the point that they eventually go to ChatGPT to get an answer, that most likely would have abbreviated this post to 5 comments instead of the mass of back and forth bull

2 Likes

The I2C bus supports multiple devices, so you only have to define one bus. When you want to use different I2C busses then you need more I2C definitions, but then you also need to use different pin’s for the different busses. If you only use one bus, you can change the i2c part in your yaml to

i2c:
  sda: GPIO4
  scl: GPIO5
  scan: true
  frequency: 200kHz

You don’t even need the id tag when using one bus. (Don’t forget to remove the id tag in your sensor definition part as well).

2 Likes

Thank you, Most appreciated, I ended up just using the suggestion by ChatGPT:


i2c:
  - id: bus_a
    sda: 
      number: GPIO4
      allow_other_uses: true
    scl: 
      number: GPIO5
      allow_other_uses: true
    scan: true
  - id: bus_b
    sda: 
      number: GPIO4
      allow_other_uses: true
    scl: 
      number: GPIO5
      allow_other_uses: true
    scan: true
  - id: bus_c
    sda: 
      number: GPIO4
      allow_other_uses: true
    scl: 
      number: GPIO5
      allow_other_uses: true
    scan: true
    frequency: 200kHz

Which seems to have cleared the errors I was getting. I think the confusion set in because of the “bus” provisioning made to separate the 3 modules on the same pins. The above mentioned “fix” that Oldacres posted did however help out with the status led which is used more than once.

Thank you again for the clarification :slight_smile:

2 Likes

And we know what assumption can make of all of us. :wink:

Ok, I have been an electronics / computer / network tech most of my life (50+ years) but I have never ever really got into coding.

A good friend has been into coding most his life but has never really been involved in electronics.

We had an agreement where I would help him better understand / use electronics and he would help me with (not ‘learn’ particularly) code.

I put together a passive cooled slimline PC, installed Debian on it, installed HA on it, added a Zigbeee coordinator on it, added a few Zigbee devices he could use and put it all in the post to him for free.

I did it to give him an easy starter to getting HA online and so that he could therefore be in a position to help me / us better.

Also, if I fancy a HA based solution I first look to see if there is anything out there already easily available (be it commercial or open-source stuff) and if not, see if anyone has done a project on it that is both easy to follow and has sufficient number of people who have tried it and found it to work.

So, as a long term ‘electronics guy’ I am generally easily able to do that side ok.

I can also generally flash whatever it is with firmware available.

I might be able to tweak the code slightly (changing GPIO pin numbers or device names etc) to make it more suited to my needs but the comparison / assumption of what sounds like it should be logically equal between hardware and software aren’t necessarily valid for everyone.

I am 65+ and was ‘programming’ BASIC (for fun) on DecWriter over an acoustic coupler connected to a PDP11 when I was 15 at college and would be the one the PC Lecturer came to get when any of the hardware didn’t work.

I have dabbled with coding many many times over my IT life and it’s very obvious that it’s not ‘my thing’.

However, I love HA and it gives me the near perfect mix of computers, networking, function, flexibility and opportunity to ‘get my hands dirty’ with electronics hardware, the only real fly_in_the_ointment is my lack of coding ‘insight’. ;-(

Luckily there are people out there willing to reach out, set me straight and send me on my way happy. :wink:

3 Likes

A simple answer was given. In fact, it was the best answer, because if you follow that advice you can help yourself next time. It is a fact that many users don’t read logs or changelogs — and this thread once again proved that. There’s nothing berating about that. The problem was already solved by the third post.