{"id":28458488,"url":"https://github.com/confectrician/esp8266-4-way-pushbutton-dimmer-switch","last_synced_at":"2026-05-10T03:35:14.094Z","repository":{"id":55038889,"uuid":"113589583","full_name":"Confectrician/ESP8266-4-way-pushbutton-dimmer-switch","owner":"Confectrician","description":"This project uses 4 pushbuttons, to interact as pushbutton, switch or dimmer over mqtt.","archived":false,"fork":false,"pushed_at":"2021-01-13T18:55:37.000Z","size":2123,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-07T00:11:34.064Z","etag":null,"topics":["esp8266","home-automation","iot","mqtt"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Confectrician.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":"2017-12-08T15:38:27.000Z","updated_at":"2019-11-17T22:40:26.000Z","dependencies_parsed_at":"2022-08-14T09:50:31.506Z","dependency_job_id":null,"html_url":"https://github.com/Confectrician/ESP8266-4-way-pushbutton-dimmer-switch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Confectrician/ESP8266-4-way-pushbutton-dimmer-switch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Confectrician%2FESP8266-4-way-pushbutton-dimmer-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Confectrician%2FESP8266-4-way-pushbutton-dimmer-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Confectrician%2FESP8266-4-way-pushbutton-dimmer-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Confectrician%2FESP8266-4-way-pushbutton-dimmer-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Confectrician","download_url":"https://codeload.github.com/Confectrician/ESP8266-4-way-pushbutton-dimmer-switch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Confectrician%2FESP8266-4-way-pushbutton-dimmer-switch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263081021,"owners_count":23410794,"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":["esp8266","home-automation","iot","mqtt"],"created_at":"2025-06-07T00:11:22.363Z","updated_at":"2026-05-10T03:35:14.043Z","avatar_url":"https://github.com/Confectrician.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ESP8266 4-Way Pushbutton Dimmer Switch\n\nThis is a project that uses 4 inputs on a Wemos D1 Mini, to interact as pushbutton, switch or dimmer over mqtt.\nIt is based on [homie convention](https://github.com/marvinroger/homie) and uses the [homie-esp8266](https://github.com/marvinroger/homie-esp8266) framework.\n\n![Breadboard test setup](https://github.com/Confectrician/ESP8266-4-way-pushbutton-dimmer-switch/blob/master/images/breadboard.jpg?raw=true)\n\n## Concepts\n\nAccording to the convention our topic will start with `base/decive-id` like it has been configured.\n\nFrom here every pushbutton has its own main topic, which can be configured individually in `constants.h` for every pushbutton.\nYou can also configure the `NODE_TYPE` here for the device meta informations, that homie provides.\n\nEvery pushbutton has 3 functional mqqt topics configured.\n\n- `pressed` indicates if the pushbutton is pressed currently\n- `switchState` provides a switchmode, which will alternate between `true` and `false`\n- `dimmerValue` provides a value between `0` and `100`\n\nAn example topic would for a dimmerValue would then be `homie/livingroom-multidimmer/pushbutton1/dimmerValue`.\n\nThe pushbuttons will react different depending on the time they have been pushed.\nShort push actions will be interpreted as a *tap-action* and just affect the *switchState* topic.\nLonger push actions will be interpreted as a *dimm-action* and change the *dimmerValue*.\nThe  *dimmerValue* is *increased* or *decreased* depending on the *switchState* **and** the current *dimmerValue* itself.\n\n- *increased* when\n`switchState` is LOW/false and the current `dimmerValue` is lower than or equal to `100`\n\n- *decreased* when\n`switchState` is HIGH/true and the current `dimmerValue` is greater than or equal to `0`\n\n\n## Hardware\n\n\u003e partly tbd - just a testing setup @ the moment\n\n- Wemos D1 Mini\n- 4 pushbuttons of your choice to connect to the pcb\n- 2 10kΩ resistors (see pinout information)\n- Conectors with 0.2in/5.08mm space between the pins\n- A DC source of your choice to power up the Wemos\n\n### Custom PCB\n\ntbd\n\n### Pinout Information (Wemos D1 Mini)\n\nPlease be aware that only pin D3 and D4 have an integrated Pull up resistor.\nFor the other pins of your choice, you will have to add a 10kΩ pullup resistor to each input.\n\nAlso keep in mind that pin D3 is able to reset your device.\nMake sure that `Homie.disableResetTrigger();` is called in the `setup()` function befor `Homie.setup()` is called.\n\n## Pushbutton to dimmer handling\n\n### Compare dimmer to pushbutton input\n\nCaution. The following paragraph could be a bit *geeky*.\n\nAfter some *practical research* the average time for one **button push to button release event** is about `247,4285714ms`.\nMinimum time needed was `191ms`.\nMaximum time needed was `287ms`.\n\nBased on this values, i have set the `DIMMER_PUSH_INTERVAL` to `300ms` for now.\nThis value is used to decide wether a push is hold to start a dimmer or just tapped to update the `switchState`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconfectrician%2Fesp8266-4-way-pushbutton-dimmer-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconfectrician%2Fesp8266-4-way-pushbutton-dimmer-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconfectrician%2Fesp8266-4-way-pushbutton-dimmer-switch/lists"}