I need to do some math on the value returned from a modbus sensor.
I was tryng to follow this: Sensors - template & value math
I know a value-template will not work, so I am trying to use “- platform: template” but when validating the configuration, I am getting the error “Error loading /config/configuration.yaml: mapping values are not allowed here in “/config/configuration.yaml”, line 153, column 12”
How can I do some math on the sensor value?
Image added to show lone numbers.
The Battery Current is under the sensor directive and is what is actually getting the data from modbus. Some of them need to be divided by 10 or 100 to get the proper data.
Is my formatting an issue? I copied and pasted it, so I think it is correct.
I am still getting this error.
Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/configuration.yaml”, line 153, column 12
-platfor: template is on line 152 for reference.
Ok, I have shifted all of them. The error has updated to
Invalid config for [sensor.template]: invalid slug sensor.battery_current (try sensor_battery_current) for dictionary value @ data[‘sensors’]. Got OrderedDict([(‘sensor.battery_current’, None), (‘value_template’, “{{ states(‘sensor.battery_current’) | float | multiply(0.1) }}”)]). (See ?, line ?).
I pulled sensor.battery_current from the developer tools.
Thanks for all of the help. This is day two for me with HA.
I think VDRainer and I also have a few forehead bruises … I can’t believe how many syntax error were packed into so few lines … and I missed two of them on the first try.
Thank you for finding them. I was trying to use the forum and google to get it to work, so I had a patchwork of ‘solutions.’ I don’t like to make things too easy.