Command line sensor, ssh and ipmitool - sensor name consisting of two words "Voltage 1" - doesn't work!

I’m having a problem with one of my ipmitool sensors… they all work, except the ones that have two parts to the name! i.e. “Voltage 1” or “Sys Fan”.

- platform: command_line
  name: Server Power Voltage
  command: "/usr/bin/ssh -i /config/ssh_keys/id_rsa -o UserKnownHostsFile=/config/ssh_keys/known_hosts [email protected] ipmitool -I lanplus -H 192.168.1.45 -U root -P enigma sensor reading **"Voltage 1"** | cut -c 20-25"

Other sensors with single names work fine… so I know the main settings are correct. Also if I manually run the command in thermal, that also works.

But when I test the command in the File Editor ‘Execute shell command’, I see the problem… the message I get is:

Sensor “Voltage” not found!
Sensor “1” not found!

For some reason, passing the command from home assistant breaks the sensor name up, even though it’s in quotation marks “Voltage 1”… I’ve also tried this ‘Voltage 1’, but sadly no joy!

Is there any clever people out who could offer some help?

Have you tried 'Voltage\ 1'?

Thanks for the suggestion… that give me a Sensor “Voltage\ 1” not found!

If you use double quotes around your command, you need to use single ones inside.

command: "/usr/bin/ssh -i /config/ssh_keys/id_rsa -o UserKnownHostsFile=/config/ssh_keys/known_hosts [email protected] ipmitool -I lanplus -H 192.168.1.45 -U root -P enigma sensor reading **'Voltage 1'** | cut -c 20-25"

BTW: Here’s another way to get values from another server to HA.

This. I use this kind of remote SSH on my system for dozens of things and quote out a lot of the string to prevent any problems, such as:

speak: ssh -i /config/ssh/id_rsa -o 'StrictHostKeyChecking=no' [email protected] '~/Documents/Scripts/tts.sh "{{text}}"'

Thanks, my example above is wrong (well spotted)… I have used single and double quotes (plus inverted), but the sensor name always seems to spit apart when called through HA! Somewhat annoying, but I have managed to get the sensors in HA by using the impitool sdr type XXXXX, and then use a mix of grep and cut to filter out the values.