{"id":15287717,"url":"https://github.com/mrvandalo/light-control","last_synced_at":"2025-06-22T09:35:21.948Z","repository":{"id":62442231,"uuid":"268525570","full_name":"mrVanDalo/light-control","owner":"mrVanDalo","description":"mqtt light control with location tracking","archived":false,"fork":false,"pushed_at":"2020-07-12T01:16:21.000Z","size":161,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T06:03:25.767Z","etag":null,"topics":["iot","lights","mqtt"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrVanDalo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-01T13:11:06.000Z","updated_at":"2021-10-02T02:23:33.000Z","dependencies_parsed_at":"2022-11-01T22:16:18.531Z","dependency_job_id":null,"html_url":"https://github.com/mrVanDalo/light-control","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrVanDalo%2Flight-control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrVanDalo%2Flight-control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrVanDalo%2Flight-control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrVanDalo%2Flight-control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrVanDalo","download_url":"https://codeload.github.com/mrVanDalo/light-control/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670437,"owners_count":21142904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iot","lights","mqtt"],"created_at":"2024-09-30T15:35:30.240Z","updated_at":"2025-04-13T06:03:56.798Z","avatar_url":"https://github.com/mrVanDalo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# light-control\n\n[Mqtt](http://mosquitto.org/man/mqtt-7.html)\nlight-control for [singles](https://en.wikipedia.org/wiki/Single_person).\nIt comes with room tracking, which works best in a single person environment.\n\n## How to install\n\n```shell script\ncargo install install --path .\n```\n\n## How to run\n\n```shell script\nexport RUST_LOG=light_control=info\n~/.cargo/bin/light-control examples/home.json\n```\n\n## Overview\n\nHere is a small overview on how an light-control sees your sensors\n\n![image](./images/overview.png)\n\nThe threshold is the time threshold that need to be reached by an other room,\nbefore we detect the other room as the current presents of the user.\n\n## Configuration File\n\nShould be simple.\nlight-control knows\n\n* sensors : generate presents input\n* switches : receive on off commands (incl brightness and rgb information)\n* scenes: day, night or outside\n\n\u003e Have a look at [./examples/home.json](./examples/home.json) to get an impression.\n\n### How find key and topic\n\nYou can use the mosquitto client to subscribe to all messages\n\n```shell script\nmosquitto_sub -v \\\n  -u light-control \\\n  -P password \\\n  -h localhost \\\n  -t \"#\"\n```\n\nThis would be a line you see:\n```mqtt\nzigbee2mqtt/motion_sensor_7 {\"battery\":100,\"voltage\":3015,\"linkquality\":99,\"occupancy\":true}\n```\n* `zigbee2mqtt/motion_sensor_7` is the topic\n* `occupancy` is the key describing the state\n\n\u003e light-control only excepts messages in flat json\n\n### Sensors\n\n* `topic`: topic to listen to.\n* `key`: json key to read the state.\n* `room`: that should be considered present if this sensor is triggered.\n* `invert_state`: (default false) \n    sometimes sensors send false if presents is detected.\n    This option is to invert the state in that cases.\n* `delay`: (default 60) \n    how long to wait (in seconds) till a present state becomes \n    absent after the devices publishes the absent message.\n    \n### Switch\n\n* `topic`: topic to listen for state.\n* `key`: json key to read the state.\n* `rooms`: rooms to which switch react.\n* `delay`: \n    how long to wait, in seconds, till the switch is turned off\n    once all subscribed rooms become absent.\n* `command`: command control.\n    * `command`: turn on and off command\n        This is a mustache template. Injected arguments are:\n        * state : on/off (see on/off statement)\n        * brightness : 0 - 255\n    * `init_command`: (default null)\n        command to get state of the device\n        will be triggered at program start.\n    * `topic`: topic to send commands\n    * `on`: (default \"ON\")\n        string to send for state argument to run switch on\n    * `off`: (default \"OFF\")\n        string to send for state argument to run switch off\n        \n### Scene\n\n\u003e The first scene in the one chosen after program start.\n\n* `name`: name of the scene\n* `brightness`: brightness level for this scene\n* `disabled_switches`:\n    list all switch topics which should be turned off.\n* `enabled_switches`:\n    list all switch topics which should be turned on.\n* `ignored_switches`:\n    list all switch topics which should not be set.\n* `room_tracking_enabled`: tracking enabled or not\n* `ignored_sensors`:\n    list all sensor topics which should be ignored to detect room presents.\n\n## Interact via mqtt\n\nMqtt is the perfect place to control light-control.\n\n### How to change scenes\n\n```shell script\nmosquitto_pub \\\n  -h localhost \\\n  -u homeassistant \\\n  -P password \\\n  -t \"control/lights/set\" \\\n  -m '{\"scene\":\"\u003cscene-name\u003e\"}' \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrvandalo%2Flight-control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrvandalo%2Flight-control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrvandalo%2Flight-control/lists"}