Skip to content

Example automation

Dmitry Mamontov edited this page Jun 29, 2022 · 4 revisions

Device blocking

Adding automation:

- alias: MiWifi response
  mode: queued
  trigger:
    - platform: device
      device_id: ... # Device ID (It is the router)
      domain: miwifi
      type: response
  condition:
  - condition: template
    value_template: >
      {{ trigger.event.data.uri == "xqsystem/set_mac_filter" }}
  action:
    - service: persistent_notification.create
      data:
        message: "MiWifi Response"
        title: "{{ trigger.event.data }}"

To block the device, you will need to call the service:

service: miwifi.request
target:
  device_id: ... # Device ID (It is the router)
data:
  uri: xqsystem/set_mac_filter
  body:
    mac: 00:00:00:00:00:00 # MAC address of the device we are blocking
    wan: 0 # 0 - block, 1 - unblock

After completing the steps, you will receive an alert containing the response to your API request.

Lighting automation

Adding automation:

- alias: Turning off the light in the hall
  mode: single
  trigger:
    - platform: state
      entity_id: device_tracker.miwifi_00_00_00_00_00_00
      to: "not_home" # "home" - "Connected", "not_home" - "Disconnected"
  action:
    - service: light.turn_off
      target:
        entity_id: light.light_in_the_hall
Clone this wiki locally