Noob - Tasmota - Press remote, but use separate pin as status

143 views
Skip to first unread message

Alwyn van Jaarsveldt

unread,
Mar 8, 2022, 5:55:58 AM3/8/22
to TasmotaUsers
Hi.

I'm very new to the home automation scene, and haven't used Tasmota yet (although from what I've seen I should convert all my Sonoffs to use Tasmota). 

My scenario: I have a rolling remote control that toggles my alarm, which in turn switches a relay to indicate the state. I currently have an LED on that relay, so that I can see from my bedroom whether the alarm is activated (my bedroom doesn't have a panel, so I have to use the remote, whereas the panel is accessible to my mother on the other side of the house).

I would like to be able to integrate this with my home automation to switch off the alarm when I wake up in the morning, but I don't want it to toggle to an "ON" state if it is already off. (Side-note: if this cannot be done on the Tasmota directly, then I could probably use node-red on my HA server, but I think this is second prize)

I've had a look around here, and found 2 conversations that would probably help me with being able to press the remote button, and read the status. Links:
https://groups.google.com/g/sonoffusers/c/9kOU_vrv4Qc/m/BGXxl2jmBQAJ

My question(s):
1. Is it possible to do as described above?  (I'm assuming yes, but have to ask)
2. How would I set this up after flashing a Sonoff to use Tasmota?

Any help would be appreciated.

TIA!

Philip Knowles

unread,
Mar 8, 2022, 8:34:25 AM3/8/22
to Alwyn van Jaarsveldt, TasmotaUsers

Not entirely sure I know what you’re trying to achieve but the simple thing to understand is there are 4 possible commands that you can send to a Tasmota output

OFF – 0 – turn the output OFF

ON – 1 – turn the output ON

TOGGLE – 2 – if OFF turn ON, if ON turn OFF

BLINK -3 – flash the output

 

If you send an OFF to an output which is already OFF it will not change the state – it will just accept the command

If you send BLINK to an output which is already OFF it will blink the output ON for the BlinkTime length of time for the BlinkCount number of times then return to OFF.

 

From the sound of it just sending 0 will be enough.

 

Regards

 

Phil K

 

 

 

Sent from Mail for Windows

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/c61cd00c-bcbb-436e-8931-e4426c34f70cn%40googlegroups.com.

 

Alwyn van Jaarsveldt

unread,
Mar 8, 2022, 11:51:43 AM3/8/22
to TasmotaUsers
Hi Phil

Thanks for the reply!

Followup question: How does Tasmota know what the state is? (Can I specify that the state is read from specific pins?)

Asking this in case I decide to both arm and disarm the alarm at a later stage.

Thanks in advance :)

Regards,
Alwyn

Philip Knowles

unread,
Mar 8, 2022, 12:06:06 PM3/8/22
to Alwyn van Jaarsveldt, TasmotaUsers

You set a GPIO as a relay, PWM, sensor, switch etc and it monitors the state.

 

Alwyn van Jaarsveldt

unread,
Mar 12, 2022, 2:28:42 AM3/12/22
to TasmotaUsers
Hi Phil

So, I had some time to play with this mini-project last night and this morning.
What I have so far is that I have set up 2 pins that will "press" the remote control buttons, and I can trigger them using HTTP (I still need to figure out how to do this with MQTT though). I've set the BlinkCount to 1 and the BlinkTime to 5 so that the press is once for 0.5 seconds. This part is what I call my "output" side.

My configuration looks like this:
Capture.PNG

My input side (D5 and D6) is supposed to give me the status of my alarm (this will come from the alarm itself, as it can latch a relay which I will use). For now, I'm just triggering the alarm by pulling D5 or D6 low. I can see the states changing from ON to OFF in MQTT Explorer, so that is fine. But, what is also happening is that when I pull the pins low it triggers (and latches) D1 or D2 respectively.

I tried setting the "inputs" to channels 3 and 4, but that didn't work. I also tried setting the outputs to 3 and 4, and that also didn't work.

Any assistance on how I can separate the "input" side from the "output" side?

Regards,
Alwyn

Philip Knowles

unread,
Mar 12, 2022, 3:57:53 AM3/12/22
to Alwyn van Jaarsveldt, TasmotaUsers

The command for MQTT (or http) is cmnd/xxx/power1 3 or cmnd/xxx/power2 3.

 

You can detach the inputs from the outputs using SetOption114 1

 

While the inputs and outputs are ‘linked’ a switch input will maintain the output for as long as it is operated (much like a light switch).

 

If you detach the outputs you will lose the ability to monitor the status as easily.

Not exactly sure what you’re doing but you could have A1 & A2 (Alarm input) AS1 & AS2 (Alarm status output) and R1 & R2 (reset output)

A1 – D5 – Switch1

A2 – D6 – Switch2

AS1 – D7 – Relay1 – virtual but could drive status LED

AS2 – D8 – Relay2 - ditto

R1 – D1 – Relay3

R2 – D2 – Relay4

 

If you have 2 ESP8266s (one at the panel and one in your room) you can transmit the signal from the panel to your room – using LEDs on the room ESP8266 to indicate the panel status). You could then use buttons on the room ESP8266 to send the reset signal back to the panel to set/reset the alarm.

 

Regards

 

Phil K

 

 

Sent from Mail for Windows

 

From: Alwyn van Jaarsveldt
Sent: 12 March 2022 07:28
To: TasmotaUsers
Subject: Re: Noob - Tasmota - Press remote, but use separate pin as status

 

Hi Phil

 

So, I had some time to play with this mini-project last night and this morning.

What I have so far is that I have set up 2 pins that will "press" the remote control buttons, and I can trigger them using HTTP (I still need to figure out how to do this with MQTT though). I've set the BlinkCount to 1 and the BlinkTime to 5 so that the press is once for 0.5 seconds. This part is what I call my "output" side.

 

My configuration looks like this:

Alwyn van Jaarsveldt

unread,
Mar 20, 2022, 5:39:20 AM3/20/22
to TasmotaUsers
Hi Phil

I would like to thank you for your input! With everything that you have helped with, I managed to get it working the way I need.

Here's my configuration:
D2: Switch2
D1: Relay_i4
D6: Relay_i2
D7: Relay_i3
D5: Relay_i1
D0: Switch1

I've run the SetOption114 1 to detach inputs from outputs.

MQTT is setup, and I can trigger the 4 relays using Node Red (listening for a "script" trigger), and I can check the status of the 2 switches to determine the 2 different states.

The last thing that I still need to do is to connect it to my alarm system :)

Thank you very much for all your help!!
Reply all
Reply to author
Forward
0 new messages