Skip to content

jpawlowski/hass.action_result

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Action Result Entities

GitHub Release GitHub Activity License

hacs Project Maintenance

A Home Assistant custom integration that exposes entities whose attributes are populated from the response data of Home Assistant services/actions.

✨ What It Does

This integration creates sensor entities that:

  1. Call any Home Assistant service at configurable intervals
  2. Capture the service response data
  3. Expose the complete response in the sensor's data attribute

This is a "service response → attribute bridge" that allows Dashboards and cards (which only work with entity states and attributes) to display data from service responses.

🎯 Use Cases

  • Display Tibber price data from tibber.get_price_info in a dashboard
  • Show weather forecast data in custom cards
  • Access calendar events in Lovelace
  • Any service that returns response data with return_response: true

⚠️ Important Notes

  • This integration is for advanced users who understand YAML and service calls
  • Large responses and short polling intervals can impact:
    • Home Assistant performance
    • Database/Recorder size
    • Frontend rendering speed
  • The data attribute contains the raw service response - format varies by service

🚀 Quick Start

Step 1: Install the Integration

Prerequisites: This integration requires HACS (Home Assistant Community Store).

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

Then:

  1. Click "Download" to install the integration
  2. Restart Home Assistant (required after installation)

Step 2: Add a Action Result Entity

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

Configure:

  1. Name: A friendly name for this sensor (e.g., "Tibber Prices")
  2. Action Domain: The service domain (e.g., tibber)
  3. Action Name: The service name (e.g., get_price_info)
  4. Action Data (YAML): Optional YAML data for the service call

Tip: Copy the YAML directly from Developer Tools → Actions

Step 3: Access the Data

The sensor exposes:

  • State: ok or error
  • Attributes:
    • data: The complete service response
    • service: The service that was called
    • last_update: When the data was last refreshed
    • success: Whether the last call succeeded
    • error_message: Error details (if any)

Example template to access the data:

{{ state_attr('sensor.tibber_prices', 'data') }}

📋 Configuration Options

Initial Setup

Field Required Description
Name Yes Friendly name for the sensor
Action Domain Yes Domain of the service to call
Action Name Yes Name of the service to call
Action Data (YAML) No Optional YAML data for the service

Options (After Setup)

Option Default Description
Polling Interval 300s How often to call the service (10-86400 seconds)

📝 Example Configurations

Example 1: Tibber Price Info

Action Domain: tibber Action Name: get_price_info Polling Interval: 3600 (1 hour)

The sensor's data attribute will contain the price information returned by Tibber.

Example 2: Simple Test (No External Actions Required)

To test the integration without requiring external integrations:

Action Domain: homeassistant Action Name: reload_core_config Action Data (YAML): (leave empty) Polling Interval: 300

This will call a built-in Home Assistant service. The sensor state will show ok if successful.

Note: This service doesn't return data, so the data attribute will be None. Use a service that returns data (like tibber.get_price_info) to see actual response data.

🔧 Troubleshooting

Action Not Found

Verify the service exists in Developer Tools → Actions.

YAML Parse Error

Check your YAML syntax. The service data must be valid YAML with key: value pairs.

Empty Data Attribute

  • Verify the service supports return_response
  • Check if the service requires specific input data
  • Review Home Assistant logs for errors

Enable Debug Logging

logger:
  default: info
  logs:
    custom_components.action_result: debug

🤝 Contributing

Contributions are welcome! Please open an issue or pull request.

Open in GitHub Codespaces

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with ❤️ by @jpawlowski


About

A Home Assistant custom integration that exposes entities whose attributes are populated from the response data of Home Assistant service actions.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors