Zasada jest prosta, jak jest cleaning przez 5 min to zapisujemy sobie w global że odkurzacz pracował,
rano jak mam komunikat poranny to jeżeli odkurzacz ma status że pracował to jedzie do kosza, jak opróżnię i odeślę go do bazy to zmienia się status że odkurzacz nie pracował.
Możecie sobie dać injecta rano z godziną, żeby o konkretnej pojechał.
Status czy pracował wykorzystuje również w automatyzacjach, np. jak nikogo nie ma w domu to ma odkurzać, ale jak pracował dzisiaj to nie odkurzaj ponownie.
[{"id":"ad6c8366.80498","type":"server-state-changed","z":"6f5c3793.8d3fb8","name":"","server":"4d0e02c9.2307bc","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"vacuum.roborock_vacuum_s5","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"‘cleaning’","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"5","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":230,"y":1800,"wires":[["6740c7c7.7f8998"],[]]},{"id":"6740c7c7.7f8998","type":"change","z":"6f5c3793.8d3fb8","name":"Czy pracował - true","rules":[{"t":"set","p":"odkurzacz_pracowal","pt":"global","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":1810,"wires":[[]]},{"id":"b7546b78.5991a8","type":"comment","z":"6f5c3793.8d3fb8","name":"Jak pracował to true","info":"","x":150,"y":1750,"wires":[]},{"id":"5f86dc7d.0f5514","type":"change","z":"6f5c3793.8d3fb8","name":"Czy pracował - false","rules":[{"t":"set","p":"odkurzacz_pracowal","pt":"global","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":1850,"wires":[[]]},{"id":"1806b20d.f826fe","type":"inject","z":"6f5c3793.8d3fb8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":340,"y":1850,"wires":[["5f86dc7d.0f5514"]]},{"id":"8bd38500.e1a338","type":"inject","z":"6f5c3793.8d3fb8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":350,"y":1750,"wires":[["6740c7c7.7f8998"]]},{"id":"1deb2cce.92b223","type":"link in","z":"6f5c3793.8d3fb8","name":"","links":["28e4c59e.a987ea"],"x":95,"y":1680,"wires":[["91b11f3e.5eda1"]]},{"id":"91b11f3e.5eda1","type":"switch","z":"6f5c3793.8d3fb8","name":"Czy pracował?","property":"odkurzacz_pracowal","propertyType":"global","rules":[{"t":"eq","v":"true","vt":"str"},{"t":"neq","v":"true","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":240,"y":1680,"wires":[["ab2b8ef6.d7ece"],[]]},{"id":"ab2b8ef6.d7ece","type":"function","z":"6f5c3793.8d3fb8","name":"Kosz","func":"msg.payload=\n{\n \"data\":\n {\n \"entity_id\": \"vacuum.xiaomi_vacuum_cleaner\",\n \"x_coord\": \"16500\",\n \"y_coord\": \"32500\"\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":1680,"wires":[["8092a722.afd9c8"]]},{"id":"8092a722.afd9c8","type":"api-call-service","z":"6f5c3793.8d3fb8","name":"","server":"4d0e02c9.2307bc","version":3,"debugenabled":false,"service_domain":"xiaomi_miio","service":"vacuum_goto","entityId":"vacuum.roborock_vacuum_s5","data":"","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":1680,"wires":[["2001445f.2b16cc"]]},{"id":"4cd558cf.8bf468","type":"change","z":"6f5c3793.8d3fb8","name":"Czy pracował - false","rules":[{"t":"set","p":"odkurzacz_pracowal","pt":"global","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":1680,"wires":[[]]},{"id":"43f19720.282be8","type":"ha-wait-until","z":"6f5c3793.8d3fb8","name":"Czekaj az bedzie docked","server":"4d0e02c9.2307bc","version":0,"outputs":1,"entityId":"vacuum.roborock_vacuum_s5","entityIdFilterType":"exact","property":"state","comparator":"is","value":"‘docked’","valueType":"str","timeout":"","timeoutType":"num","timeoutUnits":"hours","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":1030,"y":1680,"wires":[["4cd558cf.8bf468"]]},{"id":"2001445f.2b16cc","type":"delay","z":"6f5c3793.8d3fb8","name":"","pauseType":"delay","timeout":"60","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":830,"y":1680,"wires":[["43f19720.282be8"]]},{"id":"02dba79974400bf1","type":"comment","z":"6f5c3793.8d3fb8","name":"Jak poranny komunikat to jedź do kosza","info":"","x":210,"y":1620,"wires":[]},{"id":"4d0e02c9.2307bc","type":"server","name":"Asystent domowy","version":1,"legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]