2024年11月24日星期日 下午8:09:40

ping binary-sensor aqara hun M1S

2 年 前
#16538 引用
Track Home/Away Status for Your Household Using Their Smart Phones and Home Assistant


https://www.home-assistant.io/integrations/ping/#binary-sensor
0
2 年 前
#16539 引用
https://smarthomepursuits.com/how-to-monitor-devices-in-home-assistant/


step 0; add ping integration to ha

menu path:http://192.168.2.50:38123/config/integrations

output

This device can not be added from the UI
You can add this device by adding it to your 'configuration.yaml'. See the documentation for more information.


step 0.5 : stattic ip address bind

0
2 年 前
#16540 引用
Step 1: Add PING to Home Assistant

configuration.yaml


binary_sensor:
  - platform: ping
    host: 192.168.101.37
    name: m1s-ping
    count: 2
    scan_interval: 30


If you are adding multiple devices, then it would look like this:

binary_sensor:
  - platform: ping
    host: 192.168.68.1
    name: Router
    count: 8
    scan_interval: 30
  - platform: ping
    host: 192.168.68.137
    name: Danny-Server
    count: 8
    scan_interval: 30
  - platform: ping
    host: 192.168.68.141
    name: Danny-Docker
    count: 8
    scan_interval: 30







binary_sensor:
  - platform: ping
    host: 192.168.2.103
    name: m1s-ping
    count: 2
    scan_interval: 30
  - platform: ping
    host: 192.168.101.2
    name: mi home hub-ping
    count: 2
    scan_interval: 30

  - platform: ping
    host: 192.168.101.21
    name: Yeelight-C2001-celing26-ping
    count: 2
    scan_interval: 30

0
2 年 前
#16541 引用
1
0
2 年 前
#16542 引用
Step 2: display the status in a Lovelace card


Add  a Lovelace card




type: entities
entities:
  - entity: zone.bei_office
  - entity: device_tracker.device_name_iphone12
  - entity: device_tracker.device_name_s21
  - entity: input_select.input_select_husband_status_dropdown
  - entity: device_tracker.devicename
  - entity: binary_sensor.m1s_ping




changed

.storage/lovelace.new_dashboard

  
   {
              "type": "entities",
              "entities": [
                {
                  "entity": "binary_sensor.m1s_ping"
                },
                {
                  "entity": "binary_sensor.mi_home_hub_ping"
                },
                {
                  "entity": "binary_sensor.yeelight_c2001_celing26_ping"
                }
              ],
              "title": "Devices Wifi online or not with ping"
            }
0
2 年 前
#16543 引用
1
0
2 年 前
#16544 引用
display the status in a Lovelace card
0
2 年 前
#16545 引用
Step 3: Create Automation To Alert When Device Is Offline

The next step is pretty easy and highly customizable. You can make use of standard notifications or even actionable notifications (i.e. – display a button to “Open Portainer” so you can restart Docker, for example)

Create a new automation with the following values:

Triggers:

Trigger Type: State
Entity: choose a binary sensor entity
To: off
Actions:

Action Type: Call service
Service: notify.mobile_app_pixel_5_danny
Message: Your docker host has went offline
Title: Danny-Docker went offline!
alias: Notify When Danny-Docker Goes Offline
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.danny_docker
    from: 'on'
    to: 'off'
condition: []
action:
  - service: notify.mobile_app_pixel_5_danny
    data:
      title: Danny-Docker went offline!
      message: Your host host has went offline.
mode: single
0