Oczyszczacz Xiaomi Mi Air Purifier i sterowanie zewnętrznym przyciskiem

Oczyszczacz Xiaomi Mi Air Purifier i sterowanie zewnętrznym przyciskiem

Został mi trzeci przycisk Xiaomi Mijia Aqara Zgibee i tak sobie pomyślałem, ze jest rzecz która mnie zawsze wkurza wieczorem przed spaniem... oczyszczanie powietrza - zawsze muszę odpalić HA lub Mi Home aby nim sterować lub odzywać się do głośnika. 

A w sypialni jak już zasypiamy nie jest to najlepszym pomysłem. No to pomyślałem, ze wykorzystam to co już mam do uproszczenia sobie tej zabawy! 

Na początku muszę poinformować, że urządzenie łączyłem z Home Assistant - Zigbee2mqtt (CC2531) a więc nie wykorzystywałem bramki od Xiaomi (Aqara) - jednak bez problemu jest to możliwe do zrobienia na niej również. Najlepszą cenę na te przyciski znajdziesz u nas na blogu w dziale Promocje

Co wymyśliłem?

Połączyłem

  • sonoff mini - światło top
  • sonoff basic - światła przy łóżku
  • shelly - przedpokój
  • gniazdko - lampka
  • oczyszczacz - Mi Air (skrypt + silent mode)
  • sterowanie temperaturą w pokojach
  • przyciszanie JBL w sypialni

Clean Air uruchamia na 13 minut favorite na 10 i blokuje automatyzacje aby oczyszcić powietrze przed spaniem.

Kod wygląda następująco

[
    {
        "id": "49027664.d80858",
        "type": "server-state-changed",
        "z": "e47906ea.f77ce8",
        "name": "Badroom Button SINGLE",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "sensor.0x00158d000403e1e1_click",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "single",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "x": 150,
        "y": 1120,
        "wires": [
            [
                "1922c940.0db857"
            ],
            []
        ]
    },
    {
        "id": "a219e972.c42e38",
        "type": "server-state-changed",
        "z": "e47906ea.f77ce8",
        "name": "Badroom Button TRIPLE",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "sensor.0x00158d000403e1e1_click",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "triple",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "x": 150,
        "y": 1000,
        "wires": [
            [
                "7373dd84.78f684"
            ],
            []
        ]
    },
    {
        "id": "fd885a2d.29d8d8",
        "type": "server-state-changed",
        "z": "e47906ea.f77ce8",
        "name": "Badroom Button DOUBLE",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "sensor.0x00158d000403e1e1_click",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "double",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "x": 150,
        "y": 1060,
        "wires": [
            [
                "4d66637a.85b13c"
            ],
            []
        ]
    },
    {
        "id": "f167a95d.fb0438",
        "type": "server-state-changed",
        "z": "e47906ea.f77ce8",
        "name": "Badroom Button LONG",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "sensor.0x00158d000403e1e1_click",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "long",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "x": 140,
        "y": 880,
        "wires": [
            [
                "d8cafa8f.2c4b88",
                "dc726126.cf07a",
                "d5f76a86.98d068",
                "ffe3d29f.b35b2",
                "fd5ee732.8f6a58",
                "ca6ccc3d.a53e"
            ],
            []
        ]
    },
    {
        "id": "dc038ba1.fcf9a8",
        "type": "server-state-changed",
        "z": "e47906ea.f77ce8",
        "name": "Badroom Button quadruple",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "sensor.0x00158d000403e1e1_click",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "quadruple",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "x": 150,
        "y": 940,
        "wires": [
            [
                "c7692da4.d1a9b"
            ],
            []
        ]
    },
    {
        "id": "c7692da4.d1a9b",
        "type": "api-call-service",
        "z": "e47906ea.f77ce8",
        "name": "Clean Air",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "debugenabled": false,
        "service_domain": "script",
        "service": "turn_on",
        "entityId": "script.clean_air",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 460,
        "y": 940,
        "wires": [
            []
        ]
    },
    {
        "id": "d8cafa8f.2c4b88",
        "type": "api-call-service",
        "z": "e47906ea.f77ce8",
        "name": "Fan set silent",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "debugenabled": false,
        "service_domain": "fan",
        "service": "set_speed",
        "entityId": "fan.xiaomi_miio_device",
        "data": "{\"speed\":\"silent\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 450,
        "y": 780,
        "wires": [
            []
        ]
    },
    {
        "id": "dc726126.cf07a",
        "type": "api-call-service",
        "z": "e47906ea.f77ce8",
        "name": "Hallway Light Off",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_off",
        "entityId": "switch.shelly_shsw_1_59e9b3",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 730,
        "y": 900,
        "wires": [
            []
        ]
    },
    {
        "id": "1922c940.0db857",
        "type": "api-call-service",
        "z": "e47906ea.f77ce8",
        "name": "JBL Vol down",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "debugenabled": false,
        "service_domain": "media_player",
        "service": "volume_down",
        "entityId": "media_player.jbl_mobile",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 480,
        "y": 1140,
        "wires": [
            []
        ]
    },
    {
        "id": "ffe3d29f.b35b2",
        "type": "api-call-service",
        "z": "e47906ea.f77ce8",
        "name": "Light Off",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_off",
        "entityId": "switch.sonoff_100059c494",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 760,
        "y": 1080,
        "wires": [
            []
        ]
    },
    {
        "id": "4d66637a.85b13c",
        "type": "api-current-state",
        "z": "e47906ea.f77ce8",
        "name": "Greg light on?",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "override_topic": false,
        "entity_id": "switch.sonoff_100059c494",
        "state_type": "str",
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "blockInputOverrides": false,
        "x": 540,
        "y": 1080,
        "wires": [
            [
                "ffe3d29f.b35b2"
            ],
            [
                "1664544d.2b0e7c"
            ]
        ]
    },
    {
        "id": "7373dd84.78f684",
        "type": "api-current-state",
        "z": "e47906ea.f77ce8",
        "name": "Kate light on?",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "override_topic": false,
        "entity_id": "switch.sonoff_10008c937e",
        "state_type": "str",
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "blockInputOverrides": false,
        "x": 540,
        "y": 1000,
        "wires": [
            [
                "d5f76a86.98d068"
            ],
            [
                "e5b39fb7.66c91"
            ]
        ]
    },
    {
        "id": "e5b39fb7.66c91",
        "type": "api-call-service",
        "z": "e47906ea.f77ce8",
        "name": "Light On",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_on",
        "entityId": "switch.sonoff_10008c937e",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 760,
        "y": 1020,
        "wires": [
            [
                "9e27694d.0a0788"
            ]
        ]
    },
    {
        "id": "d5f76a86.98d068",
        "type": "api-call-service",
        "z": "e47906ea.f77ce8",
        "name": "Light Off",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_off",
        "entityId": "switch.sonoff_10008c937e",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 760,
        "y": 960,
        "wires": [
            []
        ]
    },
    {
        "id": "1664544d.2b0e7c",
        "type": "api-call-service",
        "z": "e47906ea.f77ce8",
        "name": "Light On",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_on",
        "entityId": "switch.sonoff_100059c494",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 760,
        "y": 1140,
        "wires": [
            [
                "9e27694d.0a0788"
            ]
        ]
    },
    {
        "id": "fd5ee732.8f6a58",
        "type": "api-call-service",
        "z": "e47906ea.f77ce8",
        "name": "Heating Living 12",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "debugenabled": false,
        "service_domain": "climate",
        "service": "set_temperature",
        "entityId": "climate.living_room",
        "data": "{\"temperature\":12,\"hvac_mode\":\"heat\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 790,
        "y": 780,
        "wires": [
            []
        ]
    },
    {
        "id": "ca6ccc3d.a53e",
        "type": "api-call-service",
        "z": "e47906ea.f77ce8",
        "name": "Heating Office 12",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "debugenabled": false,
        "service_domain": "climate",
        "service": "set_temperature",
        "entityId": "climate.office",
        "data": "{\"temperature\":12,\"hvac_mode\":\"heat\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 790,
        "y": 840,
        "wires": [
            []
        ]
    },
    {
        "id": "9e27694d.0a0788",
        "type": "api-call-service",
        "z": "e47906ea.f77ce8",
        "name": "Top Off",
        "server": "b3e9b226.7fd0c",
        "version": 1,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_off",
        "entityId": "switch.sonoff_100059c494",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 960,
        "y": 1040,
        "wires": [
            []
        ]
    },
    {
        "id": "b3e9b226.7fd0c",
        "type": "server",
        "z": "",
        "name": "Home Assistant"
    }
]

Podsumowanie

Możliwości jakie odkrywam z tymi przyciskami, powodują, że chcę ich zamówić tylko więcej a skoro kosztują ok. 20 zł za sztukę to aż wstyd nie brać! Najlepszą cenę na te przyciski znajdziesz u nas na blogu w dziale Promocje


Chcesz wiedzieć więcej? Dołącz do naszej grupy na FB - będzie nam też miło jak polubisz nasz Fanpage!