Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

AControl — Tuya Scene AC

A Home Assistant custom integration that turns an unsupported Tuya / Smart Life air conditioner into a normal climate entity.

Some AC units (especially IR-bridge based or cheap Wi-Fi modules) show up in Home Assistant with no usable controls at all — or don't show up as a climate device in the first place. But almost all of them can be controlled from the Tuya / Smart Life app, and the app lets you record those actions as scenes (Tap-to-Run automations).

This integration creates a virtual thermostat card and, whenever you touch it, fires the matching scene. From the Home Assistant side it looks and behaves like any other AC: power, mode, target temperature, fan speed, sleep preset — all in one climate card, usable in dashboards, automations, scripts and voice assistants.

Home Assistant climate card
          │  you set 22 °C
          ▼
scene.ac_temperature_22_deg_celcius   (this integration calls it)
          │
          ▼
Tuya Cloud  →  Smart Life "Tap-to-Run"  →  your AC

⚠️ The one important limitation

Control is one-way (fire-and-forget).

The integration has no way to read the real state of the AC — Tuya scenes only send commands, they report nothing back. Home Assistant therefore remembers the last state it set and displays that (it is persisted across restarts).

That means:

  • If somebody changes the AC with the physical remote, the unit's own panel, or directly in the Tuya app, Home Assistant will not notice and will keep showing the old values.
  • There is no current room temperature (current_temperature is always empty). Pair the entity with a separate temperature sensor if you need one.
  • There is no confirmation that the AC actually received the command.

If everyone in the household controls the AC through Home Assistant, this is a non-issue in practice. If the remote is used a lot, expect the displayed state to drift out of sync.


⚠️ Important: the waiting times from your AC manual are not enforced yet

Most AC manuals require a cool-down / protection period between certain actions, for example:

  • "wait 2 hours before switching the operating mode"
  • "after switching the unit off, wait 2 hours before switching it back on"

The integration does not know or enforce any of these rules. It fires the scene the moment you tap the card — the only delay built in is 1 second between the power-on scene and the mode scene. Nothing stops you (or an automation) from turning the unit off and straight back on, or from flipping cool → dry immediately.

Check your own manual for the values that apply to your unit and respect them, especially in automations. Ignoring compressor protection times can shorten the life of the unit or damage it.

This is planned: configurable lockout / cool-down handling (blocking or delaying commands that come too early) is on the roadmap for a future release. Until then, the responsibility is yours.


Requirements

  • Home Assistant (2024.x or newer)
  • Your AC already working in the Tuya Smart or Smart Life app
  • The official Tuya integration set up in Home Assistant, so your Tuya scenes appear as scene.* entities

Any other source of scenes works too (LocalTuya, native Home Assistant scenes, scripts wrapped in scenes …). The integration only cares that scene entities with the expected IDs exist.


Step 1 — Create the scenes in the Tuya / Smart Life app

This is the part you have to do by hand, and it's the heart of the setup.

In the app, go to Smart → Tap-to-Run → + and create one scene per AC command:

  1. Condition: Launch Tap-to-Run (manual trigger)
  2. Action: Run the device → pick your AC → select the single setting this scene should apply (e.g. Temperature = 22)
  3. Give the scene a name exactly as listed in the table below — the name determines the entity ID in Home Assistant
  4. Save

Repeat for every command. You need 25 scenes in total with the default prefix (9 control scenes + 16 temperature scenes).

Scene reference

Home Assistant slugifies the Tuya scene name into the entity ID (lowercase, spaces → underscores). So a scene named AC Power On becomes scene.ac_power_on.

Scene name in the Tuya app Home Assistant entity ID What it should do
AC Power On scene.ac_power_on Switch the AC on
AC Power Off scene.ac_power_off Switch the AC off
AC Mode Cool scene.ac_mode_cool Set mode to cooling
AC Mode Dehumidify scene.ac_mode_dehumidify Set mode to dry / dehumidify
AC Mode Fan scene.ac_mode_fan Set mode to fan only
AC Speed Low scene.ac_speed_low Fan speed low
AC Speed High scene.ac_speed_high Fan speed high
AC Sleep On scene.ac_sleep_on Enable sleep mode
AC Sleep Off scene.ac_sleep_off Disable sleep mode
AC Temperature 16 Deg Celcius scene.ac_temperature_16_deg_celcius Target temperature 16 °C
… one per degree …
AC Temperature 31 Deg Celcius scene.ac_temperature_31_deg_celcius Target temperature 31 °C

Note the spelling: the temperature entity IDs use _deg_celcius (with a c, not celsius). Name the scenes so the resulting entity IDs match exactly, otherwise the integration will not find them.

Temperature scenes are needed for every degree from 16 °C to 31 °C — 16 scenes.

Using a different prefix

ac is only the default. If you have two units, use e.g. livingroom and bedroom as prefixes and name the scenes accordingly (Livingroom Power Onscene.livingroom_power_on), then set the prefix when adding the integration. Each unit gets its own config entry and its own climate entity.


Step 2 — Check the scenes in Home Assistant

After the Tuya integration syncs (restart Home Assistant or reload the Tuya entry), open Developer Tools → States and filter for scene.ac. All 25 scenes should be listed.

If the entity IDs don't match the table, rename them in Settings → Devices & Services → Entities — the integration matches on the entity ID, not on the Tuya name.


Step 3 — Install the integration

HACS (custom repository)

  1. HACS → Custom repositories
  2. Add https://github.com/flow1990/AControl as type Integration
  3. Install Tuya Scene AC
  4. Restart Home Assistant

Manual

Copy custom_components/tuya_scene_ac into your Home Assistant config/custom_components/ directory and restart.


Step 4 — Add the integration

Settings → Devices & Services → Add Integration → Tuya Scene AC

Field Meaning
Entity name Display name of the climate device, e.g. Living Room AC
Scene entity prefix The prefix used in your scene entity IDs, default ac

You can add the integration multiple times — one entry per air conditioner.


What the climate entity supports

Feature Values
HVAC modes off, cool, dry, fan_only
Target temperature 16–31 °C, 1 °C steps
Fan modes low, high
Presets none, sleep
Current temperature not available (see limitation above)

Behaviour details:

  • Switching from off to any active mode calls the power on scene first, waits 1 second, then calls the mode scene — many units ignore a mode command while they are still booting.
  • Selecting off calls the power off scene only.
  • Selecting preset none calls the sleep off scene.
  • The last state is written to Home Assistant's storage and restored on restart.
  • Heating is intentionally not exposed; add a mode_heat scene and extend const.py if your unit supports it.

Troubleshooting

Nothing happens when I use the card

Check the Home Assistant log. A missing scene is logged as:

Scene 'scene.ac_mode_cool' does not exist. Check your scene prefix and entity IDs.

The state in the card is only updated after the scene call succeeds, so a control that snaps back means the scene wasn't found.

The scene exists but the AC does nothing

Trigger the scene manually (Developer Tools → Actions → scene.turn_on). If the AC doesn't react, the problem is in the Tuya app scene, not here.

The card shows the wrong state

Expected if the AC was changed outside Home Assistant — see the limitation section. Setting any value from the card resyncs the display with what was last sent.

Temperature changes don't work

Most likely the _deg_celcius spelling, or a missing scene for that specific degree.


Repository layout

custom_components/tuya_scene_ac/
├── __init__.py      # setup, state persistence
├── climate.py       # the virtual climate entity
├── config_flow.py   # UI setup
├── const.py         # scene name templates, modes, temperature range
├── manifest.json
└── strings.json

Want a different scene naming scheme, more fan speeds or a wider temperature range? Everything is defined in const.py.


Missing a setting? Open a PR

The supported settings are the ones my air conditioner actually has. Anything my unit can't do simply isn't implemented — not because it doesn't belong here.

The clearest example is humidity: the unit has a dehumidify mode, but no humidity setpoint you could target, so there was nothing to build scenes for and TARGET_HUMIDITY is not exposed. Same story for heating, swing/oscillation, additional fan speeds and eco/turbo presets.

If your AC supports something that's missing, a pull request is very welcome. Please include:

  1. Which setting you are adding (e.g. target humidity, swing mode, heat)
  2. Which scene names / entity IDs it expects, following the existing pattern — e.g. scene.{prefix}_humidity_50_percent, scene.{prefix}_mode_heat, scene.{prefix}_swing_on
  3. What the scene does in the Tuya app, so others can recreate it
  4. A short note on which AC model you tested it with

Most additions are small and live in const.py (a new scene template plus its mapping) with the matching ClimateEntityFeature and setter in climate.py. Keep new settings optional — an entry that has no scenes for a feature must keep working exactly as before.


About the code

Full honesty: I'm a junior dev and a good chunk of this was vibe coded. It solves my problem and it runs fine in my house, but it is not a masterclass in Home Assistant integration design.

So if you look at this and think "that's not how you do it" — you're probably right. Fix it, open a PR, or just tell me in an issue. Refactors, better error handling, tests, proper async patterns, HA best practices: all very welcome, no ego attached. 🙂


Disclaimer

Not affiliated with or endorsed by Tuya. Provided as-is.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages