Code Monkey home page Code Monkey logo

sensor.krisinformation's Introduction

stability-wip

Version maintained

maintainer

sensor.krisinformation

Component to get Krisinformation for Home Assistant.

Will get all messages from Krisinformations api in a set radius from your coordinates. If one of the fetched messages is an alert as opposed to news, the state of the sensor will be "Alert". The sensor contains all fetched messages as objects.

Use together with custom card for Lovelace.

Krisinformation Lovelace Card

This component is supported by Custom updater and Tracker card.

Installation:

  1. Install this component by creating a custom_components folder in the same folder as your configuration.yaml is, if you don't already have one.
  2. Inside that folder, create another folder named krisinformation. Put the contents of the custom_components folder in there.
  3. You will need to restart after installation for the component to start working.
  4. Add the integration in the Configuration GUI under integrations

Usage

Example automation for getting a notification when the sensor has an alert: Make sure you change the sensor name if you didn't use the default name.

automation:
  - alias: 'Krisinformation Alert'
    initial_state: 'on'
    trigger:
      platform: state
      entity_id: sensor.krisinformation
      to: "Alert"
    action:
      - service: notify.my_phone
        data_template:
          message: >
            {{states.sensor.krisinformation.attributes.messages[0].Headline}} - {{states.sensor.krisinformation.attributes.messages[0].Message}} {{states.sensor.krisinformation.attributes.messages[0].Web}}

Like my work and want to say thanks? Do it here:

Buy Me A Coffee

Changelog

Changes

sensor.krisinformation's People

Contributors

dsorlov avatar isabellaalstrom avatar lociii avatar naesstrom avatar naterobinsons avatar tubalainen avatar yabbah 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  avatar

Watchers

 avatar  avatar  avatar  avatar

sensor.krisinformation's Issues

Issue with rest sensor in HA 2021.3

Not only the "version warning" in the manifest file - there is something more that needs to be addressed (not sure what).

I am running the beta6 version of the upcoming HA release.

2021-03-03 10:57:14 ERROR (MainThread) [homeassistant.config] Platform error: sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 834, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 499, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 504, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/krisinformation/sensor.py", line 39, in <module>
    from homeassistant.components.rest.sensor import RestData
ImportError: cannot import name 'RestData' from 'homeassistant.components.rest.sensor' (/usr/src/homeassistant/homeassistant/components/rest/sensor.py)

Error in sensor, implements device_state_attributes

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:549
First occurred: 08:09:12 (2 occurrences)
Last logged: 08:09:13

Entity sensor.krisinformation_sandviken (<class 'custom_components.krisinformation.sensor.KrisinformationSensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.krisinformation_sverige (<class 'custom_components.krisinformation.sensor.KrisinformationSensor'>) implements device_state_attributes. Please report it to the custom component author.

Enhancements to card view

Hi

First of all nice integration, using it for a couple of days.

Here are som enhancements i think would be nice,

  • Able to hide the "Läs mer" link, since i run it in a fullscreen kiosk browser with no option to click back and if someone clicks on the link i need to restart the kiosk browser.
  • Hide Header, i got custom header cards with nice background pictures already i would like to hide the header in the card.

Thanks
/Marcus

Error loading custom_components.krisinformation.sensor

Hi!

Everything have worked great until recently. I get this error in the log:

2019-04-11 22:34:04 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.krisinformation.sensor. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/loader.py", line 166, in _load_file
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/krisinformation/sensor.py", line 39, in <module>
    from homeassistant.components.rest.sensor import RestData
ModuleNotFoundError: No module named 'homeassistant.components.rest'
2019-04-11 22:34:04 ERROR (MainThread) [homeassistant.loader] Unable to find platform krisinformation.

Running Hass.io 0.89.2. I haven't changed anything in my setup AFAIK. Any thoughts or should I just reinstall?

Remake option "country" to take all messages for whole country

For now the option country makes the sensor only contain country wide alerts (like a covid one right now) but it should contain all alerts for the whole country instead. Or maybe add option "county: all" for this functionality? And make that work in conjunction with country.

Automation triggers at restart

automation with this trigger also triggers at restart

    trigger:
      platform: state
      entity_id: sensor.krisinformation
      to: "News"

Manual setting in new GUI not working

I'm on core 2021.7.4 and did a new clean install of Krisinformation 2.0.0-beta.0 through HACS. Nothing I put in the manual settings (in the new GUI) seems to stick after saving. All fields keep staying empty.

No matter what cities, counties and coordinates I put in - everything bounces back to Stockholm.

SyntaxError: invalid syntax

I get error when I check my config in Hass.

File "/home/homeassistant/.homeassistant/custom_components/krisinformation/sensor.py", line 71
name = f"{DEFAULT_NAME} {country}"
^
SyntaxError: invalid syntax

My config.

  • platform: krisinformation
    name: "Krisinformation Stockholm"
    county: "Västra Götalands län"
    latitude: !secret lat_coord
    longitude: !secret long_coord
    radius: 100

Alerts in Swedish

Is there a flag, or is there a possibility to add a flag to get the output information in swedish?

Certificate error

Hej,
I’m getting an error with certificate whe I’m using Krisinformation.
2019-11-04 17:03:10 ERROR (SyncWorker_17) [custom_components.krisinformation.sensor] Unable to fetch data from Krisinformation.
2019-11-04 17:03:10 ERROR (SyncWorker_17) [custom_components.krisinformation.sensor] <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1076)>
I’m running Duck DNS and Nginx.
Any idéa ?

AttributeError: module 'custom_components.sensor.krisinformation' has no attribute 'setup_platform'

Tried to install this component but got the following error:

2019-02-23 13:07:41 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform krisinformation
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 124, in _async_setup_platform
task = async_create_setup_task()
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 89, in async_create_setup_task
None, platform.setup_platform, hass, platform_config,
AttributeError: module 'custom_components.sensor.krisinformation' has no attribute 'setup_platform'

Check Home Assistant configuration

Hi!

Checking for Home Assistant 0.106.1:

Failed config
General Errors:
- Platform error sensor.krisinformation - No module named 'jsonpath'

Test

Hej Tack för en underbar komponent, finns det något sätt att fejka data så jag kan testa om min automation funkar?

Check Home Assistant configuration

Hi!

Checking for Home Assistant 0.106.6:

Failed config
General Errors:

  • Platform error sensor.krisinformation - No module named 'xmltodict'

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.