このプロジェクトについて

Mini Graph Cardは、Home Assistant向けのカスタムLovelaceカードで、sensorおよびbinary_sensorエンティティの現在の状態を、その履歴の折れ線グラフまたは棒グラフとともに表示します。HACS経由、バンドルをconfig/wwwに手動でコピーする方法、またはCLIダウンロードでインストールし、その後LovelaceでJavaScriptモジュールリソースとして参照します。 このカードはYAMLで設定します。必須オプションはtype(custom:mini-graph-card)とentitiesで、sensorエンティティのリストです。各エンティティは単純なエンティティID、またはattribute、name、color、unit、aggregate_func、show_state、show_legend_state、show_indicator、show_graph、show_line、show_fill、show_points、show_legend、state_adaptive_color、y_axis、fixed_value、smoothingなどのオプションを持つオブジェクトにできます。 カードレベルのオプションには、icon、icon_image、name、unit、tap_action、group、hours_to_show、points_per_hour、aggregate_func、group_by、update_interval、cache、show、animate、height、bar_spacing、line_width、line_color、color_thresholds、color_thresholds_transition、decimals、hour24、font_size、font_size_header、align_header、align_icon、align_state、lower_bound、upper_bound、min_bound_range、secondary bounds、smoothing、state_map、value_factor、logarithmicがあります。 showリストはUI要素を制御します: name、icon、state、graph(line、bar、またはfalse)、fill、points、legend、average、extrema、labels、labels_secondary、name_adaptive_color、icon_adaptive_color、loading_indicator。集計関数にはavg、median、min、max、first、last、sum、delta、diffがあります。データはinterval、date、hourでグループ化できます。color thresholdsは滑らかな遷移またはハードな遷移、および中間ストップ値の補間をサポートします。非数値の状態はstate_mapを介してラベルにマッピングでき、ネストされた辞書やリスト内の属性にはドット付きパスでアクセスできます。 例では、単一エンティティのカード、代替スタイル、複数エンティティ、棒グラフ、週間履歴、グラフのみのカード、水平スタック、動的な線の色、第2Y軸、日付によるグループ化、集計関数、バイナリセンサー、状態のみの追加エンティティの表示を扱っています。テーマ変数mcg-title-letter-spacingとmcg-title-font-weightにより外観をカスタマイズできます。開発にはnodejsとnpmが必要で、npm run buildおよびnpm run watchスクリプトがあります。