What type of device do I need?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
Andrew Mamohin
Normal user
Posts: 95
Joined: 12 Jun 2020, 08:30
Location: Belarus, Gomel
Contact:

What type of device do I need?

#1 Post by Andrew Mamohin » 25 Oct 2020, 15:59

My sensor (handmade) just output +3 volts (when the alarm) or 0 volts. What type of device is preferable to select in espeasy? Now I have done so, but it seems to me that it is not correct. This works, only when loading the sensor is triggered.
Image
Attachments
JxJF0nqFuK.jpg
JxJF0nqFuK.jpg (46.94 KiB) Viewed 13376 times
Andy.

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: What type of device do I need?

#2 Post by TD-er » 25 Oct 2020, 16:11

My first idea would also be to use the switch input.
I don't really understand your problem here: "This works, only when loading the sensor is triggered."

With what controller do you like to interact? It looks like Domoticz, given you can set an IDX value.

User avatar
Andrew Mamohin
Normal user
Posts: 95
Joined: 12 Jun 2020, 08:30
Location: Belarus, Gomel
Contact:

Re: What type of device do I need?

#3 Post by Andrew Mamohin » 25 Oct 2020, 17:02

I assumed there was a dedicated plugin for this type of sensor.
Yes, I am using domoticz. When the ESP is restarted, for some reason, a sensor trigger signal occurs. This is not critical. I repeat: I just thought that there is another version of the type of device that suits me.
Andy.

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: What type of device do I need?

#4 Post by ThomasB » 25 Oct 2020, 17:18

When the ESP is restarted, for some reason, a sensor trigger signal occurs.
I suggest using a much longer debounce time.

- Thomas

User avatar
Andrew Mamohin
Normal user
Posts: 95
Joined: 12 Jun 2020, 08:30
Location: Belarus, Gomel
Contact:

Re: What type of device do I need?

#5 Post by Andrew Mamohin » 25 Oct 2020, 17:27

ThomasB wrote: 25 Oct 2020, 17:18 I suggest using a much longer debounce time.
I put the maximum value (250), but nothing changed.
Andy.

User avatar
Ath
Normal user
Posts: 3489
Joined: 10 Jun 2018, 12:06
Location: NL

Re: What type of device do I need?

#6 Post by Ath » 25 Oct 2020, 17:40

Andrew Mamohin wrote: 25 Oct 2020, 17:02 When the ESP is restarted, for some reason, a sensor trigger signal occurs.
You have checked 'Send Boot state', so that would be an explanation.

Are you using a recent version of ESPEasy (less than 2 months old) (assume so, just asking for confirmation)?
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3489
Joined: 10 Jun 2018, 12:06
Location: NL

Re: What type of device do I need?

#7 Post by Ath » 25 Oct 2020, 17:46

Ah, you might want to select 'Switch Button Type = Push Button Active High', as that will give you the current state at the 'other end', not waiting for a state-change to switch state.
/Ton (PayPal.me)

User avatar
Andrew Mamohin
Normal user
Posts: 95
Joined: 12 Jun 2020, 08:30
Location: Belarus, Gomel
Contact:

Re: What type of device do I need?

#8 Post by Andrew Mamohin » 25 Oct 2020, 18:07

Ath wrote: 25 Oct 2020, 17:46 Switch Button Type
No, any value of "Switch Button Type" (except "normal") causes incorrect functionality.
Perhaps I will make a sensor connection from the ESP to the optocoupler.
Andy.

User avatar
Grumpf
Normal user
Posts: 124
Joined: 05 May 2017, 23:45
Location: Namur

Re: What type of device do I need?

#9 Post by Grumpf » 25 Oct 2020, 18:58

Hi Andrew, can you describe what you're trying to achieve ? I'm curious.

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: What type of device do I need?

#10 Post by TD-er » 25 Oct 2020, 21:05

I think "Send Boot state" is indeed one of the candidates to check.

For detecting a specific level, you indeed need to have the "normal switch" type, as it needs to evaluate the current state of the pin, not a toggle state.

One other reason for this behavior I can think of is that the ESP will call PLUGIN_READ at boot.
If the ESP experiences a power cycle, then the state has changed from "0" to "1", so it will for sure send out a message to the controller.
If this also happens at a warm boot (e.g. a crash), then I guess we may need to have a proper look at the implementation of the switch plugin as it would then not register a state change so no need to send data to the controller (assuming "Send Boot State" is unchecked)

User avatar
Andrew Mamohin
Normal user
Posts: 95
Joined: 12 Jun 2020, 08:30
Location: Belarus, Gomel
Contact:

Re: What type of device do I need?

#11 Post by Andrew Mamohin » 26 Oct 2020, 08:15

Grumpf wrote: 25 Oct 2020, 18:58 what you're trying to achieve ?
I thought that perhaps there is a more suitable type of device for me in ESPEASY.

Now I want to prevent false switching on of my sensor in domoticz when rebooting the ESP.
Andy.

User avatar
Andrew Mamohin
Normal user
Posts: 95
Joined: 12 Jun 2020, 08:30
Location: Belarus, Gomel
Contact:

Re: What type of device do I need?

#12 Post by Andrew Mamohin » 26 Oct 2020, 08:21

TD-er wrote: 25 Oct 2020, 21:05 If this also happens at a warm boot (e.g. a crash)
This happens even when the ESP is rebooted via the ESP EASY interface.

I came up with: I need to write rules so that this sensor is turned on only after loading. Or turn on transfer to domoticz 10 seconds after loading. Something like that.
Andy.

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: What type of device do I need?

#13 Post by TD-er » 26 Oct 2020, 09:33

I just looked at the source code for the "Send Boot State" flag (which is checked in your screenshot)

This is what happens at boot (calling PLUGIN_INIT):
- GPIO state is read from the actual pin
- If "Send Boot State" flag is set, the state variable is inverted (see what happens in PLUGIN_TEN_PER_SECOND)
- state variable is stored in globalMapPortStatus

In the PLUGIN_TEN_PER_SECOND call, the stored state is compared with the actual pin state.
If this has changed, the new state is stored and the connected controller(s) will receive the new state.

So what this "Send Boot State" flag does, is it forces the first reading of the pin to send its state to the controller.
As already was suggested, try with "Send Boot State" flag unchecked.
To me it looks rather strange that doesn't apparently fix it?

User avatar
Andrew Mamohin
Normal user
Posts: 95
Joined: 12 Jun 2020, 08:30
Location: Belarus, Gomel
Contact:

Re: What type of device do I need?

#14 Post by Andrew Mamohin » 26 Oct 2020, 14:52

TD-er wrote: 26 Oct 2020, 09:33 As already was suggested, try with "Send Boot State" flag unchecked.
To me it looks rather strange that doesn't apparently fix it?
Whoa! It works right! Thanks! It's weird that I haven't tried this before. I'm a little dumb...
Andy.

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: What type of device do I need?

#15 Post by TD-er » 26 Oct 2020, 15:11

Good to know I don't need to look further in that part of the code :)

Post Reply

Who is online

Users browsing this forum: No registered users and 53 guests