Hi,
I have a command_line sensor to run an xml_grep on a file served from a printer that returns the % values of the Black ink tank and the Colour ink tank.
sensor printer:
- platform: command_line
name: “Printer”
command: “xml_grep ‘dd:ConsumableRawPercentageLevelRemaining’ http://192.168.10.43:80/DevMgmt/ProductUsageDyn.xml --text_only”
The result of this returns the two values, separated by a space, e.g.
86 30
where 86% is the value of the Black Ink Tank and 30% is the value of the colour tank.
Struggling with a value_template to split these into two separate sensors. Would appreciate any pointers. Have been trying things like the following but with no success;
value_template: “{{ states.sensor.printer.state.split(’ ')[0] }}”
Many thanks.