Coder Social home page Coder Social logo

nagyrobi / home-assistant-custom-components-pfsense-gateways Goto Github PK

View Code? Open in Web Editor NEW
17.0 3.0 10.0 50 KB

Monitor and react on your pfSense gateway's status with Home Assistant.

License: MIT License

Python 100.00%
pfsense gateways reboot isp modem router

home-assistant-custom-components-pfsense-gateways's Introduction

Note: this plugin is unsupported. Use https://github.com/travisghansen/hass-pfsense instead, which supports much more features, including gateway status.

Gateways status for pfSense

Support for pfSense gateways status monitoring using alexpmorris / pfsense-status-gateways-json script. Check https://github.com/alexpmorris/pfsense-status-gateways-json on how to install it on pfSense.

Returns True or False depending on the status of the gateway. Useful to trigger an external reboot or power-cycle of the ISP modem, or similar.

Example config

sensor:
- platform: pfsense_gateways
  host: 192.168.1.1
  name: pfSense gateway
  key: pfsense
  monitored_gateway_interfaces:
    - wan
    - opt2

Example automations

- alias: "pfSense GW-Down"
  trigger:
    - platform: state
      entity_id: sensor.pfsense_gateway_gw_wan1
      to: 'False'
  action:
    - service: notify.me
      data:
        message: "My internet just died"

- alias: "pfSense GW-Down 5min"
  trigger:
    - platform: state
      entity_id: sensor.pfsense_gateway_gw_wan1
      to: 'False'
      for:
        minutes: 5
  action:
    - service: notify.me
      data:
        message: "My internet just died more than 5 minutes ago, rebooting ISP crap"
    - service: switch.turn_on
      entity_id: switch.relay_powercycle_modem

Support forum: https://community.home-assistant.io/t/pfsense-stat-monitor/61070/55

home-assistant-custom-components-pfsense-gateways's People

Contributors

ktibow avatar nagyrobi avatar override80 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

home-assistant-custom-components-pfsense-gateways's Issues

Please add version to manifest.json

New requirements for custom components.

2021-03-01 12:28:49 WARNING (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'pfsense_gateways'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'pfsense_gateways'

Make port and protocol configurable

The current version works only with http on default 80 port.
Sensor.py contains the following url format:
DEFAULT_RESOURCE = "http://{0}/status_gateways_json.php?key={1}"

Ii would be nice if protocol and port can be configured from HA sensor yaml, like:

sensor:
- platform: pfsense_gateways
  host: 192.168.1.1
  port: 9500
  ssl: true
  name: pfSense gateway
  key: pfsense
  monitored_gateway_interfaces:
    - wan
    - opt2

Need a couple floatval()s in JSON coming back from pfSense

I had trouble getting the linecharts to appear properly on the sensor cards for ping and loss. After looking at it and thinking on it for a while, I realized the issue is that we're getting units (mS, %) in the value returned in the JSON, and thus into Home Assistant. They're actually displaying as (for example) "9.857mS mS".

By putting a floatval() around both ping and loss values in the pfSense-side .php, I now get numbers coming across rather than the strings, and the pretty lines draw across the bottom of my sensor cards.

The appropriate place to fix this is likely on the Home Assistant side. I'd make a similar change in the component, but I'm not familiar enough myself with Home Assistant development to validate the change. If I did, this would be a PR, not an issue.

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.