Skip to content

gensyn/HomeAssistantPlugin

Repository files navigation

HomeAssistantPlugin for StreamController

Control your Home Assistant instance from your StreamDeck

This is no official plugin - I have no affiliation with Home Assistant, StreamDeck or StreamController.

Prerequisites

  • websocket_api must be present in your configuration.yaml. Remember to restart Home Assistant after updating your configuration.
  • You need a long-lived access token to connect to Home Assistant. To create one, go to your user profile and click on the Security tab. All the way at the bottom of the page is a button to create a new token. You can only see/copy the token immediately after creating it. Once you dismiss the dialog, you won't be able to retrieve the token.
    Be very careful with your Home Assistant information and your token. If your Home Assistant instance is accessible from the internet, anyone with this information can access and control your Home Assistant instance.

Features

  • Perform an action
    • Parameters for the action can be provided
    • The action is always called on key_down, i.e. immediately when the button is pressed
      • To change this behavior, the built-in Event Assigner can be used to
        • map other events to key_down, if you want to call the service on a different event (multiple events are possible)
        • map key_down to None, if you don't want to call the service on key_down
  • Show an icon
    • This can be the entity icon or a custom icon
    • Color, scale and opacity of the icon can be customized
    • All icon settings can also be customized based on state or attribute values
      • Customizations are reevaluated when the entity is updated
  • Show text
    • This can be the entity state, an attribute value or custom text
    • If the entity's state changes, the text is updated on the StreamDeck
    • Position, text size, text color, outline size and outline color of the text can be customized
    • Optionally show the unit of measurement (with or without line break)
    • All text settings can also be customized based on state or attribute values
      • Customizations are reevaluated when the entity is updated

Documentation

Plugin settings

To open the Home Assistant plugin settings, open your StreamController settings and select the tab Plugins. Look for the entry for Home Assistant and click Open Settings.

Plugin settings

Once all necessary information is entered, the plugin automatically tries to connect to Home Assistant. If you are using a self-signed certificate, you should disable Verify certificate or the connection will fail.
If the connection can't be established or is lost, the plugin automatically tries to reconnect to the server every 10 seconds.

Perform action

This action allows you to perform an action in Home Assistant.

Action settings service

You can pick the action and optionally an entity, if the action requires one. Parameters for the action are also optional but the list of parameters contains all possible parameters for the action; this does not guarantee, that the entity supports the parameter.
Only parameters that have their checkbox checked are included when performing the action.

Show icon

This action allows you to show an icon based on Home Assistant data.

Action settings icon

After picking in entity, by default this shows the icon defined in Home Assistant for the entity; or nothing, if no icon is defined. In the Icon field you can define an icon which overrides the setting from Home Assistant. Valid are all icons from the Material Design Icon collection.
You can also adapt color, scale and opacity of the icon there.

Show icon customization

To create a new icon customization, click the button ( Action settings icon add customization) in the Customize row. A new window opens where you can enter a condition and how the icon should change if the condition is met.

Action settings icon customization

Only settings whose checkbox is checked are honored.
When you have created customizations, they are shown under Customize.

Action settings icon customizations

Customizations are cascading and evaluated in order. This means, multiple customizations might have conditions that are met, but the latest matching customization sets the eventual value for an option. In the example above, both customizations' conditions are met, but the icon shown would be lamp as this is the latest matching customization.
For convenience, the current value that the condition is evaluated against, is also shown, and with the buttons, you can edit, delete and rearrange your customizations.

Show text

This action allows you to show text based on Home Assistant data.

Action settings text

After picking an entity, you can configure how the text is shown.
With Position you can change where on the key the text is shown. Attribute allows you to change what value of the entity is displayed; either the state, or the value of an attribute.
When Round value is active, the plugin tries to convert the value to a float number and round it to the defined Precision. This has no effect if the value cannot be converted.
Text size and Outline size change the size of the text and the outline respectively and the same goes for Text color and Outline color but for color.
If the entity state is picked to be displayed and the entity has a unit of measurement set in Home Assistant, the option Show unit of measurement becomes available. When the option is activated, additionally the option Line break between value and unit becomes available as well. They do exactly what the labels say.

Show text customization

To create a new text customization, click the button ( Action settings text add customization) in the Customize row. A new window opens where you can enter a condition and how the text should change if the condition is met.

Action settings text customization

Only settings whose checkbox is checked are honored.
When you have created customizations, they are shown under Customize.

Action settings text customizations

Just as with icon customization, text customizations are cascading and evaluated in order. This means, multiple customizations might have conditions that are met, but the latest matching customization sets the eventual value for an option. In the example above, only the second customization matches the condition so the text size is set to 12.
As an Attribute you can also select custom_text which shows a new field where you can enter any text to be displayed instead of the original. This allows you to create your own translations on the Stream Deck. Furthermore, %s in the custom_text field is replaced by the original text and \n creates a line break. As an example: on a weather entity that has an attribute for the temperature you can select the temperature to be displayed and then create a customization with custom text %s\n°C which results in the temperature being displayed in the first line and "°C" in the second.
For convenience, the current value that the condition is evaluated against, is also shown, and with the buttons, you can edit, delete and rearrange your customizations.

Examples

Weather button

Weather button
Action Show text used with a weather entity.

Toggle button

boolean toggle button
Action Show icon and action Perform action used with the same input_boolean entity. Show icon is customized to change the icon color to yellow when the input_boolean is on. Perform action toggles the input_boolean's state.

Media Player button

media player button
Action Show icon, action Perform action and two actions Show text used with the same media player entity. Show icon shows the custom icon play except when the media player is playing, then it shows the custom icon pause. Perform action performs the action media_play_pause on the media player entity. The two Show text actions show the media title and artist respectively.

Air quality button

air quality button
Action Show text, action Perform action and action Show icon used with a CO2 sensor and a ventilator entity respectively. Show text shows the CO2 sensor value with unit of measurement and line break between value and unit. Show icon shows the ventilator icon at 50% opacity. Perform action toggles the ventilator on/off.

Planned features

  • None at the moment

Problems?

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages