![]()
A local Home Assistant custom integration for Bitaxe miners running AxeOS. Monitor your miner, compare your best share with the work performed, and build a dashboard with standard Home Assistant cards.
Luck is a statistical comparison, not progress towards winning a Bitcoin block. Every new hash is an independent attempt.
/api/system/info request every 30 seconds; configurable from 10 to 300 seconds.Firmware fields vary. Missing statistics become unavailable rather than being invented. Current numeric difficulty values and legacy strings such as 38.11M are supported. Full lifetime luck requires bestDiff plus totalHashes or totalLog2Work. Older firmware can use an approximate session calculation if bestSessionDiff, uptime and hashrate are available.
https://github.com/ulrischa/bitaxe-luck with type Integration.80.This repository is prepared for installation as a HACS custom repository. It is not claimed to be listed in the default HACS catalog.
Download this repository using Code → Download ZIP and extract it.
Copy the entire custom_components/bitaxe_luck directory into your Home Assistant configuration directory:
/config/custom_components/bitaxe_luck/manifest.json
/config/custom_components/bitaxe_luck/__init__.py
/config/custom_components/bitaxe_luck/brand/icon.png
...
manifest.json must be directly inside bitaxe_luck, not inside another nested project directory.
Restart Home Assistant, then add Bitaxe Luck under Settings → Devices & services.
No package include or configuration.yaml entry is required. If you previously installed the YAML package, remove its configuration to avoid duplicate sensors. Existing custom-integration users can replace the integration directory and restart; the domain and entity unique-ID scheme remain unchanged.
Use Reconfigure on the integration entry to change its address and Configure to change polling frequency. Reserve the miner's IP in your router. Devices without a MAC address in their API use a host-based identity; when reconfiguring those, make sure the address still belongs to the same physical miner.
The integration creates entities. It does not automatically create a dashboard.
views: at the top.Use an empty dashboard so you do not overwrite existing cards. Do not paste the entire file into a manual-card editor. For adding a card to an existing dashboard, copy only an individual item under cards: (starting with type:). A German version is available at examples/dashboard_de.yaml.
The dashboard includes a large luck gauge, key statistics, mining control and separate history charts. History fills as Home Assistant records new values; the integration does not import AxeOS's older history. The icon is bundled under brand/ for Home Assistant's integration UI.
| Metric | Meaning |
|---|---|
| Luck percentile | How the observed best share ranks among hypothetical mining runs with the same amount of hash work. Higher means luckier. |
| Luck vs median | Observed best difficulty divided by the median best difficulty expected for the same work. 1 is the median. |
| Block distance factor | Current network difficulty divided by lifetime best difficulty. Smaller is closer in difficulty, not cumulative progress. |
| Bits to block | max(0, log2(network difficulty / best difficulty)). A logarithmic difficulty ratio, not a literal count of missing zero bits in your hash. |
| Expected interval for best share | Mean waiting time for a share at least as difficult as your lifetime best, at the selected smoothed hashrate. |
| Equivalent block chance for work done | Hypothetical chance for that amount of work at today's network difficulty, not the true historical probability across difficulty changes. |
| Block chance per 24 h | Hypothetical probability over 24 hours at the selected hashrate and unchanged network difficulty. |
| Expected block interval | Statistical mean, not a deadline or prediction for your next block. |
The luck gauge uses these descriptive bands: below 10 very unlucky, 10–25 unlucky, 25–75 normal, 75–90 lucky, and 90–100 very lucky. A percentile of 90 means a better best share than approximately 90% of equal-work runs; it does not mean a 90% chance of a block.
Probability sensors use ppm to make tiny values readable: 1 ppm = 0.0001% = one in a million. Hashrates are reported in GH/s (1,000 GH/s = 1 TH/s). Efficiency is J/TH; lower is better at a comparable operating point.
Let N be the number of hashes, D the observed best share difficulty, Dn network difficulty, and H hashrate in hashes per second. Using the conventional mining approximation K = 2^32 and a Poisson model:
luck percentile = 100 × exp(-N / (K × D))
median best difficulty = N / (K × ln(2))
probability of ≥1 block = 1 - exp(-N / (K × Dn))
mean time for ≥D share = K × D / H
The code uses expm1 for very small probabilities. The 2^32 convention is an approximation to Bitcoin's difficulty-one target; displayed figures are estimates.
The Luck percentile entity includes calculation_basis, hashes_used, and best_difficulty_used attributes:
lifetime_total_hashes: totalHashes paired with bestDiff.lifetime_log2_work: 2^totalLog2Work paired with bestDiff.session_estimate: smoothed hashrate × uptime paired only with bestSessionDiff.AxeOS itself estimates cumulative work by integrating measured hashrate. The inspected firmware periodically persists these counters; sudden power loss may lose recent work. A firmware upgrade that introduced work tracking can leave an older best share with a newer work counter. Independent resets or differing counter start dates also invalidate the comparison. The integration cannot reconstruct missing history or detect every such mismatch.
Session estimates use the first positive available average in this order: 1 hour, 10 minutes, 1 minute, instantaneous. Multiplying a recent average by the entire uptime is only a rough estimate: earlier pauses, changing frequency, connection losses and warm-up can distort it. Waiting times and 24-hour forecasts assume continued operation at that selected rate; they may still show an operating-rate forecast while mining is paused. No available matching work/share pair means no luck value.
The ratio to block difficulty uses the current network value, not necessarily the network difficulty at the moment a past share was found. There is no fixed network-difficulty constant and no external difficulty service.
Only /api/system/info is polled. Pause, resume, restart and identify use their corresponding local POST /api/system/... endpoints when you explicitly activate a control. This integration does not change pool credentials, overclocking settings or firmware, and does not make cloud requests.
The mining switch requires a boolean miningPaused API field. Firmware without that field leaves it unavailable. Unsupported command endpoints return an error; availability of the identify action varies by firmware. Turning mining off means pause, not disconnecting electrical power. Turning it on means resume, not proof that the pool is accepting shares.
Keep AxeOS on a trusted local network. This client supports HTTP, not authenticated proxies or HTTPS. API redirects are rejected. No wallet address or API password is needed in this integration's setup dialog.
bitaxe_luck.http://YOUR-BITAXE-IP/api/system/info. It should return a JSON object with mining/device fields. HTML, redirects, a 401/403 restriction, a wrong endpoint or incompatible firmware can all cause this message. It does not prove the IP is wrong. Inspect logs and the actual HTTP response.When reporting a problem, include Home Assistant and AxeOS versions, the relevant error and a redacted API sample. Remove wallet addresses, pool credentials, Wi-Fi/network identifiers and other personal data before posting.
Core tests can run with Python 3.12+ and aiohttp:
python -m pip install aiohttp
python -m unittest discover -s tests -v
python -m compileall -q custom_components
The CI workflow additionally installs the supported Home Assistant baseline and runs python tests/ha_smoke.py against its real imports, entity classes, switch actions and setup flow. The core tests use a local HTTP test server; they never access a real miner. Automated checks do not replace an end-to-end installation and dashboard test with physical hardware.
Independent community project, not an official Bitaxe or Home Assistant integration. MIT license; see LICENSE.
5 commits
Python
100.0%
![]()
A local Home Assistant custom integration for Bitaxe miners running AxeOS. Monitor your miner, compare your best share with the work performed, and build a dashboard with standard Home Assistant cards.
Luck is a statistical comparison, not progress towards winning a Bitcoin block. Every new hash is an independent attempt.
/api/system/info request every 30 seconds; configurable from 10 to 300 seconds.Firmware fields vary. Missing statistics become unavailable rather than being invented. Current numeric difficulty values and legacy strings such as 38.11M are supported. Full lifetime luck requires bestDiff plus totalHashes or totalLog2Work. Older firmware can use an approximate session calculation if bestSessionDiff, uptime and hashrate are available.
https://github.com/ulrischa/bitaxe-luck with type Integration.80.This repository is prepared for installation as a HACS custom repository. It is not claimed to be listed in the default HACS catalog.
Download this repository using Code → Download ZIP and extract it.
Copy the entire custom_components/bitaxe_luck directory into your Home Assistant configuration directory:
/config/custom_components/bitaxe_luck/manifest.json
/config/custom_components/bitaxe_luck/__init__.py
/config/custom_components/bitaxe_luck/brand/icon.png
...
manifest.json must be directly inside bitaxe_luck, not inside another nested project directory.
Restart Home Assistant, then add Bitaxe Luck under Settings → Devices & services.
No package include or configuration.yaml entry is required. If you previously installed the YAML package, remove its configuration to avoid duplicate sensors. Existing custom-integration users can replace the integration directory and restart; the domain and entity unique-ID scheme remain unchanged.
Use Reconfigure on the integration entry to change its address and Configure to change polling frequency. Reserve the miner's IP in your router. Devices without a MAC address in their API use a host-based identity; when reconfiguring those, make sure the address still belongs to the same physical miner.
The integration creates entities. It does not automatically create a dashboard.
views: at the top.Use an empty dashboard so you do not overwrite existing cards. Do not paste the entire file into a manual-card editor. For adding a card to an existing dashboard, copy only an individual item under cards: (starting with type:). A German version is available at examples/dashboard_de.yaml.
The dashboard includes a large luck gauge, key statistics, mining control and separate history charts. History fills as Home Assistant records new values; the integration does not import AxeOS's older history. The icon is bundled under brand/ for Home Assistant's integration UI.
| Metric | Meaning |
|---|---|
| Luck percentile | How the observed best share ranks among hypothetical mining runs with the same amount of hash work. Higher means luckier. |
| Luck vs median | Observed best difficulty divided by the median best difficulty expected for the same work. 1 is the median. |
| Block distance factor | Current network difficulty divided by lifetime best difficulty. Smaller is closer in difficulty, not cumulative progress. |
| Bits to block | max(0, log2(network difficulty / best difficulty)). A logarithmic difficulty ratio, not a literal count of missing zero bits in your hash. |
| Expected interval for best share | Mean waiting time for a share at least as difficult as your lifetime best, at the selected smoothed hashrate. |
| Equivalent block chance for work done | Hypothetical chance for that amount of work at today's network difficulty, not the true historical probability across difficulty changes. |
| Block chance per 24 h | Hypothetical probability over 24 hours at the selected hashrate and unchanged network difficulty. |
| Expected block interval | Statistical mean, not a deadline or prediction for your next block. |
The luck gauge uses these descriptive bands: below 10 very unlucky, 10–25 unlucky, 25–75 normal, 75–90 lucky, and 90–100 very lucky. A percentile of 90 means a better best share than approximately 90% of equal-work runs; it does not mean a 90% chance of a block.
Probability sensors use ppm to make tiny values readable: 1 ppm = 0.0001% = one in a million. Hashrates are reported in GH/s (1,000 GH/s = 1 TH/s). Efficiency is J/TH; lower is better at a comparable operating point.
Let N be the number of hashes, D the observed best share difficulty, Dn network difficulty, and H hashrate in hashes per second. Using the conventional mining approximation K = 2^32 and a Poisson model:
luck percentile = 100 × exp(-N / (K × D))
median best difficulty = N / (K × ln(2))
probability of ≥1 block = 1 - exp(-N / (K × Dn))
mean time for ≥D share = K × D / H
The code uses expm1 for very small probabilities. The 2^32 convention is an approximation to Bitcoin's difficulty-one target; displayed figures are estimates.
The Luck percentile entity includes calculation_basis, hashes_used, and best_difficulty_used attributes:
lifetime_total_hashes: totalHashes paired with bestDiff.lifetime_log2_work: 2^totalLog2Work paired with bestDiff.session_estimate: smoothed hashrate × uptime paired only with bestSessionDiff.AxeOS itself estimates cumulative work by integrating measured hashrate. The inspected firmware periodically persists these counters; sudden power loss may lose recent work. A firmware upgrade that introduced work tracking can leave an older best share with a newer work counter. Independent resets or differing counter start dates also invalidate the comparison. The integration cannot reconstruct missing history or detect every such mismatch.
Session estimates use the first positive available average in this order: 1 hour, 10 minutes, 1 minute, instantaneous. Multiplying a recent average by the entire uptime is only a rough estimate: earlier pauses, changing frequency, connection losses and warm-up can distort it. Waiting times and 24-hour forecasts assume continued operation at that selected rate; they may still show an operating-rate forecast while mining is paused. No available matching work/share pair means no luck value.
The ratio to block difficulty uses the current network value, not necessarily the network difficulty at the moment a past share was found. There is no fixed network-difficulty constant and no external difficulty service.
Only /api/system/info is polled. Pause, resume, restart and identify use their corresponding local POST /api/system/... endpoints when you explicitly activate a control. This integration does not change pool credentials, overclocking settings or firmware, and does not make cloud requests.
The mining switch requires a boolean miningPaused API field. Firmware without that field leaves it unavailable. Unsupported command endpoints return an error; availability of the identify action varies by firmware. Turning mining off means pause, not disconnecting electrical power. Turning it on means resume, not proof that the pool is accepting shares.
Keep AxeOS on a trusted local network. This client supports HTTP, not authenticated proxies or HTTPS. API redirects are rejected. No wallet address or API password is needed in this integration's setup dialog.
bitaxe_luck.http://YOUR-BITAXE-IP/api/system/info. It should return a JSON object with mining/device fields. HTML, redirects, a 401/403 restriction, a wrong endpoint or incompatible firmware can all cause this message. It does not prove the IP is wrong. Inspect logs and the actual HTTP response.When reporting a problem, include Home Assistant and AxeOS versions, the relevant error and a redacted API sample. Remove wallet addresses, pool credentials, Wi-Fi/network identifiers and other personal data before posting.
Core tests can run with Python 3.12+ and aiohttp:
python -m pip install aiohttp
python -m unittest discover -s tests -v
python -m compileall -q custom_components
The CI workflow additionally installs the supported Home Assistant baseline and runs python tests/ha_smoke.py against its real imports, entity classes, switch actions and setup flow. The core tests use a local HTTP test server; they never access a real miner. Automated checks do not replace an end-to-end installation and dashboard test with physical hardware.
Independent community project, not an official Bitaxe or Home Assistant integration. MIT license; see LICENSE.
5 commits
Python
100.0%