LightAutomation

Automate your outdoors lighting! We're all very tired of having to go around the world, turning lights on and off at dusk and dawn ...
video thumbnail

Description

LightAutomation

A Hytale mod for automating lighting systems. We've all been there, having to go around the whole world at dawn and dusk just to turn lights on and off.

Features

  • Automatic street lights: lights turn on at dusk and off at dawn
  • Smart time detection: uses the sunlight factor to find the precise dawn/dusk transition
  • Player light tracking: automatically tracks player-placed light sources
  • Persistence: tracked lights survive server restarts
  • Configurable timing: adjust when lights activate and deactivate
  • Your config is yours: an existing configuration file is never rewritten, so your edits survive restarts
  • Outdoor lights only: lights placed indoors or in caves are not automated

Installation

  1. Place the mod jar in your Hytale server's mods/ directory
  2. Start the server
  3. A configuration file (LightAutomationConfig.json) is created next to the plugin on first run
  4. Edit the configuration as needed

The mod creates that file on first run and never rewrites it on startup or shutdown, so your edits stay exactly as you left them across restarts. The lights types commands are the exception: a write command rewrites the file from the settings the mod knows about. If the file cannot be read (for example because of a duplicated entry), it is moved aside to LightAutomationConfig.invalid-<timestamp>.json, the log says why, and the mod runs on defaults - the server still boots.

Player usage

Depending on the DefaultLogic option, every light placed outdoors is either automated by default or not. A player can interact with the light once during the first 10 seconds after placing it to opt out of automation, or opt in, depending on what the default is.

(This might seem complicated, but there is no way in the current Hytale API to detect when a player changes the state of just any light.)

Why are torches not automated by default?

Most players assume torches will not go on and off, even outdoors, so every torch is in StaticLightTypes in the shipped defaults. That is only a default: move any ID to the other list in your own config, or with /lightautomation lights types add <id>, and the mod will automate it.

Configuration options

  • EnableLightAutomation: enable/disable light automation (true/false)
  • DefaultLogic: whether placed lights are automated by default, or vice versa (on/off)
  • LoggingLevel: level of logging detail (off, processing, debug)
  • DawnThreshold: percentage of sunlight required to turn off lights (>0.000 and <1.000)
  • DuskThreshold: percentage of sunlight required to turn on lights (>0.000 and <1.000)
  • ToggleableLightTypes: array containing the lights the mod should automate
  • StaticLightTypes: array containing the lights the mod should not automate

Notes:

  • Block type IDs are matched case-insensitively, so deco_lantern and Deco_Lantern are the same entry.
  • Unknown top-level keys are ignored and reported in the server log. $Comment keys are accepted while reading, but a lights types write command drops them along with anything else it does not know about.
  • An ID in both lists is reported in the log and by lights types check.
  • The arrays are authoritative: an empty array means "automate nothing", not "use the defaults".

Caveat regarding dusk: the Hytale API currently reports 0 sunlight well before the sun actually sets. Until that is fixed you will likely want DuskThreshold around 0.004.

Commands

Every action is a subcommand:

  • /lightautomation - displays the available commands
  • /lightautomation version - displays the version
  • /lightautomation reload - reloads and applies the configuration
  • /lightautomation config - displays the current configuration
  • /lightautomation save - saves tracked lights now
  • /lightautomation clear - clears all tracked lights
  • /lightautomation info - shows persistence information
  • /lightautomation lights - shows the tracked lights summary
  • /lightautomation lights list [<type>] [--all] - lists tracked lights grouped by type; give a type to drill into it, --all lifts the 20-row cap
  • /lightautomation lights types list - lists both configured lists (unknown IDs are marked *)
  • /lightautomation lights types check - checks configured IDs against the game and the shipped defaults
  • /lightautomation lights types add <blockTypeId> [--static] - adds an ID to the toggleable (default) or static list
  • /lightautomation lights types remove <blockTypeId> - removes an ID from both lists and stops tracking existing lights of that type
  • /lightautomation lights types defaults - adds shipped defaults that are missing from your config

reload, save, clear and the lights types write commands require the permission defxor.lightautomation.config (admin-only in practice). Their changes are saved to the config and apply to lights placed from now on; already placed lights are not rescanned. remove does stop tracking the lights of that type that are already tracked.

Older versions used flag spellings such as --reload and --lights. Those still work in the current release and are removed in the next one. The flag spellings --lights list, --lights count and --lights types were never implemented - the flags are booleans, so the extra word only produced a usage error. Use lights list, lights and lights types list.

Upgrading

  • Existing configs are left as they are. Restarts never rewrite the file. The shipped defaults only apply to new installs, or to a key you deleted. lights types check shows which defaults your config is missing and lights types defaults adds them on request. It only adds: it never moves an ID between lists and never removes one, so a deliberate deletion stays deleted.
  • An emptied list now means empty. Earlier versions silently fell back to the built-in lists when an array was empty; now an empty ToggleableLightTypes really does disable automation.
  • A broken config no longer takes the server down. Duplicate entries used to crash the server at boot; the file is now moved aside and the mod runs on defaults.
  • Classification changes are reported, not applied. If an ID you keep in one list is shipped in the other (for example a torch you kept toggleable), check says so and leaves your choice alone.

License

Creative Commons Zero

LightAutomation Team

profile avatar
Owner
  • 1
    Followers
  • 2
    Projects
  • 3.8K
    Downloads

I was there ... in the beginning of time ...

More from defxor

  • Pathinator project image

    Pathinator

    Pathinator automatically creates paths where players often walk. Fully configurable.

    • 2.1K
    • November 19, 2026
  • Pathinator project image

    Pathinator

    Pathinator automatically creates paths where players often walk. Fully configurable.

    • 2.1K
    • November 19, 2026