Code Monkey home page Code Monkey logo

keeper's Introduction

Welcome to Keeper

License: MIT

Keeper is an open source service manager. Currently, monitors home assistant service and mqtt services. MQTT service is monitored by checking connections to the service and home assistant is monitored using an heartbeating mechanism. Through MQTT we exchange heartbeat messages with home assistant in order to determine if its running. Every 3 missed messages between Keeper and home assistant, Keeper will attempt to restart home assistant. Then, if after 3 restarts home assistant still not responding, the system is rebooted. In MQTT case, it's only performed a service restart every 3 missed connections

Table of Contents

Installation

systemd

curl -sSL https://raw.githubusercontent.com/nragon/keeper/master/setup/systemd/setup | bash

Hass.io

Follow instructions on how to install third party add-ons here. Use the following URL when required:

https://github.com/nragon/keeper/tree/master/setup/hassio

Configuration

You can find a set of properties in a json file inside config directory that can be tuned and configured according with you own settings

Configuration Definition
heartbeat.interval Interval between heartbeat message. This should match number of seconds in home assistant automation
heartbeat.delay Number of seconds we should wait before considering a miss heartbeat message
heartbeat.topic Heartbeat topic
ha.restart.command Command to restart home assistant service
system.restart.command Command to restart system
mqtt.broker MQTT broker ip
mqtt.port MQTT broker port
mqtt.user MQTT user used
mqtt.pass MQTT user password
mqtt.restart.command Command to restart MQTT service

Home Assistant

In home assistant side we should configure an automation capable o sending heartbeat messages to Keeper. The number of seconds and topic are different depending on Keeper configurations

- id: keeperheartbeat
  initial_state: "on"
  trigger:
    platform: time
    seconds: "/<numberofseconds>"
  action:
    service: mqtt.publish
    data:
      topic: "<heartbeattopic>"
      payload: "1"

Contributing

Pull requests and issues on github are welcome. Feel free to suggest any improvement.

Licensing

This project is licensed under the MIT License - see the LICENSE file for details

keeper's People

Contributors

nragon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

keeper's Issues

Unable to install into hass.io 0.99.3

Hello Nuno,

Upon trying to install into hass.io using your instructions, i.e. by adding the URL:

https://github.com/nragon/keeper/tree/master/setup/hassio

I am having the following error:

19-10-11 21:38:52 INFO (MainThread) [hassio.core] Hass.io is up and running 19-10-11 21:40:47 INFO (MainThread) [hassio.store.git] Clone add-on https://github.com/nragon/keeper/tree/master/setup/hassio repository 19-10-11 21:40:48 ERROR (MainThread) [hassio.store.git] Can't clone https://github.com/nragon/keeper/tree/master/setup/hassio repository: Cmd('git') failed due to: exit code(128) cmdline: git clone --depth=1 --recursive --shallow-submodules -v https://github.com/nragon/keeper/tree/master/setup/hassio /data/addons/git/625ce890 stderr: 'Cloning into '/data/addons/git/625ce890'... fatal: repository 'https://github.com/nragon/keeper/tree/master/setup/hassio/' not found '. 19-10-11 21:40:48 ERROR (MainThread) [hassio.store] Can't load from repository https://github.com/nragon/keeper/tree/master/setup/hassio 19-10-11 21:40:49 INFO (MainThread) [hassio.store] Load add-ons from store: 61 all - 0 new - 0 remove 19-10-11 21:41:21 INFO (MainThread) [hassio.store.git] Clone add-on https://github.com/nragon/keeper/tree/master/setup/hassio repository

Do you have a clue about what's going on here? May it be just a Dockerfile thing?

Thank you

Cheers,

Luis Teixeira

set timestamp format to be compatible with lovelace and device_class: timestamp

lovelace and the newish device_class: timestamp need a timestamp format like this:
2019-07-22T07:26:00+02:00

this could be accomplished by changing the TIME_FORMAT constant in constants.py:
TIME_FORMAT = "%Y-%m-%dT%H:%M:%S%z"

however this produces an UTC timezone without colons (which HA needs):
2019-07-22T07:26:00+0200

iโ€™m not very good at python, so i put this into constants.py

TIME_FORMAT = "%Y-%m-%dT%H:%M:%S"

and hard coded this into connector.py and heartbeater.py:

last_message_fmt = strftime(TIME_FORMAT)+"+02:00"

after that, this works:

  - platform: mqtt
    state_topic: "homeassistant/sensor/kpLastHeartbeat/state"
    name: kpLastHeartbeat
    icon: mdi:calendar-clock
    device_class: timestamp

may be you have a better idea how to do that with datetime.isoformat in python.

Repository not adding to hassio.

When adding https://github.com/nragon/keeper/tree/master/setup/hassio to hassio repository, it does not work.

This is my system log:

19-04-26 12:00:33 INFO (MainThread) [hassio.addons.git] Clone add-on https://github.com/nragon/keeper/tree/master/setup/hassio repository
19-04-26 12:00:33 ERROR (MainThread) [hassio.addons.git] Can't clone https://github.com/nragon/keeper/tree/master/setup/hassio repository: Cmd('git') failed due to: exit code(128)
cmdline: git clone --depth=1 --recursive --shallow-submodules -v https://github.com/nragon/keeper/tree/master/setup/hassio /data/addons/git/625ce890
stderr: 'Cloning into '/data/addons/git/625ce890'...
fatal: repository 'https://github.com/nragon/keeper/tree/master/setup/hassio/' not found
'.
19-04-26 12:00:33 ERROR (MainThread) [hassio.addons] Can't load from repository https://github.com/nragon/keeper/tree/master/setup/hassio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.