This Docker container checks every 12 hours for new promo codes for Honkai Impact 3rd and triggers and event in Home Assistant via MQTT.
The container uses the /mnt directory to store its persistent data. Simply add -v <volume_or_bind>:/mnt to the
docker run command to persist changes across container restart or updates.
| NAME | DEFAULT | TYPE | DESCRIPTION |
|---|---|---|---|
HASS_HOST |
homeassistant.lan |
Hostname or IP | The hostname or IP of the Home Assistant host |
HASS_USER |
user |
String | The username to use for MQTT |
HASS_PASS |
password |
String | The password to use for MQTT |
LOG_LEVEL |
INFO |
String or Integer | The logging level. Uses Python logging library's levels |
RETRY_DELAY |
10 |
Integer | The delay in minutes between check attempts when something fails |
When new promo codes are found, a trigger event is sent to Home Assistant with an attached payload. The payload is a JSON object defined by the below JSON Schema:
{
"type": "object",
"properties": {
"active": {
"type": "array",
"items": {
"type": "string"
}
},
"expired": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"active",
"expired"
]
}The active list contains all valid promo codes from the ones found and the expired list contains expired ones
respectively.
A sample payload may look like this:
{
"active": [
"VERYPROMO",
"MUCHCODE"
],
"expired": [
"SUCHSAD",
"NOCRYSTALS"
]
}This example shows how to show a persistent notification in the Home Assistant frontend when new promo codes are found. This uses a single automation for everything (including formatting).
- Create a new automation
- In the
Whensection, clickADD TRIGGER→Device - Select
Honkai Impact 3rd Promosas the device "found_new" codesshould be auto selected as the trigger- In the
Then dosection, clickADD ACTION→Notifications→Send a persistent notification - Click the three dots in the block and select the
Edit in YAMLoption - Set the
data: {}line to the below snippet - Click the
SAVEbutton in the bottom right corner and name the automation - Profit?
data:
message: >
{% if trigger.payload_json['active'] -%}
## Active promo codes:
{% for code in trigger.payload_json['active'] -%}
- {{ code }}
{% endfor -%}
{% if trigger.payload_json['expired'] -%}
***
{% endif -%}
{% endif -%}
{% if trigger.payload_json['expired'] -%}
## Expired promo codes:
{% for code in trigger.payload_json['expired'] -%}
- {{ code }}
{% endfor -%}
{% endif -%}
title: New promo codes foundThe above snippet does the following things:
- Shows a list with a header of active codes (if any)
- Add a separator between the two lists (if both are not empty)
- Shows a list with a header of expired codes (if any)
- Sets the notification title
honkai-promos is available under the GNU AGPLv3 license. See the LICENSE file for more information.



