Home Assistant Voice PE + M5STACK RFID2 using Grove

Hello community,
I’m a long time reader of these forums, but this is my first post here.

I got Home Assistant Voice PE and I love it!
I would love to add NFC tag scan capability to it, for music playback initiation in Music Assistant.
For this purpose I did buy M5STACK RFID2 that has Grove connector.

I did try to add it using manual from here:

In script I did change sensor name for MFRC522_I2C , unfortunately that didn’t work since there must be some libraries missing to compile it :frowning:
I would appreciate any help!

Thank You in advance!

use the example from here

Now that I have this RFID stick, I’ll give it a go and set it up.

In the meantime, have you had a chance to try this out?

Thank You!

I did find there my device config example:

Unfortunately I can’t get pass this error when compiling:

Failed config

rc522_i2c: [source /config/esphome/home-assistant-voice-090ee2.yaml:12]
  
  Too many candidates found for 'i2c_id' type 'i2c::I2CBus' Some are 'internal_i2c', 'grove_i2c'.
  - address: 0x28
    on_tag: 
      - then: 
          - homeassistant.tag_scanned: 
              tag: !lambda |-
                return x;
    update_interval: 1s

My configuration:

substitutions:
  name: home-assistant-voice-090ee2
  friendly_name: Voice
packages:
  Nabu Casa.Home Assistant Voice PE: github://esphome/home-assistant-voice-pe/home-assistant-voice.yaml

i2c:
  - id: grove_i2c
    sda: GPIO1
    scl: GPIO2

rc522_i2c:
  address: 0x28
  on_tag:
    then:
      - homeassistant.tag_scanned: !lambda 'return x;'

# Link the RFID reader to binary sensor
binary_sensor:
  - platform: rc522
    uid: 83-08-60-1A
    name: "NFC Card 1"

esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}
api:
  encryption:
    key: redacted


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

Any help would be appreciated,
Thank You!

Update:
I did try adding i2c_id to the code with both suggested options (one at a time):

rc522_i2c:
  i2c_id: grove_i2c
rc522_i2c:
  i2c_id: internal_i2c

It compiles like this without an error, but it doesn’t work, it fails to connect to added sensor.
Error in logs:

[W][rc522:387]: Communication with the MFRC522 might be down, reset in...

internal_i2c uses different pins (5 and 6), so this is unlikely to work.

Try asking in the esphome section why you’re getting the error Too many candidates found for 'i2c_id' type 'i2c::I2CBus' Some are 'internal_i2c', 'grove_i2c'.

And perhaps someone can suggest how to properly adapt the code from the example.

I think the issue was with the power supply. According to the instructions, you need to connect the package (step 2), which activates the switch, and the bus is already specified. All you have to do is program the sensor using the grove_i2c id.

You’re awesome!!!
Thank You so much for your help!!! :star:

Both your advises got me on the right track and now it’s working perfectly!
Installed it on 2 separate systems and it works :slight_smile:

For others who would like to do it, here’s the config that is working:

substitutions:
  name: home-assistant-voice
  friendly_name: home-assistant-voice
packages:
  Nabu Casa.Home Assistant Voice PE: github://esphome/home-assistant-voice-pe/home-assistant-voice.yaml
  grove-i2c: github://esphome/home-assistant-voice-pe/modules/grove-i2c.yaml

rc522_i2c:
  i2c_id: grove_i2c
  address: 0x28
  on_tag:
    then:
      - homeassistant.tag_scanned: !lambda 'return x;'

# Link the RFID reader to binary sensor
binary_sensor:
  - platform: rc522
    uid: 83-08-60-1A
    name: "NFC"

esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}
api:
  encryption:
    key: ...redacted...


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

This should work lot better than the one I built before using guide from Adonno to build tagreader:

It was very unstable for me … it worked some times, some times I needed to restart it to get it working…
Voice PE is very stable and I have not had any stability problems with it, so added NFC functionality should work very stable too :slight_smile: