P1 smartmeter (API)

Hi everyone,

I’m trying to read my smart electricity meter via P1 (DSMR 4.0) and send the data to Homey using com.p1.smartmeter-dsmr.reader. I’m following the instructions from this forum thread, but I’m running into issues.

Setup:

  • Raspberry Pi 1B
  • Homey (Early 2019)
  • Smart Meter connected to Raspberry via USB (ttyUSB0)
  • P1 Smart Meter app installed on Homey
  • P1 smartmeter added as a device in Homey
  • Homey local IP: 192.168.2.19
  • Configuration file (config.js):
const homeyId = 'xxxxx';  // Homey ID anonymized
const usbPort = '/dev/ttyUSB0';
const bps = 115200;
const bits = 8;
const parity = 'none';
const homeyEndpoint = '/api/app/com.p1/update';
const homeyHosts = ['https://' + homeyId + '.connect.athom.com'];

What works?

  • The smart meter seems to be connected properly:
node src/p1.js  
{"level":"info","message":"p1 smartmeter is connected!"}

What doesn’t work?

  1. API call via Homey Cloud returns an error:
curl -k https://xxxxx.connect.athom.com/api/app/com.p1/update
{"code":404,"error":"not_found","error_description":"Not found: GET /api/app/com.p1/update"}
  1. API call via local IP also fails:
curl -k -X POST -d '{"your": "data"}' http://192.168.2.19/api/app/com.p1/update
false

Questions:

  • Has anyone successfully set up this integration with Homey (Early 2019)?
  • Do I need to configure an API token somewhere?
  • What does the "not_found" error mean exactly? Do I need to configure a specific device in Homey, other than adding P1 smartmeter?
  • Is there a way to check logs in Homey to see if the request is being received?

Any help is greatly appreciated! Thanks in advance. :blush: