{"action":"created","issue":{"url":"https://api.github.com/repos/arendst/Sonoff-Tasmota/issues/3299","repository_url":"https://api.github.com/repos/arendst/Sonoff-Tasmota","labels_url":"https://api.github.com/repos/arendst/Sonoff-Tasmota/issues/3299/labels{/name}","comments_url":"https://api.github.com/repos/arendst/Sonoff-Tasmota/issues/3299/comments","events_url":"https://api.github.com/repos/arendst/Sonoff-Tasmota/issues/3299/events","html_url":"https://github.com/arendst/Sonoff-Tasmota/issues/3299","id":343399152,"node_id":"MDU6SXNzdWUzNDMzOTkxNTI=","number":3299,"title":"A bunch of sonoff T1 to drive relays","user":{"login":"FabrizioRomanoGenovese","id":16508879,"node_id":"MDQ6VXNlcjE2NTA4ODc5","avatar_url":"https://avatars3.githubusercontent.com/u/16508879?v=4","gravatar_id":"","url":"https://api.github.com/users/FabrizioRomanoGenovese","html_url":"https://github.com/FabrizioRomanoGenovese","followers_url":"https://api.github.com/users/FabrizioRomanoGenovese/followers","following_url":"https://api.github.com/users/FabrizioRomanoGenovese/following{/other_user}","gists_url":"https://api.github.com/users/FabrizioRomanoGenovese/gists{/gist_id}","starred_url":"https://api.github.com/users/FabrizioRomanoGenovese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FabrizioRomanoGenovese/subscriptions","organizations_url":"https://api.github.com/users/FabrizioRomanoGenovese/orgs","repos_url":"https://api.github.com/users/FabrizioRomanoGenovese/repos","events_url":"https://api.github.com/users/FabrizioRomanoGenovese/events{/privacy}","received_events_url":"https://api.github.com/users/FabrizioRomanoGenovese/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-07-22T11:39:57Z","updated_at":"2018-07-22T19:40:20Z","closed_at":null,"author_association":"NONE","body":"Hello everyone, \r\n\r\nFirst of all thanks for everything, this project is fantastic and the community is amazing.\r\n\r\n# Desiderata\r\nI have some lights that have to be controlled by different switches. All my switches are sonoff T1s. What I want to achieve is:\r\n- Having all these sonoffs to control a relay that switches the light on and off, so that the light can be physically controlled by many different points;\r\n- I want the sonoff to consistenly inform MQTT about this in a nice way, e.g. by sending a `toggle` message;\r\n- I want to be able to trigger other events by pressing a button on the sonoffs for, say, n seconds.\r\n\r\n# Current setup\r\nI have defined `pulsetime 2` on each button (so for instance `pulsetime1 2`, `pulsetime2 2`, `pulsetime3 2` to have it on all the gangs of a T1 3CH). This allows me to touch the button and send a brief signal to the relay to toggle the lightbulb. This solves desiderata 1.\r\n\r\nWith respect to points 2-3, at the moment every time I touch a button on the sonoff MQTT receives two messages, a `POWER ON` when the internal relay of the T1 turns on and a `POWER OFF` shortly after when it switches back off.\r\n\r\n# What I want\r\nI'd like to have a couple of things:\r\n- When a button is pressed I'd like MQTT to see only a \"toggle\" message. I read around that this can be achieved by fiddling with `switchmode` but I don't know how to tell T1 that I want to change the switchmode of a physical button. I read also that this may involve changing the firmware code, or fiddling with GPIO in a way or another, but these are things that I don't really understand. Any coherent, detailed explanation would be appreciated. Also, since I am flashing my stuff with `sonOTA` I'd like to know if there is a simple way to achieve this.\r\n- I'd like to implement an hold function: If a button on the T1 is pressed for more than x seconds, I'd like to have a command sent out. This may be useful to trigger scenes and the like. This seems again to be possible by fiddling with `switchmode` (setting it to `5`, for instance), but then again I don't know how to apply `switchmode` to buttons. Surely `switchmode1 5` didn't work.\r\n\r\nSorry if these requests seem trivial, I just started looking into this recently."},"comment":{"url":"https://api.github.com/repos/arendst/Sonoff-Tasmota/issues/comments/406891267","html_url":"https://github.com/arendst/Sonoff-Tasmota/issues/3299#issuecomment-406891267","issue_url":"https://api.github.com/repos/arendst/Sonoff-Tasmota/issues/3299","id":406891267,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjg5MTI2Nw==","user":{"login":"Frogmore42","id":14101627,"node_id":"MDQ6VXNlcjE0MTAxNjI3","avatar_url":"https://avatars0.githubusercontent.com/u/14101627?v=4","gravatar_id":"","url":"https://api.github.com/users/Frogmore42","html_url":"https://github.com/Frogmore42","followers_url":"https://api.github.com/users/Frogmore42/followers","following_url":"https://api.github.com/users/Frogmore42/following{/other_user}","gists_url":"https://api.github.com/users/Frogmore42/gists{/gist_id}","starred_url":"https://api.github.com/users/Frogmore42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Frogmore42/subscriptions","organizations_url":"https://api.github.com/users/Frogmore42/orgs","repos_url":"https://api.github.com/users/Frogmore42/repos","events_url":"https://api.github.com/users/Frogmore42/events{/privacy}","received_events_url":"https://api.github.com/users/Frogmore42/received_events","type":"User","site_admin":false},"created_at":"2018-07-22T19:40:20Z","updated_at":"2018-07-22T19:40:20Z","author_association":"NONE","body":"Buttons are already complex given the number of issues raised by people not understanding how they work.  They also have to support multipess, so I see why Theo didn't support button mode.\r\n\r\nI didn't define the functionality or write the code for Tasmota.  I don't even claim to know it very well.  But, I have been using it for months and understand how to do most basic things with it and some more advanced things.  If you want to do something that Tasmota was not designed to do, the source is available to make it do whatever you can imagine and implement.  To do that will require a decent understanding of what/how it does things now.  It already has defined behavior for multi-press, perhaps you can repurpose the code to do what you want.\r\n\r\nAs far as Toggle goes, I find that to be okay if a human is controlling it but not really suitable for automation.  When I want to control something from multiple locations, I want to know that the command is going to work.  In a prior system I use some 415MHz switches that are controlled by an MCU.  The switches have defined RF commands for on and for off.  This makes it easy for me to send the command multiple times and be reasonably certain of the outcome.  If it only supported toggle, like some do, it would be much harder to deal with the lossy communication channel.\r\n\r\nSo, my point is that you need to look at the system as a whole and figure out where to put which part of the logic.  Sometimes by changing that, you can convert an impossible to solve problem into an easy or at least a solvable one.\r\n\r\nIf you want button mode, define your buttons as switches and you will get it.  But you still don't get the long press function.\r\n\r\nIf you are adept at programming, you should be able to adapt Theo's code to include long button press functionality.  If you do a good job on it, submit a pull request and it might even get added as an option to the base code.\r\n\r\nOr, convince Theo this is a REALLY, REALLY, REALLY great idea and maybe he will implement it for you and everyone else who might want it in the future."}}
{"actor":{"display_login":"Frogmore42"}}