Learning home assistant with multi sensors

I have been playing with Home Assistant for 2 weeks now and have hit my first config file issue that I cannot figure out. This is just a test system for me to play with before I do anything for the house.

I have 2 multisensors that use nodemcu’s.
I have home assisntant with mqtt enabled.
When I power up the multisensor I can see data being passed to home assistant ui (all good so far)

When I then edit the config file to add the second sensor, the first stops working and the data from the first multisensor appears in the second sensor from the config file. I cannot see why the first sensor entry would be removed when adding the second one. Am I missing something obvious?

Here is the sensor code for the config


mqtt:  
  broker: 192.168.0.68  
  port: 1883  
  client_id: home-assistant-1  
  username: mqtt  
  password:xxxxx  
  
#Sensor 1  
sensor:  
  - platform: mqtt  
    state_topic: "bruh/sensornode1"  
    name: "SN1 Humidity"  
    unit_of_measurement: "%"  
    value_template: '{{ value_json.humidity | round(1) }}'  
  
  - platform: mqtt  
    state_topic: "bruh/sensornode1"  
    name: "SN1 LDR"
   
    unit_of_measurement: "LUX"  
    value_template: '{{ value_json.ldr }}'  
  
  - platform: mqtt  
    state_topic: "bruh/sensornode1"  
    name: "SN1 PIR"  
    value_template: '{{ value_json.motion }}'  
  
  - platform: mqtt  
    state_topic: "bruh/sensornode1"  
    name: "SN1 Temperature"  
    unit_of_measurement: "°F"  
    value_template: '{{ value_json.temperature | round(1) }}'  

  - platform: mqtt
    state_topic: "bruh/sensornode1"
    name: "SN1 Real Feel"
    unit_of_measurement: "°F"
    value_template: '{{ value_json.heatIndex | round(1) }}'
  
group:  
  sensor_node_1_card:  
    name: Sensor Node 1  
    entities:  
      - sensor.sn1_temperature  
      - sensor.sn1_humidity  
      - sensor.sn1_ldr  
      - sensor.sn1_pir  
      - light.sn1_led 
#Sensor2
sensor:  
  - platform: mqtt
    state_topic: "bruh/sensornode2"  
    name: "SN2 Humidity"  
    unit_of_measurement: "%"  
    value_template: '{{ value_json.humidity | round(1) }}'  
  
  - platform: mqtt 
    state_topic: "bruh/sensornode2"  
    name: "SN2 LDR"
    
    unit_of_measurement: "LUX"  
    value_template: '{{ value_json.ldr }}'  
  
  - platform: mqtt 
    state_topic: "bruh/sensornode2"  
    name: "SN2 PIR"  
    value_template: '{{ value_json.motion }}'  
  
  - platform: mqtt  
    state_topic: "bruh/sensornode2"  
    name: "SN2 Temperature"  
    unit_of_measurement: "°F"  
    value_template: '{{ value_json.temperature | round(1) }}'  

  - platform: mqtt
    state_topic: "bruh/sensornode2"
    name: "SN2 Real Feel"
    unit_of_measurement: "°F"
    value_template: '{{ value_json.heatIndex | round(1) }}'
  
group:  
  sensor_node_2_card:  
    name: Sensor Node 2  
    entities:  
      - sensor.sn2_temperature  
      - sensor.sn2_humidity  
      - sensor.sn2_ldr  
      - sensor.sn2_pir  
      - light.sn2_led

If you’re not using packages, please see the docs here. You can’t use sensor: or group: (or anything else at that level) twice like that.

1 Like

Thanks for pointing this out, so simple, I just thought all sensors where passed in under “sensor”.
Working now!