All Projects → AlexxIT → Morphnumbers

AlexxIT / Morphnumbers

Компонент Home Assistant для работы с числительными в Jinja2

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Morphnumbers

Button Card
❇️ Lovelace button-card for home assistant
Stars: ✭ 680 (+1689.47%)
Mutual labels:  home-assistant
Home Assistant Config
Home Assistant config files, rewritten to use the latest features, 100+ documented automations, automatically generated ToC 🏠 🤖
Stars: ✭ 926 (+2336.84%)
Mutual labels:  home-assistant
Smarthome
SmartHome: firmware per ESP8266 - Casa domotica
Stars: ✭ 28 (-26.32%)
Mutual labels:  home-assistant
Dasher
🔘 A simple way to bridge your Amazon Dash buttons to HTTP services
Stars: ✭ 705 (+1755.26%)
Mutual labels:  home-assistant
Hass Google Coral
RETIRED - instead use https://github.com/robmarkcole/HASS-Deepstack-object
Stars: ✭ 16 (-57.89%)
Mutual labels:  home-assistant
Homeassistant
Example Home Assistant Configs
Stars: ✭ 846 (+2126.32%)
Mutual labels:  home-assistant
Ios
📱 Home Assistant for Apple platforms
Stars: ✭ 667 (+1655.26%)
Mutual labels:  home-assistant
Hass Config
Configuration files for Home Assistant
Stars: ✭ 32 (-15.79%)
Mutual labels:  home-assistant
Replaylightshistory
AppDaemon App for Home Assistant to replay light switch history when no one is home.
Stars: ✭ 17 (-55.26%)
Mutual labels:  home-assistant
Android
📱 Home Assistant Companion for Android
Stars: ✭ 881 (+2218.42%)
Mutual labels:  home-assistant
Room Assistant
Presence tracking and more for automation on the room-level
Stars: ✭ 764 (+1910.53%)
Mutual labels:  home-assistant
Mini Media Player
Minimalistic media card for Home Assistant Lovelace UI
Stars: ✭ 827 (+2076.32%)
Mutual labels:  home-assistant
Rhasspy
Rhasspy voice assistant for offline home automation
Stars: ✭ 851 (+2139.47%)
Mutual labels:  home-assistant
Amazon Dash
Hack your Amazon Dash to run what you want.
Stars: ✭ 703 (+1750%)
Mutual labels:  home-assistant
Yahoofinance
Home Assistant component which allows you to get stock updates from Yahoo finance.
Stars: ✭ 28 (-26.32%)
Mutual labels:  home-assistant
Lovelace Soft Ui
💫 Simple and clean Lovelace configuration
Stars: ✭ 675 (+1676.32%)
Mutual labels:  home-assistant
Hass Sighthound
Beta features for Home Assistant Sighthound integration
Stars: ✭ 26 (-31.58%)
Mutual labels:  home-assistant
Solarthing
Monitors an Outback MATE and a Renogy Rover - MPPT Charge Controller. Integrates with Grafana, PVOutput and more!
Stars: ✭ 33 (-13.16%)
Mutual labels:  home-assistant
Home Assistant octopusagile
Octopus Agile custom component for Home Assistant
Stars: ✭ 30 (-21.05%)
Mutual labels:  home-assistant
Supervisor
🏡 Home Assistant Supervisor
Stars: ✭ 862 (+2168.42%)
Mutual labels:  home-assistant

Morph Numbers

hacs_badge

Компонент Home Assistant, добавляющий Jinja2 фильтр для работы с числительными. Хорошо подходит в дополнение к моему второму компоненту YandexStation.

Внимание: Если вы пользовались компонентом ранее - название функции изменилось!

template

Установка и настройка

Устанавливается через HACS.

Настраивается в configuration.yaml:

morph_numbers:

Используется как дополнительный фильтр в шаблонах.

Примеры

Согласование слов с числительными

Полезно при отправке в Телеграм

{{ 24|format(morph='градус', as_text=false) }} => 24 градуса

Преобразование чисел в текст

Полезно для TTS. Яндекс и Google допускают ошибки при произнесении числительных.

{{ 2|format(morph='просроченная задача') }} => две просроченные задачи

Прочее

{{ 2000435|format(morph='') }} => два миллиона четыреста тридцать пять

Шаблон из скриншота

Старт занял {{ states('sensor.start_time')|round|format(morph='секунду') }}

{{ 1|format(morph='градус') }}
{{ 1|format(morph='задача') }}
{{ 1|format(morph='дерево') }}

{{ 2000435|format(morph='синее облако') }}

{{ 2|format(morph='запланированная задача', as_text=false) }}
{{ 5|format(morph='просроченная задача', as_text=false) }}

{{ 123|format(morph='') }}

{{ 0|format(morph='градус') }}
{{ -2|format(morph='градус') }}
script:
  morph_numbers_test:
    sequence:
    - service: persistent_notification.create
      data_template:
        message: Старт занял {{ states('sensor.start_time')|round|format(morph='секунду') }}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].