{"action":"created","issue":{"url":"https://api.github.com/repos/arendst/Sonoff-Tasmota/issues/1695","repository_url":"https://api.github.com/repos/arendst/Sonoff-Tasmota","labels_url":"https://api.github.com/repos/arendst/Sonoff-Tasmota/issues/1695/labels{/name}","comments_url":"https://api.github.com/repos/arendst/Sonoff-Tasmota/issues/1695/comments","events_url":"https://api.github.com/repos/arendst/Sonoff-Tasmota/issues/1695/events","html_url":"https://github.com/arendst/Sonoff-Tasmota/issues/1695","id":291338206,"number":1695,"title":"Assistant with configuration for buttons and switches on a sonoff basic.","user":{"login":"bensuffolk","id":12720153,"avatar_url":"https://avatars2.githubusercontent.com/u/12720153?v=4","gravatar_id":"","url":"https://api.github.com/users/bensuffolk","html_url":"https://github.com/bensuffolk","followers_url":"https://api.github.com/users/bensuffolk/followers","following_url":"https://api.github.com/users/bensuffolk/following{/other_user}","gists_url":"https://api.github.com/users/bensuffolk/gists{/gist_id}","starred_url":"https://api.github.com/users/bensuffolk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bensuffolk/subscriptions","organizations_url":"https://api.github.com/users/bensuffolk/orgs","repos_url":"https://api.github.com/users/bensuffolk/repos","events_url":"https://api.github.com/users/bensuffolk/events{/privacy}","received_events_url":"https://api.github.com/users/bensuffolk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-01-24T19:53:00Z","updated_at":"2018-03-29T16:02:43Z","closed_at":null,"author_association":"NONE","body":"This is my requirement, but I can't quiet figure out the correct combination of options to get what I want, or it might not be possible but thought I'd check before I dive into the code looking.\r\n\r\nA quick bit of background, in my bedroom I currently have a B1 light int he main light, and a standard bulb in the wardrobe. They both come on with the main switch, but the wardrobe has a second switch in series so you can have the main light on and not the wardrobe. \r\n\r\nSince I'm having a B1 my intention is to leave that powered up all the time of course, and just switch the wardrobe light. I'll do a bit of re wiring to sort that out. \r\n\r\nSo I'm going to replace the main light switch with a switch panel with 3 retractive switches (operate like push buttons) and a sonoff basic. The relay will control the power to the wardrobe light. I'll connect the 3 retractive switches to GPIO lines. 1 of the retractive switches is actually an up / down switch I plan to use for some dimming of the B1\r\n\r\nI initially have tried setting them to switch1 and switch2, switch3 and using switchMode 3. At this point they all control the relay. Toggling it when any button is pressed. Thats the functionality I want for switch1, but not the other 2. \r\n\r\nFor switch 2 & 3 I want it to send something over MQTT when I press is, something else when I double click it and a 3rd thing when I hold it. That looks like it should all be possible from the docs if I set it to a button. However nothing seems to happen on a button (even if I set a buttonTopic).\r\n\r\nIf I set a switchTopic, then all switches send MQTT data, and the first will toggle the relay, but the second & third throws an error message as its also picked up my the device which says there is no realy2/3 (which of course the isn't).\r\n\r\nI could just have the switchTopic different and have all the messages sent to HASS and have it send a command back to the relay to turn it on. But I'd still like the basic functionality to work if HASS or the MQTT server is down. So I'd like the switch to toggle the relay straight off.\r\n\r\nIs this possible?\r\n\r\nBen\r\n\r\n\r\n\r\n\r\n\r\n "},"comment":{"url":"https://api.github.com/repos/arendst/Sonoff-Tasmota/issues/comments/377284630","html_url":"https://github.com/arendst/Sonoff-Tasmota/issues/1695#issuecomment-377284630","issue_url":"https://api.github.com/repos/arendst/Sonoff-Tasmota/issues/1695","id":377284630,"user":{"login":"danstoian","id":1169153,"avatar_url":"https://avatars3.githubusercontent.com/u/1169153?v=4","gravatar_id":"","url":"https://api.github.com/users/danstoian","html_url":"https://github.com/danstoian","followers_url":"https://api.github.com/users/danstoian/followers","following_url":"https://api.github.com/users/danstoian/following{/other_user}","gists_url":"https://api.github.com/users/danstoian/gists{/gist_id}","starred_url":"https://api.github.com/users/danstoian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danstoian/subscriptions","organizations_url":"https://api.github.com/users/danstoian/orgs","repos_url":"https://api.github.com/users/danstoian/repos","events_url":"https://api.github.com/users/danstoian/events{/privacy}","received_events_url":"https://api.github.com/users/danstoian/received_events","type":"User","site_admin":false},"created_at":"2018-03-29T16:02:43Z","updated_at":"2018-03-29T16:02:43Z","author_association":"NONE","body":"@bensuffolk I did had the same problem with multiple switches and I solved it using a virtual relay connected to GPIO4. \r\n\r\nIn my current setup I do have a sonoff basic mounted in-wall on the hallway. The main switch (Switch1) controls the light on the hallway. I also needed a secondary switch (momentary) connected as Switch2 to turn off all lights when I leave. \r\n\r\nIt´s important to mention that the Switch2 (momentary) does change the state of the Relay2 however the Relay1 state is not changed. Both switches are sending messages on MQTT. State is also reported correctly.\r\n\r\nHere is how I solved it...\r\n\r\n1. Module configuration (01 Sonoff Basic)\r\nGPIO1 Serial Out = 01 DHT11\r\nGPIO3 Serial In = 09 Switch 1 (Main switch that controls the relay)\r\nGPIO4 = 18 Relay2 (GPIO4 is not connected anywhere)\r\nGPIO14 = 10 Switch 2 (TTP223 capacitive touch sensor)\r\n\r\n2. SwitchMode/SwitchTopic configuration\r\nSwitch1 - Used default topic and default mode. SwitchMode1=0 (TOGGLE)\r\nSwitch2 - Used default topic and FOLLOW mode. SwitchMode2=1 (FOLLOW)\r\n\r\nNow I´m able to switch all the lights off by touching the capacitive sensor for 5 seconds (automated in Hass) and also use the existing switch to turn the hallway light on/off. \r\n\r\n<img width=\"499\" alt=\"screen shot 1\" src=\"https://user-images.githubusercontent.com/1169153/38099548-95327cd4-3383-11e8-8789-4dc058b3f568.png\">\r\n\r\n<img width=\"403\" alt=\"screen shot 3\" src=\"https://user-images.githubusercontent.com/1169153/38099601-bf58e32c-3383-11e8-87bc-cf2e2f7d6874.png\">\r\n\r\n"}}
{"actor":{"display_login":"danstoian"}}