Git Product home page Git Product logo

ha-graph-image's Introduction

Компонент Home Assistant для создания файла картинки графика по истории объекта.

Компонент создает сервис graph_image.create_graph_image для создания картинок по истории объекта. В сервисе так же есть параметры для настройки по времени и виду графика, по умолчанию выставлены оптимальные параметры. История по объектам запрашивается из компонента history.
В параметрах времени указать сколько часов назад начало и окончание, по умолчанию история за последние 12 часов.

Проверка

После добавления интеграции перейдите в "Панель разработчика" > "Службы" > graph_image.create_graph_image и выбирите объект для построения графика, все остальные параметры не обязательные.
Если путь для файла не указан (если указан, то раширение файла должно быть .png), картинка будет создана и доступна по адресу http://ha:8123 /local/graph.png (обновите страницу 2 раза если не изменилась картинка, бразуер может кешировать)

Установка

HACS

Перейдите в раздел "Интеграции" HACS, добавьте в пользовательский репозиторий malinovsku/ha-graph-image, затем загрузите компонент graph_image и перезагрузите HomeAssistant. В интеграциях добавьте Graph image.

Ручной

Скопируйте папку graph_image из custom_components в директорию /config/custom_components.

ha-graph-image's People

Contributors

malinovsku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

artt652

ha-graph-image's Issues

create_graph_image Unknown error

Ha version
Core 2023.11.1
Supervisor 2023.10.1
Operating System 11.1
Пользовательский интерфейс 20231030.1

Graph Image ver. 0.0.9 Установлена через HACS интеграция добавлена.
Через Панель разработчика->Службы пытаюсь создать график:
image

В логах:

[140395327360704] Error handling message: Unknown error (unknown_error) user from 10.1.1.1 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15)
12:56:20 – (ОШИБКА) Home Assistant WebSocket API (пользовательская интеграция)
websocket_api script: Error executing script. Unexpected error for call_service at pos 1: [Errno 2] No such file or directory: '/config/www/graph.png'
12:56:20 – (ОШИБКА) helpers/script.py

Полные логи:

File "/config/custom_components/graph_image/init.py", line 91, in create_graph_image
await hass.async_add_executor_job(fig.savefig, in_folderfile)
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/matplotlib/figure.py", line 3277, in savefig
self.canvas.print_figure(fname, **kwargs)
File "/usr/local/lib/python3.11/site-packages/matplotlib/backend_bases.py", line 2338, in print_figure
result = print_method(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/matplotlib/backend_bases.py", line 2204, in
print_method = functools.wraps(meth)(lambda *args, **kwargs: meth(
^^^^^
File "/usr/local/lib/python3.11/site-packages/matplotlib/_api/deprecation.py", line 410, in wrapper
return func(*inner_args, **inner_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py", line 520, in print_png
self._print_pil(filename_or_obj, "png", pil_kwargs, metadata)
File "/usr/local/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py", line 467, in _print_pil
mpl.image.imsave(
File "/usr/local/lib/python3.11/site-packages/matplotlib/image.py", line 1656, in imsave
image.save(fname, **pil_kwargs)
File "/usr/local/lib/python3.11/site-packages/PIL/Image.py", line 2435, in save
fp = builtins.open(filename, "w+b")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/config/www/graph.png'

The following integrations and platforms could not be set up

Logger: homeassistant.setup
Source: setup.py:221
First occurred: 08:28:08 (1 occurrences)
Last logged: 08:28:08
Setup failed for custom integration 'graph_image': Requirements for graph_image not found: ['matplotlib']

2024-02-09 08:26:30.066 ERROR (SyncWorker_3) [homeassistant.util.package] Unable to install package matplotlib: error: subprocess-exited-with-error

Core 2024.2.0
Supervisor 2024.01.1
Operating System 11.5

Ошибка при добавлении интеграции

Здравствуйте!
Не удаётся добавить интеграцию в HA.

Установка через HACS
Rapberry Pi 4 / Raspbian GNU/Linux 11 (bullseye)
HA 2024.2.4 supervised

Установка заново не помогла.

Лог ошибки:

Logger: homeassistant.util.package
Source: util/package.py:122
First occurred: 10:23:48 (1 occurrences)
Last logged: 10:23:48

Unable to install package matplotlib: error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [123 lines of output] /tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools_scm/git.py:308: UserWarning: git archive did not support describe output warnings.warn("git archive did not support describe output") /tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools_scm/git.py:327: UserWarning: unprocessed git archival found (no export subst applied) warnings.warn("unprocessed git archival found (no export subst applied)") /tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools_scm/_integration/setuptools.py:90: UserWarning: version of matplotlib already set warnings.warn(f"version of {dist_name} already set") Edit mplsetup.cfg to change the build options; suppress output with --quiet. BUILDING MATPLOTLIB python: yes [3.12.1 (main, Jan 4 2024, 12:00:29) [GCC 13.2.1 20231014]] platform: yes [linux] tests: no [skipping due to configuration] macosx: no [Mac OS-X only] running egg_info writing lib/matplotlib.egg-info/PKG-INFO writing dependency_links to lib/matplotlib.egg-info/dependency_links.txt writing requirements to lib/matplotlib.egg-info/requires.txt writing top-level names to lib/matplotlib.egg-info/top_level.txt Traceback (most recent call last): File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/numpy/core/__init__.py", line 24, in <module> from . import multiarray File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/numpy/core/multiarray.py", line 10, in <module> from . import overrides File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/numpy/core/overrides.py", line 8, in <module> from numpy.core._multiarray_umath import ( ImportError: Error loading shared library /tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/numpy/core/_multiarray_umath.cpython-312-arm-linux-musleabihf.so: Operation not permitted During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/numpy/__init__.py", line 130, in <module> from numpy.__config__ import show as show_config File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/numpy/__config__.py", line 4, in <module> from numpy.core._multiarray_umath import ( File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/numpy/core/__init__.py", line 50, in <module> raise ImportError(msg) ImportError: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed. We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.12 from "/usr/local/bin/python3" * The NumPy version is: "1.26.4" and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help. Original error was: Error loading shared library /tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/numpy/core/_multiarray_umath.cpython-312-arm-linux-musleabihf.so: Operation not permitted The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module> main() File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup exec(code, locals()) File "<string>", line 279, in <module> File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 103, in setup return distutils.core.setup(**attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 185, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 201, in run_commands dist.run_commands() File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands self.run_command(cmd) File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 963, in run_command super().run_command(command) File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 321, in run self.find_sources() File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 329, in find_sources mm.run() File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 550, in run self.add_defaults() File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 588, in add_defaults sdist.add_defaults(self) File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/command/sdist.py", line 102, in add_defaults super().add_defaults() File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults self._add_defaults_ext() File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py", line 335, in _add_defaults_ext build_ext = self.get_finalized_command('build_ext') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 305, in get_finalized_command cmd_obj.ensure_finalized() File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized self.finalize_options() File "<string>", line 80, in finalize_options File "/tmp/pip-install-1a91apog/matplotlib_59a01d6b44714a6a9a2dbe2599ebb7da/setupext.py", line 403, in get_extensions add_numpy_flags(ext) File "/tmp/pip-install-1a91apog/matplotlib_59a01d6b44714a6a9a2dbe2599ebb7da/setupext.py", line 511, in add_numpy_flags import numpy as np File "/tmp/pip-build-env-0348vrrr/overlay/lib/python3.12/site-packages/numpy/__init__.py", line 135, in <module> raise ImportError(msg) from e ImportError: Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python interpreter from there. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip.

Зависание НА при вызове сервиса graph_image.create_graph_image

После обновления Home Assistant до 2023.5.*, при вызове сервиса получения картинки, перестает работать НА (не работает веб морда, телеграм-бот, автоматизации), потом ребутится походу сторожевой собакой.

Home Assistant 2023.5.2
Supervisor 2023.04.1
Operating System 10.1
ha-graph-image v0.0.5

В журнале похоже описывается так:
May 11 06:19:17 homeassistant kernel: kauditd_printk_skb: 1 callbacks suppressed
May 11 06:19:17 homeassistant kernel: audit: type=1334 audit(1683785957.783:2401): prog-id=1074 op=UNLOAD

Detected blocking call to import_module in HA 2024.5

Регистратор: homeassistant.util.loop
Источник: util/loop.py:99
Первое сообщение: 19:05:41 (1 сообщений)
Последнее сообщение: 19:05:41

Detected blocking call to import_module inside the event loop by custom integration 'graph_image' at custom_components/graph_image/init.py, line 45: fig = plt.figure(tight_layout=True) (offender: /usr/local/lib/python3.12/site-packages/matplotlib/pyplot.py, line 342: module = importlib.import_module(cbook._backend_module_name(newbackend))), please create a bug report at https://github.com/malinovsku/ha-graph-image/issues

Home Assistant 2023.8.3 не запускается служба graph_image.create_graph_image

Добрый день!
Установил интеграцию v0.0.8 через HACS, перезагрузил ha, но служба graph_image.create_graph_image почему-то не работает, система говорит, что её не существует. Пробовал переустанавливать, устанавливать вручную, но так и не заводится.

Home Assistant 2023.8.3
Supervisor 2023.08.1
Operating System 10.5
Пользовательский интерфейс 20230802.1 - latest

Error in describing action: Cannot read properties of undefined (reading 'create_graph_image')
Stopped because an error was encountered at 24 августа 2023 г. в 16:32:39 (runtime: 0.00 seconds)
Unable to find service graph_image.create_graph_image

В автоматизации "Новая автоматизация" (automation.novaia_avtomatizatsiia) используется действие, которое вызывает неизвестную службу: graph_image.create_graph_image.
Это может препятствовать корректному выполнению автоматизации. Возможно, эта служба больше недоступна, а возможно, причиной стала опечатка.
Чтобы исправить эту ошибку, отредактируйте автоматизацию или удалите действие, вызывающее эту службу.
photo_2023-08-24_18-19-23

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.