mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 17:27:19 +00:00
Add new cookbook entry
This commit is contained in:
parent
0bf424eecd
commit
a039a671d2
@ -0,0 +1,97 @@
|
|||||||
|
---
|
||||||
|
layout: page
|
||||||
|
title: "Restart Home Assistant if Wemo Switch is not detected"
|
||||||
|
description: "Restart Home Assistant if Wemo Switch is not detected."
|
||||||
|
date: 2016-01-29 08:00
|
||||||
|
sidebar: false
|
||||||
|
comments: false
|
||||||
|
sharing: true
|
||||||
|
footer: true
|
||||||
|
---
|
||||||
|
|
||||||
|
### {% linkable_title Restart Home Assistant %}
|
||||||
|
|
||||||
|
This configuration example is restarting Home Assistant if a [WeMo](/components/switch.wemo/) switch is not detected. An additional MQTT switch is present for stopping Home Assistant and can be triggered by [IFTTT](/components/ifttt/). The running batch script will automatically restart Home Assistant if the process isn't found anymore.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
mqtt:
|
||||||
|
broker: 127.0.0.1
|
||||||
|
port: 1883
|
||||||
|
client_id: home-assistant-1
|
||||||
|
keepalive: 60
|
||||||
|
|
||||||
|
device_tracker:
|
||||||
|
- platform: nmap_tracker
|
||||||
|
hosts: 192.168.0.1-255
|
||||||
|
home_interval: 1
|
||||||
|
interval_seconds: 30
|
||||||
|
consider_home: 900
|
||||||
|
|
||||||
|
ifttt:
|
||||||
|
key: ***
|
||||||
|
|
||||||
|
notify:
|
||||||
|
- platform: pushbullet
|
||||||
|
api_key: ***
|
||||||
|
name: pushbullet
|
||||||
|
|
||||||
|
switch:
|
||||||
|
- platform: wemo
|
||||||
|
- platform: mqtt
|
||||||
|
state_topic: "home/killhass"
|
||||||
|
command_topic: "home/killhass"
|
||||||
|
name: "KillHass"
|
||||||
|
qos: 0
|
||||||
|
payload_on: "ON"
|
||||||
|
payload_of: "OFF"
|
||||||
|
optimistic: false
|
||||||
|
|
||||||
|
script:
|
||||||
|
restarthawemo:
|
||||||
|
alias: "Restart HA if WeMo isn't found after 15 minutes"
|
||||||
|
sequence:
|
||||||
|
- delay:
|
||||||
|
minutes: 15
|
||||||
|
- execute_service: notify.pushbullet
|
||||||
|
service_data:
|
||||||
|
message: 'WeMo not found, restarting HA'
|
||||||
|
- execute_service: switch.turn_on
|
||||||
|
service_data:
|
||||||
|
entity_id: switch.killhass
|
||||||
|
|
||||||
|
automation:
|
||||||
|
- alias: "Restart HA if WeMo switch isn't found after 15 minutes"
|
||||||
|
trigger:
|
||||||
|
platform: state
|
||||||
|
entity_id: device_tracker.wemo
|
||||||
|
from: 'not_home'
|
||||||
|
to: 'home'
|
||||||
|
condition:
|
||||||
|
- platform: template
|
||||||
|
value_template: {% raw %}'{% if states.switch.wemo %}false{% else %}true{% endif %}'{% endraw %}
|
||||||
|
- platform: state
|
||||||
|
entity_id: script.restarthawemo
|
||||||
|
state: 'off'
|
||||||
|
action:
|
||||||
|
service: homeassistant.turn_on
|
||||||
|
entity_id: script.restarthawemo
|
||||||
|
- alias: 'Stop HA'
|
||||||
|
trigger:
|
||||||
|
- platform: state
|
||||||
|
entity_id: switch.KillHass
|
||||||
|
state: 'on'
|
||||||
|
action:
|
||||||
|
service: homeassistant.stop
|
||||||
|
- alias: 'Stop restarting HA is WeMo is found'
|
||||||
|
trigger:
|
||||||
|
platform: template
|
||||||
|
value_template: {% raw %}'{% if states.switch.wemo %}true{% else %}false{% endif %}'{% endraw %}
|
||||||
|
condition:
|
||||||
|
platform: state
|
||||||
|
entity_id: script.restarthawemo
|
||||||
|
state: 'on'
|
||||||
|
action:
|
||||||
|
service: homeassistant.turn_off
|
||||||
|
entity_id: script.restarthawemo
|
||||||
|
```
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user