Z racji, że teraz elektronika niewiele kosztuje, a ja coraz bardzie leniwy sie staję,
postanowiłem się nie wysilać i popełniłem taki mały sterownik do KEGa
Może ktoś będzie miał ochotę i coś pomoże, teraz moda na inteligentne domy.
To czemu tego nie wykorzystać. W dodatku niektórzy słabo lutują.
Wykorzystałem do tego Home Assistanta + ESPHome + Node Red do automatyki.
Można taką zabawkę zrobić np.: na malinie ja akurat mam serwer wirtualny.
Kto wie czy by tego nie zrobić na serwerach w chmurze... ja mam akurat hassio.
Nie jest to wersja finalna i błędy zapewne są, ale jest działająca.
Mam zamia dodać notyfikację (głośnik / komunikator) i parę drobiazgów.
Zrobiłem to na Sonoff 4CH R2 Wifi, ale gniazdka Wifi chyba byłyby lepsze do tego.
Zaworów do sterowania nie mam, ale może coś pomyślę.
Klawisz L1 - start procesu
Klawisze L2,L3,L4 - stop procesu
Ponizej 70sC start 3 grzałki
Powyżej 70sC grzałka 2 i 3 off, pompy on
Powyżej 95sC stop procesu
ESPHome - https://esphome.io/devices/sonoff_4ch.html
Kod: Zaznacz cały
esphome:
name: keg
platform: ESP8266
board: esp01_1m
wifi:
ssid: "SSID"
password: "PASSWORD"
## Jeśli Hassio jest w innej sieci, nie działają multicasty itp.
# manual_ip:
# static_ip: IP
# gateway: IP
# subnet: MASK
# dns1: IP
# dns2: IP
logger:
api:
password: "PASSWORD"
ota:
password: "PASSWORD"
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "L1 - Start"
- platform: gpio
pin:
number: GPIO9
mode: INPUT_PULLUP
inverted: True
name: "L2 - STOP"
- platform: gpio
pin:
number: GPIO10
mode: INPUT_PULLUP
inverted: True
name: "L3"
- platform: gpio
pin:
number: GPIO14
mode: INPUT_PULLUP
inverted: True
name: "L4"
switch:
- platform: gpio
id: heater1
name: "L1-Grzałka 1"
pin: GPIO12
- platform: gpio
id: heater2
name: "L2-Grzałka 2"
pin: GPIO5
- platform: gpio
id: heater3
name: "L3-Grzałka 3"
pin: GPIO4
- platform: gpio
id: pump
name: "L4-Pompa"
pin: GPIO15
dallas:
- pin: GPIO02
update_interval: 5s
sensor:
- platform: dallas
address: 0x06031297793C8828
id: head
name: "Głowica"
- platform: dallas
address: 0xBE031697793E8828
id: column
name: "Kolumna"
- platform: dallas
address: 0xE6011449BB51AA29
id: cooler
name: "Cooler"
- platform: dallas
address: 0xE6011449BB51AA28
id: keg
name: "KEG"
web_server:
port: 80
auth:
username: admin
password: PASSWORD
Node red
Kod: Zaznacz cały
[{"id":"c73367e2.3e24d8","type":"comment","z":"e763ce76.5d5b5","name":"KEG - Sonoff 4CH R2 Wifi (ESPHome)","info":"https://a.allegroimg.com/s512/11588e/26d007f441638a6482df61110687/Sonoff-4CH-R2-4-Kanalowy-Smart-Przelacznik-WIFI\n\nKlawisz L1 - start procesu\nKlawisze L2,L3,L4 - stop procesu\n\nPonizej 70sC start 3 grzałki \nPowyżej 70sC grzałka 2 i 3 off, pompy on\nPowyżej 95sC stop procesu","x":190,"y":40,"wires":[]},{"id":"60a5f869.41f1a8","type":"api-call-service","z":"e763ce76.5d5b5","name":"Grzałka L2 ON","server":"b5de8f9d.30275","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.l2_grzalka_2","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":740,"y":140,"wires":[[]]},{"id":"6e1d41e3.b12af","type":"api-call-service","z":"e763ce76.5d5b5","name":"Grzałka L1 ON","server":"b5de8f9d.30275","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.l1_grzalka_1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":740,"y":80,"wires":[["cdccfd26.947bf"]]},{"id":"77ec87a6.2a34f8","type":"api-call-service","z":"e763ce76.5d5b5","name":"Grzałka L3 ON","server":"b5de8f9d.30275","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.l3_grzalka_3","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":740,"y":200,"wires":[[]]},{"id":"13a2f6e5.972459","type":"api-call-service","z":"e763ce76.5d5b5","name":"Grzałka L2 OFF","server":"b5de8f9d.30275","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.l2_grzalka_2","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":740,"y":520,"wires":[[]]},{"id":"75e1c0ad.8be8c","type":"api-call-service","z":"e763ce76.5d5b5","name":"Grzałka L1 OFF","server":"b5de8f9d.30275","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.l1_grzalka_1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":740,"y":460,"wires":[[]]},{"id":"b65e6db.426169","type":"api-call-service","z":"e763ce76.5d5b5","name":"Grzałka L3 OFF","server":"b5de8f9d.30275","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.l3_grzalka_3","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":740,"y":580,"wires":[[]]},{"id":"ce1f790f.780508","type":"api-call-service","z":"e763ce76.5d5b5","name":"Pompa zew. ON","server":"b5de8f9d.30275","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.pompa","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":740,"y":340,"wires":[[]]},{"id":"ef33becf.2ed8b","type":"server-state-changed","z":"e763ce76.5d5b5","name":"L1 Start","server":"b5de8f9d.30275","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.l1_start","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":90,"y":100,"wires":[["715ed1c2.06ea9","3fccabd9.eaf0a4"],[]]},{"id":"559d549e.15e7fc","type":"server-state-changed","z":"e763ce76.5d5b5","name":"L2 STOP","server":"b5de8f9d.30275","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.l2_stop","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":100,"y":580,"wires":[["a1da2569.98ed58"],[]]},{"id":"715ed1c2.06ea9","type":"api-current-state","z":"e763ce76.5d5b5","name":"KEG <= 70 sC","server":"b5de8f9d.30275","version":1,"outputs":2,"halt_if":"70","halt_if_type":"num","halt_if_compare":"lte","override_topic":false,"entity_id":"sensor.keg","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":320,"y":160,"wires":[["c95e9b18.4ddaf8"],[]]},{"id":"c95e9b18.4ddaf8","type":"change","z":"e763ce76.5d5b5","name":"=ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":140,"wires":[["6e1d41e3.b12af","60a5f869.41f1a8","77ec87a6.2a34f8"]]},{"id":"a1da2569.98ed58","type":"change","z":"e763ce76.5d5b5","name":"=ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":580,"wires":[["75e1c0ad.8be8c","13a2f6e5.972459","b65e6db.426169","374aa3e8.397e5c","15c275d0.8ab09a"]]},{"id":"41ee90f3.8a06f","type":"poll-state","z":"e763ce76.5d5b5","name":"KEG > 95 sC","server":"b5de8f9d.30275","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"10","updateIntervalUnits":"seconds","outputinitially":true,"outputonchanged":false,"entity_id":"sensor.keg","state_type":"num","halt_if":"95","halt_if_type":"num","halt_if_compare":"gt","outputs":2,"x":110,"y":460,"wires":[["a1da2569.98ed58"],[]]},{"id":"f1ad301a.d098d","type":"change","z":"e763ce76.5d5b5","name":"=ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":460,"wires":[["b65e6db.426169","13a2f6e5.972459","ce1f790f.780508","980d48a6.78a448"]]},{"id":"48299d4a.b1ec84","type":"poll-state","z":"e763ce76.5d5b5","name":"KEG > 70 sC","server":"b5de8f9d.30275","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"5","updateIntervalUnits":"seconds","outputinitially":true,"outputonchanged":false,"entity_id":"sensor.keg","state_type":"num","halt_if":"70","halt_if_type":"num","halt_if_compare":"gt","outputs":2,"x":110,"y":400,"wires":[["cdccfd26.947bf"],[]]},{"id":"374aa3e8.397e5c","type":"api-call-service","z":"e763ce76.5d5b5","name":"Pompa zew. OFF","server":"b5de8f9d.30275","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.pompa","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":750,"y":720,"wires":[[]]},{"id":"a52afb1.3c06b08","type":"poll-state","z":"e763ce76.5d5b5","name":"Chłodziwo > 60 sC","server":"b5de8f9d.30275","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"10","updateIntervalUnits":"seconds","outputinitially":true,"outputonchanged":false,"entity_id":"sensor.chlodzenie","state_type":"num","halt_if":"60","halt_if_type":"num","halt_if_compare":"gt","outputs":2,"x":130,"y":520,"wires":[["a1da2569.98ed58"],[]]},{"id":"b196294c.0bce08","type":"server-state-changed","z":"e763ce76.5d5b5","name":"L3 STOP","server":"b5de8f9d.30275","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.l3","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":100,"y":640,"wires":[["a1da2569.98ed58"],[]]},{"id":"4bd87711.f292c8","type":"server-state-changed","z":"e763ce76.5d5b5","name":"L4 STOP","server":"b5de8f9d.30275","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.l4","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":100,"y":700,"wires":[["a1da2569.98ed58"],[]]},{"id":"3fccabd9.eaf0a4","type":"api-current-state","z":"e763ce76.5d5b5","name":"KEG > 70 sC","server":"b5de8f9d.30275","version":1,"outputs":2,"halt_if":"70","halt_if_type":"num","halt_if_compare":"gt","override_topic":false,"entity_id":"sensor.keg","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":310,"y":80,"wires":[["3564b69e.114a5a"],[]]},{"id":"3564b69e.114a5a","type":"change","z":"e763ce76.5d5b5","name":"=ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":80,"wires":[["6e1d41e3.b12af"]]},{"id":"980d48a6.78a448","type":"api-call-service","z":"e763ce76.5d5b5","name":"Pompa L4 ON","server":"b5de8f9d.30275","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.l4_pompa","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":740,"y":280,"wires":[[]]},{"id":"15c275d0.8ab09a","type":"api-call-service","z":"e763ce76.5d5b5","name":"Pompa L4 OFF","server":"b5de8f9d.30275","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.l4_pompa","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":740,"y":660,"wires":[[]]},{"id":"fc79239d.8947d","type":"function","z":"e763ce76.5d5b5","name":"Porównaj wartość i stan","func":"newmsg = {};\nif (msg.payload[0]>=70 && msg.payload[1]==on) {\n newmsg.payload = \"turn_on\";\n} else {\n newmsg.payload = \"turn_off\";\n}\nreturn newmsg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":410,"y":380,"wires":[["f1ad301a.d098d"]]},{"id":"4d945611.954698","type":"debug","z":"e763ce76.5d5b5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":400,"wires":[]},{"id":"cdccfd26.947bf","type":"join","z":"e763ce76.5d5b5","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":350,"y":320,"wires":[["fc79239d.8947d","4d945611.954698"]]},{"id":"b5de8f9d.30275","type":"server","z":"","name":"Home Assistant","addon":true}]