Skip to content

Unable to change device name, vendor name and product name on Arduino Nano Matter #144

@Nephylie

Description

@Nephylie

Hi,
I am currently creating a connected vegetable garden with an Arduino Nano Matter connected to a Home Assistant.
I successfully connected my Arduino with Matter via Thread, but I can't change the device name, vendor name, and product name.
I can change the device name directly in Home Assistant, but I cannot change the product name and brand.
I have this on Home Assistant :
Image

Image

I tried using set_device_name(), set_vendor_name(), and set_product_name(), but nothing changed.
My Arduino is still named “OnOffLight” and has no brand.
Here is an extract from my code :

#include <Matter.h>
#include <MatterTemperature.h>
#include <MatterHumidity.h>
#include <MatterPressure.h>
#include <MatterIlluminance.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_TSL2561_U.h>
#include <Adafruit_BME280.h>
#include <MatterLightbulb.h>

#ifndef BTN_BUILTIN
  #define BTN_BUILTIN PA0
#endif

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme;

//MatterTemperature matter_temp_CPU;
MatterTemperature matter_temp_sensor;
MatterHumidity matter_humidity_sensor;
MatterPressure matter_pressure_sensor;
MatterIlluminance matter_luminosity_sensor;
MatterLightbulb matter_bulb;

Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 12345);

const int relayLED = 5;

float luminosity = 0.0;

bool device_active = true;
int time_measure = 60000;

void decommission_handler();

void setup()
{
  Serial.begin(115200);

  pinMode(BTN_BUILTIN, INPUT_PULLUP);
  pinMode(LED_BUILTIN, OUTPUT);

  digitalWrite(LED_BUILTIN, LED_BUILTIN_ACTIVE);

  //relay
  pinMode(relayLED, OUTPUT);
  digitalWrite(relayLED, HIGH);


  //sensors beginning
  if(!bme.begin(0x76)){
    Serial.print("Ooops, no bme280 detected ... Check your wiring or I2C ADDR!");
    device_active = false;
    //while(1);
  }

  if(!tsl.begin())
  {
    /* There was a problem detecting the TSL2561 ... check your connections */
    Serial.print("Ooops, no TSL2561 detected ... Check your wiring or I2C ADDR!");
    device_active = false;
    //while(1);
  }
  displaySensorDetails();

  //matter beginning
  Matter.begin();

  matter_temp_sensor.begin();
  //matter_temp_CPU.begin();
  matter_humidity_sensor.begin();
  matter_pressure_sensor.begin();
  matter_luminosity_sensor.begin();
  matter_bulb.begin();

  Serial.println("Matter temperature, humidity and light sensor");

  //Set name
  matter_temp_sensor.set_device_name("Potager connecte");//Set name
  matter_temp_sensor.set_vendor_name("Arduino");
  matter_temp_sensor.set_product_name("Potager connecte");

  matter_humidity_sensor.set_device_name("Potager connecte");//Set name
  matter_humidity_sensor.set_vendor_name("Arduino");
  matter_humidity_sensor.set_product_name("Potager connecte");

  matter_pressure_sensor.set_device_name("Potager connecte");//Set name
  matter_pressure_sensor.set_vendor_name("Arduino");
  matter_pressure_sensor.set_product_name("Potager connecte");

  matter_luminosity_sensor.set_device_name("Potager connecte");//Set name
  matter_luminosity_sensor.set_vendor_name("Arduino");
  matter_luminosity_sensor.set_product_name("Potager connecte");

  matter_bulb.set_device_name("Potager connecte");//Set name
  matter_bulb.set_vendor_name("Arduino");
  matter_bulb.set_product_name("Potager connecte");

  if (!Matter.isDeviceCommissioned()) {
    Serial.println("Matter device is not commissioned");
    Serial.println("Commission it to your Matter hub with the manual pairing code or QR code");
    Serial.printf("Manual pairing code: %s\n", Matter.getManualPairingCode().c_str());
    Serial.printf("QR code URL: %s\n", Matter.getOnboardingQRCodeUrl().c_str());
  }
  while (!Matter.isDeviceCommissioned()) {
    delay(200);
  }

  Serial.println("Waiting for Thread network...");
  while (!Matter.isDeviceThreadConnected()) {
    delay(200);
    decommission_handler();
  }
  Serial.println("Connected to Thread network");

  Serial.println("Waiting for Matter device discovery...");
  while (!matter_bulb.is_online() || !matter_temp_sensor.is_online() || !matter_humidity_sensor.is_online() || !matter_pressure_sensor.is_online() || !matter_luminosity_sensor.is_online()) {
    delay(200);
    decommission_handler();
  }
  Serial.println("Matter devices are now online");
  digitalWrite(LED_BUILTIN, LED_BUILTIN_INACTIVE);

}

Does anyone know how to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions