Hey friends,
Hopefully a quick and easy fix but I can’t seem to get it right. I have set up a UK Fuel sensor with subsequent template, it is pulling through just fine, but can’t get the value to present the way I need. I would like the currency, then value with 2 decimal places.
Any help would be appreciated.
TIA
Current: 1.3 £
Required £1.32
sensor:
- platform: rest
name: Sainsbury_Fuel_Prices
resource: https://api.sainsburys.co.uk/v1/exports/latest/fuel_prices_data.json
json_attributes_path: "$.stations[?(@.site_id=='gcqpnbmvq372')]"
json_attributes:
- brand
- address
- postcode
- location
- prices
value_template: 'OK'
template:
- sensor:
- name: "Sainsburys"
state: "{{ '%.2f' | format(state_attr('sensor.Sainsbury_Fuel_Prices', 'prices')['E10'] / 100) }}"
unit_of_measurement: "£"
state_class: measurement