GithubHelp home page GithubHelp logo

viktak / ha-cc-abalin-nameday Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 2.0 39 KB

Home Assistant custom component for the abalin name day API

License: GNU General Public License v3.0

Python 100.00%
home-assistant-custom namedays hacs-default hacs

ha-cc-abalin-nameday's Introduction

Home_Assistant hacs_badge hacs_badge GitHub GitHub code size in bytes

ha-cc-abalin-nameday

Home Assistant custom component for the abalin name day API

Installation

Automatic

Use HACS to install it.

Manual

Copy the files to their proper location

Usage

Example configuration.yaml:

sensor:
    - platform: abalin_nameday
      country: hu
      time_zone: Europe/Prague

Explanation

country: one of the countries from this list:

['cz','sk','pl','fr','hu','hr','se','us','at','it','es','de','dk','fi','bg','lt','ee','lv','gr','ru']

timezone: One of the time zones from this list:

'America/Denver',
'America/Costa_Rica',
'America/Los_Angeles',
'America/St_Vincent',
'America/Toronto',
'Europe/Amsterdam',
'Europe/Monaco',
'Europe/Prague',
'Europe/Isle_of_Man',
'Africa/Cairo',
'Africa/Johannesburg',
'Africa/Nairobi',
'Asia/Yakutsk',
'Asia/Hong_Kong',
'Asia/Taipei',
'Pacific/Midway',
'Pacific/Honolulu',
'Etc/GMT-6',
'US/Samoa',
'Zulu',
'US/Hawaii',
'Israel',
'Etc/GMT-2',

Sensors created

Currently, the following sensor is created by this integration:

  • sensor.nameday_< country_code > i.e. sensor.nameday_hu

Sample screenshot of sensors

screenshot

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

GNU General Public License v3.0

ha-cc-abalin-nameday's People

Contributors

viktak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ha-cc-abalin-nameday's Issues

Sensor update fails

One day after installing the component from HACS, it seems to have stopped working:

This error originated from a custom integration.

Logger: homeassistant.helpers.entity
Source: custom_components/abalin_nameday/sensor.py:62
Integration: abalin_nameday (documentation, issues)
First occurred: June 28, 2021, 12:06:50 PM (22 occurrences)
Last logged: 9:06:50 AM

Update for sensor.nameday_hu fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 350, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 558, in async_device_update
    raise exc
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/abalin_nameday/sensor.py", line 98, in update
    self.data.update(self.type)
  File "/config/custom_components/abalin_nameday/sensor.py", line 62, in update
    self.data = json.loads(myNameDay.GetData())
  File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 42 (char 41)

Error on Device Update

Entity is unavailable since yesterday ...

HA 2022.2.9

2022-02-19 15:51:58 ERROR (MainThread) [homeassistant.components.sensor] abalin_nameday: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 718, in async_device_update
    await task
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/abalin_nameday/sensor.py", line 98, in update
    self.data.update(self.type)
  File "/config/custom_components/abalin_nameday/sensor.py", line 62, in update
    self.data = json.loads(myNameDay.GetData())
  File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 42 (char 41)

error at log, and integration not working at all

Logger: homeassistant.components.sensor
Source: custom_components/abalin_nameday/sensor.py:62
Integration: Sensor (documentation, issues)
First occurred: 19:28:42 (1 occurrences)
Last logged: 19:28:42

abalin_nameday: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 715, in async_device_update
await task
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/abalin_nameday/sensor.py", line 98, in update
self.data.update(self.type)
File "/usr/src/homeassistant/homeassistant/util/init.py", line 192, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/abalin_nameday/sensor.py", line 62, in update
self.data = json.loads(myNameDay.GetData())
File "/usr/local/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 42 (char 41)

Entity not available: sensor.nameday_sk

From 12/2022 modul abalin-nameday not working in Home Assistant 2022.11.5.

Error log:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 715, in async_device_update
await task
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/abalin_nameday/sensor.py", line 98, in update
self.data.update(self.type)
File "/usr/src/homeassistant/homeassistant/util/init.py", line 192, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/abalin_nameday/sensor.py", line 62, in update
self.data = json.loads(myNameDay.GetData())
File "/usr/local/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 42 (char 41)

Error at log and integration not working again and again

As topic, below log

abalin_nameday: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 715, in async_device_update
    await task
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/abalin_nameday/sensor.py", line 98, in update
    self.data.update(self.type)
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 192, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/abalin_nameday/sensor.py", line 62, in update
    self.data = json.loads(myNameDay.GetData())
  File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 42 (char 41)

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.