Contents
A fire that could relight itself
There's an Escea gas fireplace at my grandparents' place, and I wanted it in Home Assistant with everything else: on and off, the temperature, the fire's own timers, and an automation at night to make sure it's off. Escea fires have a network controller, so this looked like an afternoon's job. There were already two ways to do it.
Home Assistant has a built-in Escea integration, built on a library called pescea. Before that there was a community custom component, snikch/climate.escea, which did the original work of capturing the fire's messages. My plan was to tidy one of them up and add what I was missing.
Then I read pescea's sync code closely. It keeps the settings it last sent, and when the fire comes back after a missed status reply, it sends them again, power included. So if someone turns the fire off with the remote or the Escea app, and one poll goes unanswered at the wrong moment, the library can send POWER_ON and light the fire again. It's written up as pescea issue #8.
For a gas appliance, "eventually consistent" is the wrong design.
That one bug decided the shape of the whole project. I ended up with three pieces:
- A new library, aioescea, on PyPI. Async, typed, and with no background loop at all, so a missed reply can't cause an old command to be re-sent.
- A new integration, ha-escea-fireplace, under its own domain,
escea_fireplace, alongside the built-in one rather than replacing it. - An upstream fix to pescea (pull request #9), so anyone on the built-in integration gets the safety fix too. It only re-sends a setting that was changed while the fire was unreachable; everything else comes from the fire.
The examples on this page use made-up values. Where the integration shows up in Home Assistant, the household is Alex, Sam and Jordan.
Two generations, three interfaces
Escea has made two kinds of network controller, and they have nothing in common on the wire.
Generation 2 fires have an Ethernet port. They speak a small UDP protocol on port 3300, written up by Kamahi Electronics for Escea in 2014 (version 0.3, which Escea confirmed this November is still current). That covers on, off, the target temperature, fan boost, flame effect and the room temperature. Everything else, the fire's two daily timers, its clock and a diagnostics page, lives on a little web server on port 80. Its login posts MD5 hashes of a username and password, which on most fires are the serial number and the PIN.
Generation 3 fires, from 2024, are Wi-Fi only and have no UDP protocol at all. They have Escea's Network Communication API, NCAPI: HTTP and JSON on port 80, with a richer picture of what the fire is doing (starting, igniting, heating, pilot only, shutting down, error) and a range of 10 to 38 °C. It's off by default and has to be turned on in the Escea Smartheat app.
| Generation 2 (Ethernet) | Generation 3 (Wi-Fi) | |
|---|---|---|
| Control | UDP, port 3300 | NCAPI, HTTP and JSON, port 80 |
| Target temperature | 4 to 30 °C, whole degrees | 10 to 38 °C, in tenths |
| What it's doing | On or off | Eleven states, from starting to error |
| Timers, clock, diagnostics | From the web page on port 80 | Not available |
| Found by | Broadcast, or its MAC prefix AC:DE:48 | Its address (it needs a DHCP reservation) |
| Quirks | Ignores commands for ~66 s after a power change | Refuses requests sent too quickly; the library leaves 1 s between them |
The web page is the fragile part. It serves one connection at a time, takes 10 to 20 seconds a page, and under load it can stop answering until the fire is turned off at the wall. The library talks to it one request at a time, closes every connection, and Home Assistant reads it every 10 minutes by default, backing off if it struggles.
Fifteen bytes over UDP
The Generation 2 protocol is refreshingly small. Every message, in either direction, is exactly 15 bytes: a start byte, a command, a data size, ten bytes of data, a checksum and an end byte. The start and end bytes are the letters "G" and "F". The checksum is the sum of bytes 1 to 12, modulo 256.
# aioescea/protocol.py, trimmed
def crc(frame: bytes | bytearray) -> int:
"""Return the checksum of a frame (sum of bytes 1 to 12, modulo 256)."""
return sum(frame[1:13]) % 256
def encode(command: int, data: bytes = b"") -> bytes:
frame = bytearray(15)
frame[0] = 0x47 # "G"
frame[1] = command
frame[2] = len(data)
frame[3 : 3 + len(data)] = data
frame[13] = crc(frame)
frame[14] = 0x46 # "F"
return bytes(frame)
Build a frame below. Pick a command, or switch to a status reply and change what the fire reports, and watch the checksum follow. Or paste a frame to decode it, with the same checks the library makes.
47 57 01 13 00 00 00 00 00 00 00 00 00 6B 46
Checksum 0x57 + 0x01 + 0x13 = 0x6B
Meaning NEW_SET_TEMP, 19 °C. The fire answers with 0x66, NEW_SET_TEMP_ACK.
| Command | Id | Data | Reply |
|---|---|---|---|
STATUS_PLEASE | 0x31 | none | STATUS 0x80, 6 bytes: new timers, on, boost, flame effect, target, room |
POWER_ON / POWER_OFF | 0x39 / 0x3A | none | 0x8D / 0x8F |
FAN_BOOST_ON / OFF | 0x37 / 0x38 | none | 0x89 / 0x8B |
FLAME_EFFECT_ON / OFF | 0x56 / 0x55 | none | 0x61 / 0x60 |
NEW_SET_TEMP | 0x57 | 1 byte, °C, 4 to 30 | 0x66 |
SEARCH_FOR_FIRES | 0x50 | none | I_AM_A_FIRE 0x90: serial number and PIN |
Two details from real fires aren't in the spec. Discovery replies (I_AM_A_FIRE) report a data size of 4 although they carry six bytes, so the decoder doesn't check the size there. And every reply has its own id, so the library only accepts the one it's waiting for. A stray or late datagram can never be taken as success for something else.
One socket for every fire
The awkward thing about port 3300 is that fires always reply to port 3300, whatever port the request came from. A program can't just open a random port per request and wait. So aioescea has one transport per process: a single UDP socket bound to 3300, shared by every fire and by Home Assistant's config flow. Each reply is routed to whoever is waiting for it by two things, the sender's IP address and the response id.
The transport follows three rules learned from the hardware:
- One request per fire at a time. The controller is single threaded, so each fire has its own lock.
- Retry, because UDP drops packets. Each request waits 3.5 seconds for its reply and is sent up to three times in all. The spec says replies take "in most cases under 3 seconds".
- Nothing is sent on a timer. A command goes out because a caller asked for it, once, and that's the end of it.
Then there's the socket option I deliberately left out.
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
# No SO_REUSEADDR or SO_REUSEPORT on purpose. With either, a second program
# can share the port and the kernel then hands every reply from a given fire
# to just one of the sockets, so the other program silently stops hearing
# the fire. Failing loudly is better.
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
sock.bind(("0.0.0.0", 3300)) # EADDRINUSE becomes EsceaPortInUseError
aioescea/transport.py. If the built-in integration, the old custom component or a second Home Assistant already holds the port, you find out straight away.In Home Assistant that error becomes a Repairs issue that says another program has UDP 3300. A second Repairs issue warns if the built-in Escea integration is installed at the same time, before it gets that far. "Keeps going unavailable" is a much worse symptom to debug than "port in use".
Finding fires works on the same socket. The config flow broadcasts SEARCH_FOR_FIRES on every network Home Assistant is on. When you type an address instead, it sends the same command straight to that address, which works across VLANs where a broadcast wouldn't. And if a fire stops answering three polls in a row, the integration searches for it by serial number, in case its DHCP address has changed.
Sixty-six seconds
After a Generation 2 fire is turned on or off, it ignores commands for about 66 seconds while it lights, or purges the firebox with its fan. That number comes from pescea's author, who measured it with the Escea remote. During that minute a temperature or mode change simply vanishes.
The library tracks the window itself and refuses commands inside it with EsceaBusyError, telling you how long is left. The integration then decides what a person would expect:
- Temperature and mode changes are held and sent once the fire is ready, about two seconds after the window ends, but only if the fire is still on.
- Turning off is never refused, and it throws away anything held.
- Turning on is never held. If the fire is purging, you're told to try again; Home Assistant won't light it a minute later on its own.
- If someone else changes the power, with the remote, the app or the fire's own timer, the next poll notices and drops whatever was held.
- Boost and flame effect are refused while the fire is off, because on an Escea fire turning either one on also lights it.
Step through it yourself. The clock runs six times faster than real life, and every frame the integration would send appears in the log.
Fire Off
Target 21 °C
Mode Normal
What happened
coordinator.py and the library's fireplace.py. Time is sped up six times, and the reply to each frame is assumed to arrive. Try "Set 22.5 °C" while it's lighting, then tick the 0.1.0 box and turn off a fire that's already off.Wi-Fi fires don't need any of this. They report what they're doing (starting, igniting, heating) and the integration shows it as the thermostat's action and a State sensor. On Ethernet fires, a binary sensor called "Lighting or shutting down" is on for that minute instead, so a dashboard can explain why nothing is happening yet.
Rules for a gas appliance
Home Assistant can light this fire when nobody is in the room. The README says so in a warning box near the top, and the code is written as if that's the only thing that matters. These rules hold in the library or the integration, whatever an automation, a voice assistant or a dashboard asks for.
- Only when askedNo background loop and no buffered commands. A missed reply is never re-sent later.
- Right reply onlyEach command waits for its own response id, from the fire it was sent to.
- No accidental lightingBoost and flame effect are refused while the fire is off unless the caller passes
allow_ignite. The integration never does. - Off always worksTurning off is never refused, held or delayed, even mid-ignition.
- Held, not guessedChanges made while it lights are sent only if the fire is still on and nobody else changed its power.
- Optional limitA maximum run time of 1 to 12 hours. It only ever turns the fire off.
Here's how they play out in the situations I worried about.
The fire was turned off with the remote, and Home Assistant's last poll went unanswered.Only when asked
Nothing happens. The library has no idea of a "desired state" to restore. The next status read simply shows the fire off, and Home Assistant shows it off too. This is exactly the case pescea gets wrong.
A dashboard button sets Boost on a fire that's off.No accidental lighting
Refused with a message: The fire is off; turning on Boost or Flame effect would light it.
Turn it on first and pick the mode straight away. On Wi-Fi fires the check asks the fire itself, not the last 30 second poll, since the fire could have been turned off in between.
Someone turns the fire on, changes their mind ten seconds later and turns it off.Off always works
POWER_OFF goes out at once, mid-window. The library notes that the fire may only act on it once it's ready, so the integration reads the status again afterwards rather than assuming.
Saving a timer on the fire's web page while someone else turns the fire off.Held, not guessed
The web page's timer form also carries the fire's power switch, and the fire applies it. Earlier versions read the power once, before a login that can take a minute, so a save could turn the fire back on. Now the power is read again right before each POST. If it changed since the save began, nothing is sent and you're asked to try again.
The fire gets left on all night.Optional limit
With a maximum run time set, the integration turns it off after that many hours and fires an escea_fireplace_auto_off event for a notification. Nothing is saved over a restart: a fire that's on when Home Assistant starts is counted from then. It can run longer than the limit after a restart, but it's never turned off early.
What went wrong
The first release worked in the tests. Using it found the rest. Most of these are one line in a changelog and a long evening behind it.
The nightly "make sure it's off"
An automation at night turns the fire off, whether or not it's on. In 0.1.0 that started the 66 second busy window every time, even for a fire that was already off, so turning it on in the next minute was refused. Now the library checks the last status first: an off fire has nothing to purge, so it isn't busy. You can see both behaviours in the stepper above.
22.5 became 22
Generation 2 fires take whole degrees, so a half degree from an automation, a voice assistant or Apple Home has to be rounded. I used Python's round(), which rounds halves to the nearest even number. That's sensible for statistics and baffling on a thermostat: 22.5 became 22, but 23.5 became 24. The fix is a two-line helper, round_half_up, that always goes up.
round()22 °CHalf to evenround_half_up()23 °CHalves go up| Asked for | 18.5 | 19.5 | 20.5 | 21.5 | 22.5 | 23.5 | 24.5 | 25.5 |
|---|---|---|---|---|---|---|---|---|
round() | 18 | 20 | 20 | 22 | 22 | 24 | 24 | 26 |
| Half up | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
math.floor(value + 0.5).The login that worked in a browser
The fire's web login worked in a browser and hung from Home Assistant every time. aiohttp sends a POST's headers and its form in two separate TCP segments. The fire's server reads the first, then waits for a body that has already arrived and that it never looks at. The library now writes each POST as one raw packet and reads the reply only until the page is complete, because the server doesn't always close the connection either. Before that, the timeouts were too short: pages often take 10 to 20 seconds, so a working login was reported as "didn't answer". It now gets 60 seconds.
Two smaller web page fixes came with it. When the login token had expired, saving a timer failed with "did not save"; now it logs in once more and resends. And reading the page, which can take ten seconds or more, held up the 30 second status poll and the refresh after every command. It now runs in the background after the first read.
Wi-Fi fires that DHCP couldn't see
Home Assistant watches DHCP for devices with Escea's AC:DE:48 MAC prefix, and for fires it already knows. In the first release that step only knew how to talk to Ethernet fires, so a Wi-Fi fire it heard from was turned away, and one that moved to a new address was lost. Now it asks over NCAPI first, then UDP, and a known fire that moves is updated automatically.
Setting it up
Everything is set up from the UI. Leave the address blank and it searches; type an address and it checks for a Wi-Fi fire first (giving up after 5 seconds), then asks over UDP. If more than one new fire answers, you pick. For Ethernet fires it then tries the web login with the serial number and PIN the fire reported, so on most fires the timers and diagnostics just work. Because the page is so slow, a login that can't be checked is saved anyway, and if it turns out to be wrong, the first read asks you to fix it.
- Search or address. Broadcast on every network, or one address, Wi-Fi first.
- Pick, if more than one new fire answered.
- DHCP and confirm, when a fire joins the network by itself.
- Web login, tried for you, skippable with a blank password.
- Reconfigure, reauthenticate and options later: a new address or login, the web page on or off and how often it's read, and the maximum run time.
Repairs covers the problems you can't see on a dashboard: the fire's clock drifting five minutes or more (its timers run on it, and Home Assistant can't set it), UDP port 3300 already in use, and the built-in Escea integration installed at the same time.
Home Assistant has a quality scale for integrations, from Bronze to Platinum. Custom integrations can't claim a tier, so quality_scale.yaml is a self-assessment against all 54 rules up to Platinum: 47 done and 7 exempt, mostly because there are no custom actions or triggers to document. Strict typing is mypy --strict in CI, and the library ships its types.
Where it's at
The integration is at 0.3.0, released on 25 November, on aioescea 0.1.4. It installs from Home Assistant's Marketplace on 2026.11 and later, or as a HACS custom repository from 2025.8.
- Ethernet fires: on, off, temperature, Normal, Boost and Flame effect, found automatically and followed when their address changes.
- The fire's two timers, its clock and its diagnostics page as entities, read gently from the web page.
- Wi-Fi fires through NCAPI, with what the fire is doing, whether it can hear its remote, stored errors and a Fault event.
- A thermostat that works in Apple Home through HomeKit Bridge.
- An optional maximum run time that only ever turns the fire off.
- 79 tests and 100 % coverage of every module in the integration; CI fails below 95 %, on Home Assistant 2025.8 and the latest release.
Being honest about testing: the Ethernet side is built to Escea's specification and frames captured from real fires, and the web login fix in 0.2.2 came from testing on a real fire. The Wi-Fi side is built to Escea's NCAPI document and tested against a simulated fire, not a real one yet. The library has its own 79 tests, including the spec's example frames. The pescea fix is still waiting for review.
What's next
- A real Wi-Fi fire. Everything Generation 3 has only met a simulated fire. The first real one will be its proper test.
- A list of tested models. There isn't one yet. If you run it, an issue with your model and whether it's Ethernet or Wi-Fi helps everyone.
- The upstream fix. Getting pescea pull request #9 reviewed, so the built-in integration stops re-sending stale settings.
- The command-line tool's tests. The library's
aioesceacommand has none of its own yet, which is most of the gap between its 84 % coverage and the integration's 100 %.
Code, releases and docs
Both repositories are MIT licensed. The library's protocol notes summarise Escea's UDP specification, the network summary from Tussock Innovation and the NCAPI document, plus everything learned from real fires since.
- ha-escea-fireplaceThe Home Assistant integration: install, entities, options and troubleshooting
- ReleasesEvery version and its changelog, with the zip for a manual install
- aioesceaThe async library and its command-line tool, also on PyPI
- Protocol notesUDP frames, the web page, NCAPI and the controller's network quirks
This builds on other people's work: snikch/escea and climate.escea by Mal Curtis for the first client and the captured frames, pescea by Laz Davila for the 66 second window and the flame effect quirk, and derekclapham/ha-escea by Derek Clapham for the web page's login, timer and diagnostics formats. Thank you. This project is unofficial and not affiliated with or endorsed by Escea; "Escea" is a trademark of its owner, used only to describe compatibility.