esphome / esphome-webserver

A Lit Element web component frontend for the ESPHome web_server.
https://esphome.io/components/web_server
MIT License
35 stars 42 forks source link

v3: Duplicate Sensor Names Cause Only One Sensor Output to be Displayed #122

Open madurapa opened 4 weeks ago

madurapa commented 4 weeks ago

When adding sensors to the YAML configuration as shown below, only one sensor output is displayed because both sensors use the same name, Voltage.

sensor:
  - platform: pipsolar
    pipsolar_id: ${pipsolar_id}
    grid_voltage:
      id: ${name}_${inverter}_grid_voltage
      name: "Voltage"
      web_server_sorting_weight: 0.01
      accuracy_decimals: 0
      icon: mdi:flash
    ac_output_voltage:
      id: ${name}_${inverter}_ac_output_voltage
      name: "Voltage"
      web_server_sorting_weight: 1.01
      accuracy_decimals: 0
      icon: mdi:flash
RFDarter commented 21 hours ago

hi, that is a known issue since the REST-API uses he name of the component to access it via GET/POST requests there is currently now way to show and access more components with the same name.

It would be possible to use the internally assigned id of the component and use that for the REST-API, but the you would need to find out that id which consists of the component name (number, binary_sensor, ..) and some "random" numbers.

or as you specified it here id: ${name}_${inverter}_ac_output_voltage