addyire / ha-menu

An app to interact with Home Assistant in the macOS menu bar.
MIT License
236 stars 1 forks source link


ha-menu


An insanely customizable way to interact with Home Assistant in the menubar

Example Configuration

Table Of Contents

Installation

To use a prebuilt version...

  1. Head over to releases and download the latest release
  2. Extract the zip and drag the application into your Applications folder.
  3. Open HA Menu

To build it yourself...

  1. Clone this repository
  2. Run yarn install
  3. Run yarn dist
  4. Your executable will be found in the newly created dist folder

App Configuration

To open the Preferences window, click the Home Assistant Icon in your menubar, and then go to Preferences.

Refresh Interval

The refresh interval is how often the menubar will automatically refresh with new data. If set to never, the menubar will never automatically refresh, but a refresh can still be triggered from a Menu Item.

Importing & Exporting

In the preferences window, you can export your configuration as a .bar file. You can also import .bar configuration files from the preferences window. If you want a shortcut to import configuration files, you can hold Shift while clicking Preferences in the menubar or you can just double click on a .bar file.

Icon Downloader

The icon downloader allows you to easily download icons from materialdesignicons.com. I would recommend searching for icons on their website, then downloading them with the downloader. You can open the Icon Downloader by clicking Icon Downloader in the preferences window. All downloaded icons are stored in the Icons Folder.

Inputs

Menubar Configuration

In the preferences window, under Config is where you will put the JSON which creates your custom menubar.

Example

{
  "items": [
    {
      "type": "label",
      "label": "So much customization!"
    }
  ],
  "title": "Hello World!",
  "
}

Title

The title shows to the right of the icon in the menu bar. The title can be set by adding the title key to the main JSON. The title should be a string and templating is supported (scroll down for more info on templating).

Example


{
  "items": [],
  "title": "Hello!"
}

Note

Menu Item Types

There are 4 types of Menu Items

Type: label

Note

Examples

{
  "type": "label",
  "label": "No Action"
},
{
  "type": "label",
  "label": "Reload",
  "reload": true
},
{
  "type": "label",
  "label": "Checked + Reload",
  "reload": true,
  "checkedTemplate": "true"
},
{
  "type": "label",
  "label": "Action",
  "action": {
    "domain": "light",
    "service": "toggle",
    "serviceData": {
      "entity_id": "light.my_light"
    }
  }
}

Type: dropdown

Creates a dropdown menu

Example

{
  "type": "dropdown",
  "label": "Dropdown",
  "items": [
    {
      "type": "label",
      "label": "Item 1"
    },
    {
      "type": "label",
      "label": "Item 2"
    },
    {
      "type": "label",
      "label": "Item 3"
    }
  ]
}

Type: separator

Example

{
  "type": "normal",
  "label": "Item 1"
},
{
  "type": "separator"
},
{
  "type": "normal",
  "label": "Item 2"
}

Type: open_hass

Looks like a label but opens Home Assistant in your browser when clicked.

MenuAction

A MenuAction is how you can interact with Home Assistant.

Example

{
  "domain" : "light",
  "service": "toggle",
  "serviceData": {
    "entity_id": "light.my_light"
  }
}

Icons

To add an icon to your Menu Bar follow these steps

Recommendations

High Resolution Image

To make your image look better in the Menubar you can make it "High Resolution" which increases the DPI. Here are the following options:

Just add one of these to the end of your file.

Example

icon.png -> icon@2x.png

Icon Templates

It is recommended that your icons are made a template. To make your icon a template

File Name Examples

More Information Here

Templating

The customization is not over! You can also use Home Assistant Templates in certain fields!

Supported Fields

Converting To Templates

To make a field a template just add Template to the end of the field name and put your template in the value.

Example

{
  "label": "State of my light"
}

Turns into...

{
  "labelTemplate": "{{ states('light.my_light') }}"
}