Hildebrand Glow API (Access to DCC SMART Meter data)

Prerequisites: Bright App working with your userid and password associated with your energy supply, SMART meter( Gas and/or Electricity) enrolled in DCC. MQTT is enabled if you ask Hildebrand (Bright App publisher) politely, also let them know you are wanting to use the API to ensure that you can connect to your DCC data.

This is a flow that uses your Bright App login credentials to create an authentication token which is stored in flow context with the Hildebrand application Id, and your resource/entity Ids.

The Bright App login credentials need only be entered once to create the authentication token. The login details can then be deleted, relying on the authentication token being renewed every 48 hours or so to continue to receive your 30-minute, hourly or daily data etc. Although the process is to "renew" the authentication token, it doesn't extend the expiry of the existing token, it uses the existing token to create a new token with a new expiry.

If you want real-time data (rather than the latest 30-minute reading), you need to buy one of Hildebrand's Consumer Access Devices, with or without local display. Hildebrand are not the only organisation offering this service but this flow makes use of their API to access DCC data.

The flow also uses node-red-contrib-moment to make the token expiry timestamp human readable.

Note that the "current data" inject node gets it's data from the Hildebrand CAD and so will only work if you have bought and successfully commissioned one of their devices. All of the other parts should work as long as you have successfully signed up to their App and your energy supply is enrolled in the DCC (and Hildebrand know you want to use their API).

[{"id":"62848ee99d08d857","type":"tab","label":"GlowAPI","disabled":false,"info":"For details see:\nhttps://docs.glowmarkt.com/GlowmarktAPIDataRetrievalDocumentationIndividualUserForBright.pdf"},{"id":"3fbcc579.1dc12a","type":"inject","z":"62848ee99d08d857","name":"Request Token","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":160,"y":40,"wires":[["c33faa35432304fa"]]},{"id":"dea77fd.b480f8","type":"http request","z":"62848ee99d08d857","name":"Request Authentication Token","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://api.glowmarkt.com/api/v0-1/auth","tls":"","persist":false,"proxy":"","authType":"","x":690,"y":40,"wires":[["e1c51a9ccfb852b5"]]},{"id":"261e81ee.00f02e","type":"debug","z":"62848ee99d08d857","name":"Request Token Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1060,"y":100,"wires":[]},{"id":"c33faa35432304fa","type":"function","z":"62848ee99d08d857","name":"set payload and headers","func":"msg.headers = {};\nmsg.headers['accept'] = \"application/json\";\nmsg.headers['applicationId'] = \"b0f1b774-a586-4f72-9edd-27ead8aa7a8d\";\nmsg.payload = {};\nmsg.payload['-d'] = \"\";\nmsg.payload['username'] = \"YourBrightLoginId\";\nmsg.payload['password'] = \"YourBrightLoginPassword\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":40,"wires":[["dea77fd.b480f8"]]},{"id":"fd80e6a598d4ab71","type":"http request","z":"62848ee99d08d857","name":"Get all virtual entities","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.glowmarkt.com/api/v0-1/virtualentity","tls":"","persist":false,"proxy":"","authType":"","x":620,"y":340,"wires":[["303d2982f243265c"]]},{"id":"b8c9eadd4de0e103","type":"function","z":"62848ee99d08d857","name":"set payload and headers","func":"msg.headers = {};\nmsg.headers['accept'] = \"application/json\";\nmsg.headers['token'] = flow.get(\"token\");\nmsg.headers['applicationId'] = flow.get(\"applicationId\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":340,"wires":[["fd80e6a598d4ab71"]]},{"id":"82967159f80d3083","type":"debug","z":"62848ee99d08d857","name":"Virtual Entities","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1040,"y":340,"wires":[]},{"id":"427341c816e41404","type":"inject","z":"62848ee99d08d857","name":"Request Virtual Entities","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":160,"y":340,"wires":[["b8c9eadd4de0e103"]]},{"id":"ab95aca9cc04419d","type":"http request","z":"62848ee99d08d857","name":"Get a virtual entity with the full definition of resources","method":"GET","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":720,"y":400,"wires":[["91f63918b8343e73"]]},{"id":"675298049ab7e1be","type":"function","z":"62848ee99d08d857","name":"set payload and headers","func":"msg.headers = {};\nmsg.headers['accept'] = \"application/json\";\nmsg.headers['token'] = flow.get(\"token\");\nmsg.headers['applicationId'] = flow.get(\"applicationId\");\nmsg.url = \"https://api.glowmarkt.com/api/v0-1/virtualentity/\" +flow.get(\"veId\") + \"/resources\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":400,"wires":[["ab95aca9cc04419d"]]},{"id":"7934e73938129743","type":"debug","z":"62848ee99d08d857","name":"Definition of Resources","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1010,"y":460,"wires":[]},{"id":"6807ba6d12041c11","type":"inject","z":"62848ee99d08d857","name":"Request all Resources","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":160,"y":400,"wires":[["675298049ab7e1be"]]},{"id":"66a67f04ae2dc9b6","type":"http request","z":"62848ee99d08d857","name":"Get the resource readings","method":"GET","ret":"obj","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","authType":"","x":650,"y":520,"wires":[["c52add4a1dc11690"]]},{"id":"70d38e2e1dbf370a","type":"function","z":"62848ee99d08d857","name":"set payload and headers","func":"msg.payload = {\n    \"from\":\"2022-01-03T00:00:00\",\n    \"to\": \"2022-01-10T00:00:00\",\n    \"period\": \"P1W\",\n    \"function\": \"sum\"\n}\nmsg.headers = {};\nmsg.headers['accept'] = \"application/json\";\nmsg.headers['token'] = flow.get(\"token\");\nmsg.headers['applicationId'] = flow.get(\"applicationId\");\nmsg.url = \"https://api.glowmarkt.com/api/v0-1/resource/\" +flow.get(\"resourceIdAMRAPI\") + \"/readings?\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":520,"wires":[["66a67f04ae2dc9b6","c52add4a1dc11690"]]},{"id":"c52add4a1dc11690","type":"debug","z":"62848ee99d08d857","name":"Resource Readings","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1030,"y":520,"wires":[]},{"id":"e695aa9f71eb9ab9","type":"inject","z":"62848ee99d08d857","name":"Ad Hoc request data","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":150,"y":520,"wires":[["70d38e2e1dbf370a"]]},{"id":"e3e43f2bef92d139","type":"http request","z":"62848ee99d08d857","name":"Get a resource’s current readings","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":680,"y":580,"wires":[["ac95660c9f3ab6a6"]]},{"id":"29e2ef3f6a57fe0d","type":"function","z":"62848ee99d08d857","name":"set payload and headers","func":"msg.headers = {};\nmsg.headers['accept'] = \"application/json\";\nmsg.headers['token'] = flow.get(\"token\");\nmsg.headers['applicationId'] = flow.get(\"applicationId\");\nmsg.url = \"https://api.glowmarkt.com/api/v0-1/resource/\" +flow.get(\"resourceIdAMRAPI\") + \"/current\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":580,"wires":[["e3e43f2bef92d139"]]},{"id":"ac95660c9f3ab6a6","type":"debug","z":"62848ee99d08d857","name":"Current Readings","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1030,"y":580,"wires":[]},{"id":"cbead358f752c1a8","type":"inject","z":"62848ee99d08d857","name":"Request current data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":160,"y":580,"wires":[["29e2ef3f6a57fe0d"]]},{"id":"e1c51a9ccfb852b5","type":"json","z":"62848ee99d08d857","name":"Convert Payload to a JSON Object","property":"payload","action":"","pretty":false,"x":240,"y":100,"wires":[["556e0a1cd6053152"]]},{"id":"556e0a1cd6053152","type":"change","z":"62848ee99d08d857","name":"Write flow context","rules":[{"t":"set","p":"token","pt":"flow","to":"payload.token","tot":"msg"},{"t":"set","p":"tokenExpiry","pt":"flow","to":"payload.exp","tot":"msg"},{"t":"set","p":"applicationId","pt":"flow","to":"b0f1b774-a586-4f72-9edd-27ead8aa7a8d","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":100,"wires":[["261e81ee.00f02e"]]},{"id":"303d2982f243265c","type":"change","z":"62848ee99d08d857","name":"Set Flow veId","rules":[{"t":"set","p":"veId","pt":"flow","to":"payload[0].veId","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":340,"wires":[["82967159f80d3083"]]},{"id":"91f63918b8343e73","type":"json","z":"62848ee99d08d857","name":"Convert Payload to a JSON Object","property":"payload","action":"","pretty":false,"x":240,"y":460,"wires":[["40a6d3bd049abf60"]]},{"id":"7f8a86ad424d9b16","type":"inject","z":"62848ee99d08d857","name":"Renew Token","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":150,"y":160,"wires":[["a6cf347d1df363d0"]]},{"id":"ab0a89dbe1e7eda4","type":"http request","z":"62848ee99d08d857","name":"Renew Authentication Token","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://api.glowmarkt.com/api/v0-1/auth/newToken","tls":"","persist":false,"proxy":"","authType":"","x":900,"y":160,"wires":[["ec902a5330dfc5bc","4abf0e85088666a7"]]},{"id":"4abf0e85088666a7","type":"debug","z":"62848ee99d08d857","name":"Request Renew Token Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1090,"y":220,"wires":[]},{"id":"8382a4fef529bf59","type":"function","z":"62848ee99d08d857","name":"set payload and headers","func":"msg.headers = {};\nmsg.headers['accept'] = \"application/json\";\nmsg.headers['applicationId'] = flow.get(\"applicationId\");\nmsg.headers['token'] = flow.get(\"token\");\nmsg.payload = {};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":630,"y":160,"wires":[["ab0a89dbe1e7eda4"]]},{"id":"ec902a5330dfc5bc","type":"json","z":"62848ee99d08d857","name":"Convert Payload to a JSON Object","property":"payload","action":"","pretty":false,"x":240,"y":220,"wires":[["4b6a1deb5e76a797"]]},{"id":"4b6a1deb5e76a797","type":"change","z":"62848ee99d08d857","name":"Write flow context","rules":[{"t":"set","p":"token","pt":"flow","to":"payload.token","tot":"msg"},{"t":"set","p":"tokenExpiry","pt":"flow","to":"payload.exp","tot":"msg"},{"t":"set","p":"payload.expmom","pt":"msg","to":"flow.get(tokenExpiry)*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":220,"wires":[["4abf0e85088666a7","7665c27ecfa9e6b9"]]},{"id":"a6cf347d1df363d0","type":"trigger","z":"62848ee99d08d857","name":"48 Hour repeating Timestamp","op1":"","op2":"0","op1type":"date","op2type":"str","duration":"-48","extend":false,"overrideDelay":false,"units":"hr","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":370,"y":160,"wires":[["8382a4fef529bf59"]]},{"id":"677ffdaf723eed1c","type":"moment","z":"62848ee99d08d857","name":"Convert to readable date and time","topic":"","input":"payload.exp","inputType":"msg","inTz":"Europe/London","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-MM-DD HH:mm:ss","locale":"en-GB","output":"payload.exp","outputType":"msg","outTz":"Europe/London","x":650,"y":280,"wires":[[]]},{"id":"40a6d3bd049abf60","type":"change","z":"62848ee99d08d857","name":"Set Flow resourceIds","rules":[{"t":"set","p":"resourceIdAMRAPI","pt":"flow","to":"payload.resources[1].resourceId","tot":"msg"},{"t":"set","p":"resourceIdADHOC","pt":"flow","to":"payload.resources[2].resourceId","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":460,"wires":[["7934e73938129743"]]},{"id":"7665c27ecfa9e6b9","type":"function","z":"62848ee99d08d857","name":"Convert timestamp for moment.js processing","func":"msg.payload.exp = msg.payload.exp * 1000 // moment.js is expecting a number of mS whereas the timestamp comes as the number of seconds\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":280,"wires":[["677ffdaf723eed1c"]]},{"id":"188746e4f98e0700","type":"comment","z":"62848ee99d08d857","name":"Glow API documentation","info":"https://docs.glowmarkt.com/GlowmarktAPIDataRetrievalDocumentationIndividualUserForBright.pdf","x":1030,"y":40,"wires":[]}]

Flow Info

Created 2 years, 4 months ago
Rating: 5 2

Owner

Actions

Rate:

Node Types

Core
  • change (x4)
  • comment (x1)
  • debug (x6)
  • function (x7)
  • http request (x6)
  • inject (x6)
  • json (x3)
  • trigger (x1)
Other
  • moment (x1)
  • tab (x1)

Tags

  • SMart
  • Meter
  • DCC
  • Hildebrand
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option