Hi! I want to add multiple sensors to my config. I already got multiple switches and was confused about the different syntax. I am not sure if it is just as it is, or if I am missing anything.
I can define a "switch" with a "platform" and multiple "switches" if which each entry gets its own entity name.
switch:
platform: command_line
switches:
zebes_rtp_receiver_mute:
command_on: "pactl --server zebes.local load-module module-rtp-recv"
command_off: "pactl --server zebes.local unload-module module-rtp-recv"
command_state: "pactl --server zebes.local list short modules | grep module-rtp-recv -q"
friendly_name: Zebes RTP Receiver
phaaze_rtp_receiver_mute:
command_on: "pactl --server phaaze.local load-module module-rtp-recv"
command_off: "pactl --server phaaze.local unload-module module-rtp-recv"
command_state: "pactl --server phaaze.local list short modules | grep module-rtp-recv -q"
friendly_name: Phaaze RTP Receiver
But for sensors i can only provide a list/array with sensors, and the name is converted into a snake_case name.
sensor:
# https://www.home-assistant.io/components/sensor.command_line/
- platform: command_line
name: Zebes System Volume Sensor #TODO this is used as entity id
command: >
DEFAULT_SINK=$(pactl --server zebes.local info | awk \'/^Default Sink:/{ print $3 }\');
pactl --server zebes.local list sinks | awk \'/^\\s+Name: /{isdefault = $2 == \"\'\"${DEFAULT_SINK}\"\'\"} /^\\s+Volume: / && isdefault {print $5; exit}\';
scan_interval: 10
command_timeout: 5
unit_of_measurement: "%"
value_template: '{{ value | replace("%", "") | int }}'
Is there an other way to define the sensor entity names, hopefully via a dictionary, similar to switches? I do not want to rely on the human readable “name” gets converted to a snace_case name. This makes it ultra difficult to search&replace names (for renaming) and general debugging.
I fount entity_id as alternative, is this the best choice I can make? Where is this documented, except on forum posts? Are there plan to make the sensors and switches have the same structure?
Edit: specifying entity_id does not work. It always uses the name.
Edit2: For the template sensor it seems to be possible. I am using the command line sensor. https://www.home-assistant.io/components/sensor.template/