Update 2023.6.0 Command_Line Multiple Commands Syntax

Hello,

After the update 2023.6.0 as i see the syntax of the switch at command_line has changed.
The syntax for multiple switch commands is as below?

command_line:
  - switch:
      name: player
      command_on: 'echo -n -e "\xA5\xAB\x00\x02\x01\x00\x00\x03" | nc -u -w1 192.168.168.202 5062'
      command_off: 'echo -n -e "\xA5\xAB\x00\x02\x02\x00\x00\x04" | nc -u -w1 192.168.168.202 5062'
  - switch:
      name:  muteout1
        command_on: 'echo -n -e "\xA5\xAB\x03\x31\x01\x01\x00\x36" | nc -u -w1 192.168.168.202 5062'
        command_off: 'echo -n -e "\xA5\xAB\x03\x32\x01\x01\x00\x37" | nc -u -w1 192.168.168.202 5062'
  - switch:
      name:  muteout2
        command_on: 'echo -n -e "\xA5\xAB\x03\x31\x02\x02\x00\x38" | nc -u -w1 192.168.168.202 5062'
        command_off: 'echo -n -e "\xA5\xAB\x03\x32\x02\x02\x00\x39" | nc -u -w1 192.168.168.202 5062'  

Yes, command_line: takes a list as per the updated docs.

Thank you very much!!

Haven’t upgraded and started to make the changes myself, so please shout if it isn’t working.

OK. If someone has upgraded, tell us if this work as I have write it!

i have upgraded this morning, changed the command_line sensors as in the docs, but the entities are not generated. i’m struggling for almost 3 hour now. no errors.

Can someone clarify to us what happened with this issue?

I have changed the command_lines without any problems

#-OLD----------------------------------------------------
sensor:
  - platform: command_line
    name: Processor Temperature
    unique_id: processor_temperature
    command: 'cat /sys/class/thermal/thermal_zone1/temp'
    unit_of_measurement: '°C'
    value_template: '{{ (value | multiply(0.001)) | round(0) }}'

  - platform: command_line
    name: Product Name
    unique_id: product_name
    command: 'cat /sys/class/dmi/id/product_name'
    value_template: '{{ value }}'

#-NEW---------------------------------------------------
command_line:
  - sensor:
      name: Processor Temperature
      unique_id: processor_temperature
      command: 'cat /sys/class/thermal/thermal_zone1/temp'
      unit_of_measurement: '°C'
      value_template: '{{ (value | multiply(0.001)) | round(0) }}'

  - sensor:
      name: Product Name
      unique_id: product_name
      command: 'cat /sys/class/dmi/id/product_name'
      value_template: '{{ value }}'

this is my code.

command_line:
  - sensor:
      name: main breaker decoded voltage
      scan_interval: 5
      command: 'python3 /config/python_scripts/base64_int.py {{ states("sensor.main_breaker_encoded_voltage") }} 2'
      value_template: "{{ value | multiply(0.01) | round(2)}}"

it should generate an entity called “main breaker decoded voltage” with state equal to something like 239.5 (volts).
the entity is nowhere to be found after 2023.6 update.
do you guys have any idea?

Just tried your code without the command: ‘python3…’ (I use another command:) and the sensor “main breaker decoded voltage” is created.
Have you restarted HA after you have make the changes?

yes, i have restarted… right now i am creating another test entity and will open an issue. i will also post here.

LE: i think i found the issue. it seems the current command_line integration doesn’t like value_template. so i created antoher template sensor and added the state there. all i working fine so far. tested with 2 sensors out of 9.

template:
  - sensor:
      - name: main breaker voltage
        unique_id: main breaker voltage
        device_class: voltage
        unit_of_measurement: V
        state: "{{states('sensor.main_breaker_decoded_voltage') | multiply(0.1) | round(2)}}"

Any news for this?
The syntax is alright?
I have 400 lines of configuration with these commands.

It’s listed as a valid option in the docs right now.

so it’s either that the docs weren’t updated yet, there is a bug or that’s not the real issue.

What does this mean? Where are your logs or error messages?

Both old & new integrations are buggy in part of templates.
But it is related to using templates for a “command” option, not “value_template”.

Hello,
We have any clarification for this one? Also with this update i have observe that the domain name homeassistant.local doesn’t work very well especially at add on section which doesn’t open with domain name but only with direct IP of Home Assistant.

How We have to make the syntax of the command line after the upgrade finally? I haven’t upgrade yet my HA. If someone has make it to work,I would like to give us an example with more than one switch commands!
Thank you!!