esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 35 forks source link

How to use multiple RC522_SPI I've duplicate key #6093

Closed Orguerra closed 2 months ago

Orguerra commented 2 months ago

The problem

Hello,

I'm trying to use several RC522_SPI with a single ESP but I can't find the right configuration, I get duplicate keys, no support on github or in the doc unfortunately, can someone help me ?

I tried several ways but I can't work with my mqtt topic and I need it to be in this form

Thank's

Which version of ESPHome has the issue?

2024.7.2

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2024.7.3

What platform are you using?

ESP8266

Board

espressif

Component causing the issue

No response

Example YAML snippet

mqtt:
  broker: !secret mqtt_broker_ip
  port: 1883
  username: !secret mqtt_user
  password: !secret mqtt_password
  discovery: true
  discovery_prefix: homeassistant

# Définir le bus SPI
spi:
  clk_pin: GPIO18
  mosi_pin: GPIO23
  miso_pin: GPIO19
  id: rfid_bus

# Configurer le premier lecteur RFID
rc522_spi:
  id: rfid_reader_1
  cs_pin: GPIO21
  reset_pin: GPIO22
  spi_id: rfid_bus
  on_tag:
    then:
      - homeassistant.tag_scanned: !lambda 'return x;'
      - mqtt.publish:
          topic: "esp32/rfid/reader_1"
          payload: !lambda |-
            return "{\"reader_id\": \"reader_1\", \"position\": \"SALLE DE CINEMA\", \"uuid\": \"" + x + "\"}";

rc522_spi:
  id: rfid_reader_2
  cs_pin: GPIO05
  reset_pin: GPIO22
  spi_id: rfid_bus
  on_tag:
    then:
      - homeassistant.tag_scanned: !lambda 'return x;'
      - mqtt.publish:
          topic: "esp32/rfid/reader_1"
          payload: !lambda |-
            return "{\"reader_id\": \"reader_2\", \"position\": \"SALLE DE JEU\", \"uuid\": \"" + x + "\"}";

Anything in the logs that might be useful for us?

Duplicate key "rc522_spi"
  in "/config/esphome/rfidsensor.yaml", line 65, column 1
NOTE: Previous declaration here:
  in "/config/esphome/rfidsensor.yaml", line 52, column 1

Additional information

No response

ssieb commented 2 months ago

This is not the place for support requests and you did come ask on discord now, so that's good.