ITADN
ngocjohn/lunar-phase-card
README.md
以下内容由 AI 翻译,如有问题请点此提交 issue 反馈

hacs hacs total-downloads latest-downloads community-forum buy_me_a_coffee

🌘 Lunar Phase Card

这是一款用于 Home Assistant 的 Lovelace 自定义卡片,提供关于当前月相的详细信息。该卡片利用精确的天文计算来提供准确的月球数据,使其成为对天文学、占星术或仅追踪月相感兴趣的人们的宝贵补充。

目录

目录

功能

  • 当前月相显示: 显示当前月亮的相位。
  • 详细月球信息: 提供关于月球周期的额外详细信息。
  • 可定制: 易于定制以匹配您的仪表板主题。
  • 响应式设计: 在桌面和移动设备上均表现良好。
  • 自定义纬度和经度配置: 提供配置自定义纬度和经度的可能性,以获取精确的月球数据。
  • 特定日期月球信息: 提供显示特定日期月亮信息的选项。
  • 多语言支持:该卡片包含多种翻译,使其可访问多种语言。

支持的语言本地化

本项目支持以下语言
朗格代码名称本地名称
ca加泰罗尼亚语Català
cs捷克语Čeština
da丹麦语Dansk
de德语Deutsch
en英语English
es西班牙语Español
fr法语Français
id印度尼西亚语Bahasa Indonesia
it意大利语Italiano
ko韩语한국어
lt立陶宛语Lietuvių
nl荷兰语Dutch
pl波兰语Polski
pt葡萄牙语Português (Brasil)
ru俄语Русский
sk斯洛伐克语Slovenčina
sv瑞典语Svenska
tr土耳其语Türkçe
ua乌克兰语Українська
viVietnameseTiếng Việt
zh-HansChinese中文

视图选项

  • 卡片视图

默认卡片 默认无标题

  • 徽章视图

月相徽章深色 月相徽章浅色

  • 日历卡片

日历卡片 日历无标题

  • 地平线图

动态卡片无标题 地平线卡片 地平线卡片无标题

  • 紧凑视图

紧凑卡片 紧凑卡片无标题

  • 紧凑模式极简

紧凑极简

安装

HACS (Home Assistant Community Store)

使用此链接直接前往 HACS 中的仓库

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

  1. If HACS is not installed yet, download it following the instructions on https://hacs.xyz/docs/use/#getting-started-with-hacs
  2. Open HACS in Home Assistant
  3. Search for Lunar Phase Card
  4. Click the download button. ⬇️
  5. Force refresh the Home Assistant page Ctrl + F5 / Shift + + R
  6. Add lunar-phase-card to your dashboard

手册

点击以展开安装说明
  1. Download the lunar-phase-card.js.
  2. Place the downloaded file on your Home Assistant machine in the config/www folder (when there is no www folder in the folder where your configuration.yaml file is, create it and place the file there).
  3. In Home Assistant go to Configuration->Lovelace Dashboards->Resources (When there is no resources tag on the Lovelace Dashboard page, enable advanced mode in your account settings, and retry this step).
  4. Add a new resource:
    • Url = /local/lunar-phase-card.js
    • Resource type = module
  5. Force refresh the Home Assistant page Ctrl + F5 / Shift + + R.
  6. Add lunar-phase-card to your page.

配置

所有选项都可以在 GUI 编辑器中进行配置。要配置 Lunar Phase Card,您可以在 Lovelace 配置中使用以下参数:

卡片配置

Card config editor


🌍 位置配置

名称类型要求描述
typestring必填卡片类型:custom:lunar-phase-card
location_sourcestring可选位置数据来源。选项:defaultentitycustom。默认为 default
entitystring可选location_source: entity 时用作位置来源的实体。纬度和经度从实体属性中读取。
latitudenumber可选自定义纬度(当 location_source: custom 时使用)。
longitudenumber可选自定义经度(当 location_source: custom 时使用)。
southern_hemisphereboolean可选为南半球用户调整月亮方向。默认为 false

🎨 外观与行为

名称类型要求描述
languagestringOptional语言 ISO 代码。默认为 en
default_sectionstringOptional加载时显示的章节。选项:base, calendar, horizon, full_calendar
compact_viewbooleanOptional启用紧凑卡片布局。默认为 false
compact_modestringOptional紧凑模式样式。选项:default, minimal
moon_positionstringOptional基础章节中月亮图像的位置。选项:left, right
hide_backgroundbooleanOptional隐藏卡片背景图像。默认为 false
custom_backgroundstringOptional自定义背景图像 URL。
hide_starfieldbooleanOptional隐藏星空背景层。
hide_buttonsbooleanOptional隐藏用于切换章节的菜单按钮。
compact_menu_buttonbooleanOptional为菜单按钮使用紧凑样式。
hide_compact_labelbooleanOptional启用紧凑视图时隐藏标签。
calendar_modalbooleanOptional在模态弹窗中打开日历章节。
custom_themestringOptional应用于卡片的自定义 Home Assistant 主题名称。
theme_modestringOptional主题模式。选项:auto, light, dark。默认为 auto

📊 布局与数据可视化

名称类型要求描述
hide_itemslist可选在数据视图中隐藏的数据项列表。
max_data_per_pagenumber可选数据信息视图中每页的最大数据项数量。
number_decimalsnumber可选数值显示的小数位数。
mile_unitboolean可选距离值使用英里而非公里。
12hr_formatboolean可选使用 12 小时制而非 24 小时制时间格式。
font_configobject可选卡片的字体自定义选项。
graph_chart_configobject可选地平线部分的图表配置。

[!NOTE] entity 参数不是必需的。它指的是 Lunar Card Custom 组件的实体 ID,该组件可以在此处](https://github.com/ngocjohn/lunar-phase)安装。如果未定义 entity,卡片将使用系统配置中的默认纬度和经度。

字体自定义选项

名称类型描述
header_font_sizestring标题的字体大小。选项:autosmallmediumlargex-largexx-large。默认为 x-large
header_font_stylestring标题的文本样式。选项:nonecapitalizeuppercaselowercase。默认为 capitalize
header_font_colorstring标题文本的颜色。
label_font_sizestring标签的字体大小。选项:autosmallmediumlargex-largexx-large。默认为 auto
label_font_stylestring标签的文本样式。选项:nonecapitalizeuppercaselowercase。默认为 none
label_font_colorstring标签文本的颜色。
hide_labelboolean是否隐藏卡片上的标签。默认为 false

图表配置选项

名称类型描述
graph_typestring图表类型。选项:defaultdynamic。默认为 default
y_ticksboolean是否显示 y 轴刻度。默认为 false
x_ticksboolean是否显示 x 轴刻度。默认为 false
show_timeboolean是否在图表上显示时间标签。默认为 true
show_currentboolean是否显示当前月球位置。默认为 true
show_highestboolean是否显示月球最高点。默认为 true
y_ticks_positionstringy 轴刻度的位置。选项:leftright。默认为 left
y_ticks_step_sizenumbery 轴刻度的步长。默认为 30
time_step_sizenumber时间标签的步长。默认为 30

配置示例

以下是 Lunar Phase Card 的配置示例:

type: custom:lunar-phase-card
location_source: default
entity: sensor.lunar_phase
southern_hemisphere: false
latitude: 50.06038385213462
longitude: 14.399275481700899
language: en
hide_background: true
hide_starfield: true
custom_background: http://localhost:8235/background/moon_bg_2.png
theme_mode: dark
default_section: base
compact_view: false
moon_position: right
hide_buttons: false
compact_menu_button: false
hide_compact_label: false
calendar_modal: false
hide_items: []
number_decimals: 2
mile_unit: false
12hr_format: true
font_config:
  label_font_size: auto
  label_font_style: none
  label_font_color: ""
graph_chart_config:
  graph_type: dynamic
  y_ticks: false
  x_ticks: false
  show_time: false
  show_current: true
  show_highest: true
  y_ticks_position: left
  y_ticks_step_size: 30
  time_step_size: 30
  show_legend: true
  legend_position: top
  legend_align: center

徽章配置

Lunar Badge Dark Lunar Badge light

要配置 Lunar Phase Badge,请在您的 Lovelace 徽章配置中使用以下参数:


🌍 位置配置

名称类型要求描述
typestring必填徽章类型:custom:lunar-phase-badge
location_sourcestring可选位置数据来源。选项:defaultentitycustom。默认为 default
entitystring可选location_source: entity 时用作位置来源的实体。纬度和经度从实体属性中读取。
southern_hemisphereboolean可选为南半球用户调整月亮方向。默认为 false
latitudenumber可选自定义纬度(当 location_source: custom 时使用)。
longitudenumber可选自定义经度(当 location_source: custom 时使用)。

🎨 外观与行为

名称类型要求描述
languagestringOptional语言 ISO 代码。如果未设置,则使用 Home Assistant 的语言。
number_decimalsnumberOptional数值显示的小数位数。编辑器范围为 05
mile_unitbooleanOptional距离值使用英里而非公里。
12hr_formatbooleanOptional使用 12 小时制而非 24 小时制时间格式。
icon_typestringOptional月亮图标样式。选项:imageemojiicon。默认为 image

📄 内容配置

名称类型要求描述
custom_nameboolean可选启用自定义徽章名称文本。
namestring可选徽章名称。如果 custom_name: true,则为自由文本。否则使用一个 moon 字段键来显示内置标签。
state_contentstring | string[]可选显示为徽章状态的字段。可以是一个或多个值。如果未设置,则显示当前月相名称。
show_nameboolean可选显示徽章名称文本。默认为 false
show_iconboolean可选显示月亮图标。默认为 true
show_stateboolean可选显示徽章状态文本。默认为 true

可用的 moon 字段键

使用这些值配合 name(当 custom_name: false 时)和 state_content

  • phaseName
  • moonAge
  • moonFraction
  • azimuthDegress
  • altitudeDegrees
  • distance
  • position
  • moonRise
  • moonSet
  • moonHighest
  • nextFullMoon
  • nextNewMoon
  • nextPhase

🤏 交互

名称类型要求描述
tap_actionobject可选点按时的操作。
hold_actionobject可选长按时的操作。
double_tap_actionobject可选双击时的操作。

支持的操作类型有:more-infotogglenavigateurlperform-actionassistnone

徽章配置示例

type: custom:lunar-phase-badge
location_source: default
entity: sensor.lunar_phase
southern_hemisphere: false
language: en
number_decimals: 2
mile_unit: false
12hr_format: true
icon_type: image
custom_name: false
name: phaseName
show_name: false
show_icon: true
show_state: true
state_content:
  - phaseName
  - moonFraction
tap_action:
  action: more-info
hold_action:
  action: none
double_tap_action:
  action: none

贡献指南

我们欢迎贡献,并感谢您在改进本项目方面提供的支持。如果您希望参与贡献,请遵循我们的贡献指南开始。

支持

如果您喜欢这张卡片,请考虑支持开发者

Buy Me A Coffee


© 2024 Viet Ngoc

https://github.com/ngocjohn/

(返回顶部)