NodeRed: Precios PVPC. Calienta tu termo más barato.

NodeRed: Precios PVPC. Calienta tu termo más barato.

Entradas recientes

En el capítulo de hoy aprendemos como integrar los Precios Voluntario al Pequeño Consumidos (PVPC) de la energía eléctrica en NodeRed. Esto nos va a permitir gestionar nuestros consumos eléctricos y conseguir ahorros activando nuestros consumos en los momentos más baratos del día. Además aprendemos a utilizar más nodos de NodeRed como el nodo switch.

Aquí tenéis el código del flow del PVPC

[{"id":"69a0997.30e8468","type":"tab","label":"PVPC","disabled":false,"info":""},{"id":"1c4cbe9.ff63241","type":"api-current-state","z":"69a0997.30e8468","name":"","server":"17fa3252.a9c6ee","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.pvpc","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":390,"y":100,"wires":[["cbd8e2c7.84264","5e43934b.1dd45c"]]},{"id":"1c99b8a7.e871e7","type":"inject","z":"69a0997.30e8468","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"59 23 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":120,"wires":[["1c4cbe9.ff63241"]]},{"id":"cbd8e2c7.84264","type":"function","z":"69a0997.30e8468","name":"","func":"global.set(\"mejores_horas\",msg.data.attributes.next_best_at)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":670,"y":80,"wires":[[]]},{"id":"5e43934b.1dd45c","type":"debug","z":"69a0997.30e8468","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":660,"y":180,"wires":[]},{"id":"d99ae3d8.ce1ea","type":"function","z":"69a0997.30e8468","name":"Comprobacion Horas","func":"var fecha_actual = new Date();\nvar hora_actual = fecha_actual.getHours();\n\nmsg.payload = hora_actual;\n\nmejores_horas=global.get(\"mejores_horas\");\n\nenciendo_luz=false;\n\nfor(i=0; i<=msg.horas-1 ; i++){\n    if(hora_actual==mejores_horas[i]){\n        enciendo_luz=true;\n    }\n    \n}\nif(enciendo_luz){\n    msg.payload=\"turn_on\"\n}\nelse{\n    msg.payload=\"turn_off\"\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":380,"wires":[["c888c4b3.affee8","ee1f86dd.9999f8"]]},{"id":"48ae2c3e.6fd554","type":"inject","z":"69a0997.30e8468","d":true,"name":"Lavajillas","props":[{"p":"horas","v":"3","vt":"num"},{"p":"entidad","v":"switch.shelly_shplg_s_267df1","vt":"str"}],"repeat":"","crontab":"0 0-23 * * *","once":false,"onceDelay":0.1,"topic":"","x":130,"y":300,"wires":[["d99ae3d8.ce1ea"]]},{"id":"c888c4b3.affee8","type":"debug","z":"69a0997.30e8468","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":320,"wires":[]},{"id":"ee1f86dd.9999f8","type":"api-call-service","z":"69a0997.30e8468","name":"Manejo Elemento","server":"17fa3252.a9c6ee","version":1,"debugenabled":false,"service_domain":"switch","service":"{{payload}}","entityId":"{{entidad}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":610,"y":400,"wires":[[]]},{"id":"fec81300.1420c","type":"inject","z":"69a0997.30e8468","d":true,"name":"Rodillo","props":[{"p":"horas","v":"3","vt":"num"},{"p":"entidad","v":"switch.rodillo","vt":"str"}],"repeat":"","crontab":"0 0-23 * * *","once":false,"onceDelay":0.1,"topic":"","x":120,"y":380,"wires":[["d99ae3d8.ce1ea"]]},{"id":"17fa3252.a9c6ee","type":"server","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Aquí tenéis la lista de los componentes necesarios para montar tu propia instalación:

¡También te  pueden interesar estos otros vídeos!

Instala el software en la raspberry

Una introducción a NodeRed