Hello,
Any ideas how to make this work with command_line?
switch:
- platform: rpi_gpio
ports:
23: Tehnoruum
invert_logic: true
Hello,
Any ideas how to make this work with command_line?
switch:
- platform: rpi_gpio
ports:
23: Tehnoruum
invert_logic: true
That is not a command line switch. Leave it as is.
Jag fick meddelandet ‘Command Line YAML configuration has moved’.
In configuration.yaml, I had:
- platform: command_line
name: Raspberry CPU Temperature
command: cat /sys/class/thermal/thermal_zone0/temp
unit_of_measurement: "°C"
value_template: "{{ value | multiply(0.001) | round(2) }}"
I changed it to:
- command_line: (here I see Missing Property "platform".
- sensor:
name: Raspberry CPU Temperature
command: cat /sys/class/thermal/thermal_zone0/temp
unit_of_measurement: "°C"
value_template: "{{ value | multiply(0.001) | round(2) }}"
And when using Developer tools Check Configuration, I see:
Configuration invalid!
Invalid config for [sensor]: required key not provided @ data[‘platform’]. Got None. (See /config/configuration.yaml, line 27).
Can someone please help me out and tell me what I am doing wrong?
Should be
command_line:
And the command line integration should be in your configuration.yaml file. Not the sensors.yaml file.
Thanks for responding. I now have:
command_line:
- sensor:
name: Raspberry CPU Temperature
command: cat /sys/class/thermal/thermal_zone0/temp
unit_of_measurement: "°C"
value_template: "{{ value | multiply(0.001) | round(2) }}"
And I see:
Configuration invalid!
Invalid config for [command_line]: [platform] is an invalid option for [command_line]. Check: command_line->command_line->1->platform. (See /config/configuration.yaml, line 52).
Notes:
Everything is in configuration.yaml. I do not have a sensors.yaml file.
To clarify, I am also including a screenshot of this section of configuration.yaml, just in case:
Thanks again.
Remove all of the text under your circled text that starts - platform: systemmonitor...
and ends before input_select:...
That is not a command line sensor and belongs under sensor:
in your configuration.yaml file.
Also in future please do not post images of text. Post the text correctly formatted for the forum.
Thank you. Sorted.
Noted and acknowledged re. images.
The notification says Command Line YAML configuration has moved, but it doesn’t say from-where
or where-to
. Many users probably still have their sensor section in their configuration.yaml
file, hence the Command Line YAML configuration hasn’t moved anywhere - it has just changed. I think therefore the headline is misleading. It would also be nice if the DOCs would mention that the old syntax for command_line has been (will be) depreciated;
The configuration has moved. From the sensor integration to its own integration. That does not depend on you having a split config or not.
Yeah, I guess you are right. I can see that now, but it wasn’t immediately obvious to me what was meant by that headline.
Thanks for enlightening me.
This works for me too.
Hi,
Unfortunately I have to adjust all my template sensors to the command_line.
I’ve split up my configuration.yaml and now added :
Integrations:
Command_line.yaml
command_line: !include_dir_merge_list ../entities/command_line
In the folder ‘Entities\command_line’
I have several files like this : (uset to be located in my ‘sensor’ subfolder)
- platform: template
sensors:
energy_import_totaal_dagelijks_kwh:
friendly_name: 'kWh vandaag piek + dal'
value_template: "{{ (states('sensor.energy_import_t1_dagelijks_kwh')|float + states('sensor.energy_import_t2_dagelijks_kwh')|float)|round(2) }}"
unit_of_measurement: "kWh"
- platform: template
sensors:
energy_import_totaal_wekelijks_kwh:
friendly_name: 'kWh wekelijks piek + dal'
value_template: "{{ (states('sensor.energy_import_t1_wekelijks_kwh')|float + states('sensor.energy_import_t2_wekelijks_kwh')|float)|round(2) }}"
unit_of_measurement: "kWh"
- platform: template
sensors:
energy_import_totaal_maandelijks_kwh:
friendly_name: 'kWh maandelijks piek + dal'
value_template: "{{ (states('sensor.energy_import_t1_maandelijks_kwh')|float + states('sensor.energy_import_t2_maandelijks_kwh')|float)|round(2) }}"
unit_of_measurement: "kWh"
etc....
Can someone help me and tell me how to ‘convert’ these sensors templates to command_line ?
Thanks in advance.
Jeffrey
No.
The template sensor and command line sensor integrations are two unrelated things and there is no need to convert from one to the other. You do not need to do this.
Thank you. I’m not working with home assistant on a daily basis and since I got a message that sensors had to be transferred to command_line I wanted to convert these too
My two cents here. The solutions mentioned earlier are correct, but difficult to implement for people that are not experts in the YAML setup.
So I had this in my configuration.yaml:
group: !include groups.yaml
template: !include templates.yaml
input_boolean: !include inputs.yaml
automation: !include automations.yaml
influxdb: !include influxdb.yaml
sensor: !include sensors.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
and in my sensors.yaml I had this:
#
# CPU Temperatuur
#
- platform: command_line
name: CPU Temperature
command: "cat /sys/class/thermal/thermal_zone0/temp"
unit_of_measurement: "°C"
value_template: "{{ value | multiply(0.001) | round(1) }}"
#
# CPU Bezetting
#
- platform: command_line
name: CPU Load
command: "top -n1 | awk '/Cpu\\(s\\):/{print $2}'"
unit_of_measurement: "%"
value_template: "{{ value | multiply(1) | round(1) }}"
This was the code that will be deprecated in August.
Here’s what I did:
in configuraion.yaml I added one line at the bottom:
command_line: !include cmdline.yaml
then I added a new file called cmdline.yaml that contained:
#
# CPU Temperatuur
#
- sensor:
name: CPU Temperature
command: "cat /sys/class/thermal/thermal_zone0/temp"
unit_of_measurement: "°C"
value_template: "{{ value | multiply(0.001) | round(1) }}"
#
# CPU Bezetting
#
- sensor:
name: CPU Load
command: "top -n1 | awk '/Cpu\\(s\\):/{print $2}'"
unit_of_measurement: "%"
value_template: "{{ value | multiply(1) | round(1) }}"
That’s all, check yaml, the restart Home Assistant and it works!
Hope this helps!
This is easy enough to “fix” but the requirement of this change is fabulously asinine. “Sensor” is a fundamental domain to the structure of Home Assistant. “Command_Line” has never been. It’s just a platform to create sensor.
Everyone with any sort of meaningful tree structure to their yaml now will be needing to put a sensor in their base config.yaml OR make a new file called something like command_line.yaml.
Can you write alternative for this sensors?
- platform: template
sensors:
count_lights_on:
friendly_name: "# Lights on"
unit_of_measurement: "on"
value_template: "{{ states.light | selectattr('state', 'eq', 'on') | list | count }}"
- platform: template
sensors:
count_all_devices:
friendly_name: "# All devices"
value_template: "{{ states | list | count }}"
Again, no. They are not command line sensors.
Only command line sensors (platform: command_line
) need to be updated.
I actually agree on the ‘why’
I’ve a splitt’ed config in order to group stuff, and now my sensors and switches all over the place again
Yes, this is the problem of an ever developing environment. Something is getting deprecated every now and than which creates unnecessary trouble and kills a lot of time to fix. HA developers should consider creating a migration tool that can make all this upgrading process lot easier… Otherwise things are getting frustrating with every update and are forcing me to quit HA.