Utility Meter integration nodered automation

Have created a little automation in Node-RED to switch the utility Meter select tariff in the Utility Meter integration to allow the collection of energy data into seperate tariffs at the correct time . As a bounus it also create a sensor which poulates with the correct price , which can be added to the energy dashboard. This have been setup for Octopus Go , but the tarff times and rates can be changed to what ever is required. You can add as many inject nodes as required.

Documentation is in the flow. I have scubbed my home assistant instance using scubber from node-red-contrib-home-assistant-websocket. you may have to add your home assistant id back into the home assistant nodes :slight_smile:

[{"id":"e73d6a5ae7ac9caa","type":"tab","label":"Electric","disabled":false,"info":"","env":[]},{"id":"f3a5f57f72444f53","type":"api-call-service","z":"e73d6a5ae7ac9caa","name":"Rate Name","server":"","version":5,"debugenabled":false,"domain":"select","service":"select_option","areaId":[],"deviceId":[],"entityId":["select.electric_monthly"],"data":"{\"option\":payload}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":370,"y":260,"wires":[["256e5387f6b6ff4b"]],"info":"Change tariff to match triggered rate supported by the utility meter."},{"id":"cc787d00065f71e1","type":"inject","z":"e73d6a5ae7ac9caa","name":"Off-peak Electric","props":[{"p":"payload"},{"p":"rate","v":"0.05","vt":"num"}],"repeat":"","crontab":"30 00 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"Off_Peak","payloadType":"str","x":150,"y":220,"wires":[["f3a5f57f72444f53"]],"info":" * msg.payload  = tariff name\n * msg.rate     = tariff rate"},{"id":"faeaae79adeb4558","type":"inject","z":"e73d6a5ae7ac9caa","name":"Peak Electric ","props":[{"p":"payload"},{"p":"rate","v":"0.1564","vt":"num"}],"repeat":"","crontab":"31 04 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"Peak","payloadType":"str","x":140,"y":300,"wires":[["f3a5f57f72444f53"]],"info":" * msg.payload  = tariff name\n * msg.rate     = tariff rate"},{"id":"256e5387f6b6ff4b","type":"ha-entity","z":"e73d6a5ae7ac9caa","name":"Rate","server":"","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"electric_rate"},{"property":"device_class","value":"monetary"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"£/kWh"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"rate","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"","outputPayloadType":"str","x":510,"y":260,"wires":[[]],"info":"Create new sensor for Energy management dashboard"},{"id":"020cde0d99f6cc1e","type":"comment","z":"e73d6a5ae7ac9caa","name":"Info (click me)","info":"This flow will provide the automation for the\nUtility Meter integration\n\nhttps://www.home-assistant.io/integrations/utility_meter/\n\nIt wilso create the sensor required for tracking costs on the energy dashboard\n\nhttps://www.home-assistant.io/docs/energy/electricity-grid/\n\nParameters required :-\n\n\nConfigure (copy) inject nodes to match start times for each energy tariff\n\nChange the msg.payload  in the inject node to match tariff name for Utility Meter integration \n\nchange msg.rate in the inject node to match the tariff rate for the energy dashboard\n\nChange the entity name in the rate name  node to match the Utility Meter integration tariff name\n\nThe rate node will create and update the following sensor for use in the energy dashboard\n\nsensor.electric_rate ","x":210,"y":80,"wires":[]}]

Thanks for sharing.

I’ve created something similar, but using Bigtimer instead due to a more complex price with Day, Peak, Night, and a “EV” rate.

I used bigtimer instead of the simple inject as the day period stops, the peak starts, then day resumes; same happens with night, being stopped, EV starts, then night resumes.

If anyone needs something like this for a more complex scenario I can share.

Hello, I’m interested on your integration because I have several times with diferent rates. Could you share it with me?

Thanks in advance

node red flow in original post ?

I have different times on diferent days. I’m testing the node-red of first post but when I apply the sensor.electric_rate to calculate costs I obtain on the energy tab the error that the measurement unity is not like EUR/Kwh