Блог

Flow for Aqara Cube+Mihub+HA+NodRed

В данной записи в блоге хочу поделиться с флоу в котором настроил действия смарт кубика Акары. Если настройки (event.action_type) действий кубика (shake_air, flip90, flip180, tap_twice, move, free_fall и есть ещё alert) более менее понятно, то именно для настройки действия (rotate) (event.action_value) крутить кубиком по часовой и против часовой стрелки требует более тонкой настройки. Например для увелечения звука/яркости/итп крутить кубиком вправо (по часовой стрелки)), для уменьшения звука/яркости/итп крутить кубиком влево (против часовой стрелки).

Хочу выразить отдельную благодарность Алексей Х (AlexxIT) за непосильную помощь.

В своё время долго гуглил чтоб найти хоть какую нибудь информацию, ничего внятного так и нешёл даже на забугорских форумах итп. Так что добавляйте флоу себе, редактируйте под свои нужды и пользуйтесь на здоровье.

[{"id":"b843efa6.f8365","type":"change","z":"e31cca22.b851b8","name":"set event","rules":[{"t":"set","p":"event","pt":"msg","to":"payload.event","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":300,"wires":[["5b40e984.0bfcb8","1d61c5b7.45089a"]]},{"id":"5b40e984.0bfcb8","type":"switch","z":"e31cca22.b851b8","name":"action_type","property":"event.action_type","propertyType":"msg","rules":[{"t":"eq","v":"shake_air","vt":"str"},{"t":"eq","v":"flip90","vt":"str"},{"t":"eq","v":"flip180","vt":"str"},{"t":"eq","v":"tap_twice","vt":"str"},{"t":"eq","v":"alert","vt":"str"},{"t":"eq","v":"move","vt":"str"},{"t":"eq","v":"free_fall","vt":"str"}],"checkall":"true","repair":false,"outputs":7,"x":510,"y":220,"wires":[["e3b6465c.72b628"],["cbbecfae.dd9cd"],["a912cb3b.f2c8c8"],["3f2afeea.fa17e2"],[],["ef04f0a7.f2587"],["74ed1cf0.3a8424"]]},{"id":"f30a5d9.58742a","type":"switch","z":"e31cca22.b851b8","name":"Кубик в зале","property":"payload.entity_id","propertyType":"msg","rules":[{"t":"eq","v":"binary_sensor.cube_158d0002a66cc9","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":230,"y":220,"wires":[["b843efa6.f8365"]]},{"id":"a787ad6a.61d7c","type":"api-call-service","z":"e31cca22.b851b8","name":"tv volume down","server":"e75690bb.bd546","version":1,"debugenabled":false,"service_domain":"script","service":"script_tv_volume_down","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":640,"y":420,"wires":[[]]},{"id":"a912cb3b.f2c8c8","type":"api-call-service","z":"e31cca22.b851b8","name":"tv channel down","server":"e75690bb.bd546","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"script.script_tv_channel_down","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":700,"y":200,"wires":[[]]},{"id":"3f2afeea.fa17e2","type":"api-call-service","z":"e31cca22.b851b8","name":"tv news","server":"e75690bb.bd546","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"script.script_tv_news","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":700,"y":260,"wires":[[]]},{"id":"1d61c5b7.45089a","type":"switch","z":"e31cca22.b851b8","name":"action_type","property":"event.action_type","propertyType":"msg","rules":[{"t":"eq","v":"rotate","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":130,"y":380,"wires":[["ebb052e1.82f7b"]]},{"id":"b3c49fe7.e375c","type":"api-call-service","z":"e31cca22.b851b8","name":"tv volume up","server":"e75690bb.bd546","version":1,"debugenabled":false,"service_domain":"script","service":"script_tv_volume_up","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":630,"y":360,"wires":[[]]},{"id":"12c53bf9.cba2e4","type":"change","z":"e31cca22.b851b8","name":"volume_level","rules":[{"t":"set","p":"payload","pt":"msg","to":"event.data.action_value","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":360,"wires":[["b3c49fe7.e375c"]]},{"id":"22a6e198.83090e","type":"server-events","z":"e31cca22.b851b8","name":"Cube","server":"e75690bb.bd546","event_type":"xiaomi_aqara.cube_action","x":70,"y":220,"wires":[["f30a5d9.58742a"]]},{"id":"ebb052e1.82f7b","type":"switch","z":"e31cca22.b851b8","name":"action_value","property":"event.action_value","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"str"},{"t":"lt","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":380,"wires":[["12c53bf9.cba2e4"],["3cde2f81.b08e4"]]},{"id":"3cde2f81.b08e4","type":"change","z":"e31cca22.b851b8","name":"volume_level","rules":[{"t":"set","p":"payload","pt":"msg","to":"event.data.action_value","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":420,"wires":[["a787ad6a.61d7c"]]},{"id":"74ed1cf0.3a8424","type":"api-call-service","z":"e31cca22.b851b8","name":"tv volume off","server":"e75690bb.bd546","version":1,"debugenabled":false,"service_domain":"script","service":"script_tv_volume_off","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":530,"y":300,"wires":[[]]},{"id":"ef04f0a7.f2587","type":"api-call-service","z":"e31cca22.b851b8","name":"turn_on_cartoons","server":"e75690bb.bd546","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"script.script_turn_on_cartoons_tv","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":730,"y":320,"wires":[[]]},{"id":"cbbecfae.dd9cd","type":"api-call-service","z":"e31cca22.b851b8","name":"tv next channel","server":"e75690bb.bd546","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"script.script_tv_channel_up","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":720,"y":140,"wires":[[]]},{"id":"e3b6465c.72b628","type":"api-call-service","z":"e31cca22.b851b8","name":"turn_off_my_tv","server":"e75690bb.bd546","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"script.script_turn_on_off_my_tv","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":640,"y":80,"wires":[["46684b32.0f8f34"]]},{"id":"e75690bb.bd546","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

1

для человеков лучше бы json отформатировали... ;)

не пойму, как в комментарии кусок кода вставить..



Вернуться назад
Вернуться назад