Power usage in kw/h (DSMR)
Node-RED

Power usage in kw/h (DSMR)

Reads the current power usage in kw/h from the DSMR (Dutch Smart Meter Requirements) integration in Homeassistant and displays it on the awtrix
A flow by RobG

Download flow Download assets

Flow Details

Reads the current power usage in kw/h from the DSMR (Dutch Smart Meter Requirements) integration in Homeassistant and displays it on the awtrix

Prerequisites

  • Home Assistant
  • Be able to read Home Assistant sensors from [nodered] (https://flows.nodered.org/node/node-red-contrib-home-assistant-websocket).
  • [DSMR integration] (https://www.home-assistant.io/integrations/dsmr/) is installed and working in Home Assistant.
  • sensor.dsmr_reading_electricity_currently_delivered sensor is available in Home Assistant.

Setup

  • Make sure all the prerequisites are filled.
  • Import the flow.
  • Import the assets in awtrix.
  • Edit the MQTT out node with your own awtrix topic and MQTT broker server

Customization
Feel free to edit

  • The inject node (default it retrieves the data every minute from Home Assistant)
  • The function node (Create Message), in the msg.payload part the message is setup.
[{"id":"2665e29aae934df5","type":"group","z":"e80c6f6f5e6792b3","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["55c5e6ca7cf5454c","8cf214d4050e1efc","ca2c91946226b31d","8059b2124459b2dd","a50e26c779e30a48"],"x":14,"y":1019,"w":872,"h":142},{"id":"55c5e6ca7cf5454c","type":"api-current-state","z":"e80c6f6f5e6792b3","g":"2665e29aae934df5","name":"Get Current Power","server":"d97797a8.1c4178","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.dsmr_reading_electricity_currently_delivered","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":270,"y":1120,"wires":[["8cf214d4050e1efc"]]},{"id":"8cf214d4050e1efc","type":"function","z":"e80c6f6f5e6792b3","g":"2665e29aae934df5","name":"Create Message","func":"var value = msg.payload;\nvar unit = msg.data.attributes.unit_of_measurement;\n//msg.payload = price;\n\nmsg.payload = { \n // \"text\": value + ' KW', \n \"text\": value + ' ' + unit,\n \"icon\": 44432, \n \"repeat\": 2, \n \"pushIcon\": 0 \n};\n\nnode.status({ fill: 'green', shape: 'ring', text: value + ' ' + unit});\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":1120,"wires":[["a50e26c779e30a48"]]},{"id":"ca2c91946226b31d","type":"inject","z":"e80c6f6f5e6792b3","g":"2665e29aae934df5","name":"","props":[],"repeat":"60","crontab":"","once":true,"onceDelay":"5","topic":"","x":110,"y":1120,"wires":[["55c5e6ca7cf5454c"]]},{"id":"8059b2124459b2dd","type":"comment","z":"e80c6f6f5e6792b3","g":"2665e29aae934df5","name":"Power Usage","info":"","x":130,"y":1060,"wires":[]},{"id":"a50e26c779e30a48","type":"mqtt out","z":"e80c6f6f5e6792b3","g":"2665e29aae934df5","name":"","topic":"awtrix_id/custom/power_usage","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"346df2a95aac5785","x":730,"y":1120,"wires":[]},{"id":"d97797a8.1c4178","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"346df2a95aac5785","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]
/flows/7qRWNolj5X4w/44432.gif
-- Flow first published on May 10, 2023, last updated on May 10, 2023 at 19:01.