Update 01/2023: below manual solution became obsolete as I have now created a custom integration that facilitates this, see: GitHub - myTselection/pixometer: Home Assistant custom component HACS for Pixometer app meter reading integration.
Found some time to look into this, if anyone interested, see below. Feel free to suggest improvements, still trying out myself…
- Install Pixometer app to easily scan your meter reading with smartphone camera
- Add your Pixometer credentials in json payload format into your
secrets.yaml
, should look like:pixometer_credentials: '{ "username" : "[email protected]", "password": "XXXXXXXXXXXXX" }'
- Navigate to https://pixometer.io/portal/#/login to login on the API website
- Navigate to https://pixometer.io/portal/#/meters/list or https://pixometer.io/api/v1/meters/ to get your meter_id values
- Repeat below rest readings configuration for every meter you’d like to use adding the correct
meter_id
into the rest resource url
configuration.yaml
:
sensor:
- platform: rest
name: Pixometer Token
method: POST
resource: https://pixometer.io/api/v1/access-token/
payload: !secret pixometer_credentials
scan_interval: 3600
value_template: '{{"Bearer "+ value_json.access_token}}'
headers:
Content-Type: application/json
- platform: rest
name: Pixometer Electricity
resource: https://pixometer.io/api/v1/readings/?meter_id=XXXXXXXX&o=-created
headers:
Authorization: '{{states("sensor.pixometer_token")}}'
json_attributes:
- results
value_template: "{{ value_json.results[0].value }}"
device_class: energy
unit_of_measurement: "kWh"
utility_meter:
energy:
source: sensor.pixometer_electricity
cycle: daily
net_consumption: true
Updated my post to automatically fetch the access token with a separate rest sensor ‘Pixometer Token’, as this access token has limited time to live.