/hacs-anylist

Home Assistant integration for Anylist

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Home Assistant Integration For Anylist

Prerequisites

This integration requires Home Assistant Addon For Anylist. Please install and configure the addon first before setting up this integration.

Installation

You can install this custom integration using HACS. It is not a part of the official list of repositories but you can add it as a custom repository.

If you already have HACS installed, you can simply click this button:

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

Add Integration

After installing the custom integration, you have to add the integration to Home Assistant. You may do so manually by going to the Settings -> Devices & Services -> Integrations page in Home Assistant, or by clicking the button:

Open your Home Assistant instance and start setting up a new integration.

Configuration

The integration will prompt for the address of the Anylist Home Assistant addon server during setup. The address includes the scheme (currently only plain-text http is supported), hostname or IP, and port of the server. For example, if you're running the addon locally and have it configured to listen on port 1234, the server address would be http://127.0.0.1:1234. Please do not include a trailing slash at the end of the address.

Usage

There are three ways to use this integration: service calls, Home Assistant To-do lists, and Home Assistant intents.

Service Calls

The integration has five services: anylist.add_item, anylist.remove_item, anylist.check_item, anylist.uncheck_item, and anylist.get_items.

anylist.add_item

Parameters:

Parameter Required Description
name Yes The name of the item
notes No Notes for the item
list No The name of the list

Example service call:

service: anylist.add_item
data:
  name: milk
  notes: Skim milk
  list: Shopping

anylist.remove_item

Parameters:

Parameter Required Description
name Yes The name of the item
list No The name of the list

Example service call:

service: anylist.remove_item
data:
  name: milk
  list: Shopping

anylist.check_item

Parameters:

Parameter Required Description
name Yes The name of the item
list No The name of the list

Example service call:

service: anylist.check_item
data:
  name: milk
  list: Shopping

anylist.uncheck_item

Parameters:

Parameter Required Description
name Yes The name of the item
list No The name of the list

Example service call:

service: anylist.uncheck_item
data:
  name: milk
  list: Shopping

anylist.get_items

Parameters:

Parameter Required Description
list No The name of the list

Response: A dictionary containing the field items which contains an array of items on the list

Example service call:

service: anylist.get_items
data:
  list: Shopping

Example response:

items:

Home Assistant To-do Lists

The integration supports the to-do lists feature introduced in Home Assistant 2023.11.0. The to-do list feature enables displaying and managing Anylist lists in the Home Assistant UI. See the release notes for more details. A corresponding todo entity will be created by the integration for each available Anylist list.

Home Assistant Intents

Assist

If you wish to use this integration with Home Assistant Assist, Home Assistant 2023.12.0 added support for adding items to to-do lists using intents. For more details, see built-in intents and the intents repository.

However, the built-in intents are very limited in functionality. It currently only supports adding items to lists. For the ability to remove and query items, custom sentences need to be added. To add custom sentences, download and place the custom_sentences directory in this repository into the config directory of your Home Assistant installation. For more details, see Adding support for custom sentences.

The custom_sentences directory contains a few starter commands allowing you to modify and query your Anylist. For example:

  • Adding an item: Add {item} to my list
  • Removing an item: Remove {item} from my list
  • Getting items: What's on my list

Slight sentence variations are supported in order to capture more commands. If you wish to customize the commands yourself, see Template sentence syntax.

Automation

Home Assistant 2023.8.0 introduced support for wildcards in sentence triggers for automations. As a result, you can build your own Anylist automation by combining sentence triggers and the service calls provided by this integration to match your own needs.

If you wish, you can also import these pre-built blueprints into your Home Assistant to get started quickly.

Adding an item:

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Removing an item:

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Getting items:

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Category Matching

By default, the integration will apply the "Other" category to added items. However, it also attempts to automatically apply categories to your added items by looking up the categories of recently added items stored on your Anylist account. As such, if you fix the category of added items manually, the integration will "learn" over time and apply the correct categories in the future. I guess you can call this machine learning 😆

Options

The integration allows you to specify the name of the default Anylist list to use if none are specified in the service call. The default list name is also used for Home Assistant intents.