New hackable ESP gadgets in local budget store "action" !!!

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
happytm
Normal user
Posts: 107
Joined: 15 Aug 2016, 17:53

Re: New hackable ESP gadgets in local budget store "action" !!!

#51 Post by happytm » 18 Oct 2019, 22:26

FanOfHue wrote: 16 Oct 2019, 20:00 ESPNOW was a small but useful side step to improve the firmware for use on the LSC devices.
For all that have asked for more detailed timing specifics, i hooked up a logic analyzer to get some accurate timings.

Global graph, edge triggered on the reed contact, checking VCC power line and serial communications:
DoorSensorTiming1.png

As mentioned, the doorsensor needs or just takes 500 mSeconds before power-up the ESP module. This seems unavoidable.

From there we see three phases, zoom in to the active part:
DoorSensorTiming2.png

Bootloader part is fixed to 64 mSeconds.
Init part is currently 78 mSeconds, maybe there's something to gain if we look more into code detail
Communications is 144 mSeconds. In fact only the last one provides the real status, but it seems that we need all to make the "setup" button logic work.
This needs more testing, but for now i'm happy with the results.

The ESP is active for only 300 milliSeconds.
Can you please calculate power consumption at different stages as show above.It will be very useful to calculate battery life.

Thanks.
Last edited by happytm on 18 Oct 2019, 22:31, edited 2 times in total.

happytm
Normal user
Posts: 107
Joined: 15 Aug 2016, 17:53

Re: New hackable ESP gadgets in local budget store "action" !!!

#52 Post by happytm » 18 Oct 2019, 22:26

FanOfHue wrote: 16 Oct 2019, 20:00 ESPNOW was a small but useful side step to improve the firmware for use on the LSC devices.
For all that have asked for more detailed timing specifics, i hooked up a logic analyzer to get some accurate timings.

Global graph, edge triggered on the reed contact, checking VCC power line and serial communications:
DoorSensorTiming1.png

As mentioned, the doorsensor needs or just takes 500 mSeconds before power-up the ESP module. This seems unavoidable.

From there we see three phases, zoom in to the active part:
DoorSensorTiming2.png

Bootloader part is fixed to 64 mSeconds.
Init part is currently 78 mSeconds, maybe there's something to gain if we look more into code detail
Communications is 144 mSeconds. In fact only the last one provides the real status, but it seems that we need all to make the "setup" button logic work.
This needs more testing, but for now i'm happy with the results.

The ESP is active for only 300 milliSeconds.
Can you please calculate power consumption at different stages as shown above.It will be very useful to calculate battery life.

Thanks.

FanOfHue
Normal user
Posts: 96
Joined: 06 Oct 2018, 10:08

Re: New hackable ESP gadgets in local budget store "action" !!!

#53 Post by FanOfHue » 19 Oct 2019, 16:02

happytm wrote: 18 Oct 2019, 22:26Can you please calculate power consumption at different stages as shown above.It will be very useful to calculate battery life.
Thanks.
How would I be able to calculate this? I've seen one guy doing some sophisticated measurements on ESP like this:
https://www.bakke.online/wp-content/upl ... rsion2.png
But you may need some fancy equipment to do this.
Only stuff I own is a cheap-ass Chinese (8 euro) logic analyzer and a multimeter.
Idle current looks like 50 uAmps.

happytm
Normal user
Posts: 107
Joined: 15 Aug 2016, 17:53

Re: New hackable ESP gadgets in local budget store "action" !!!

#54 Post by happytm » 19 Oct 2019, 21:28

Can you please publish the ESPNow code on GitHub so someone with these fancy equipment can test the code for us ? I myself do not have equipment to test it.

Thanks.

tim
Normal user
Posts: 52
Joined: 05 Dec 2015, 11:24

Re: New hackable ESP gadgets in local budget store "action" !!!

#55 Post by tim » 22 Oct 2019, 16:22

happytm wrote: 19 Oct 2019, 21:28 Can you please publish the ESPNow code on GitHub so someone with these fancy equipment can test the code for us ? I myself do not have equipment to test it.

Thanks.
+1 :!:
I dont have that tools but still want to test it.

FanOfHue
Normal user
Posts: 96
Joined: 06 Oct 2018, 10:08

Re: New hackable ESP gadgets in local budget store "action" !!!

#56 Post by FanOfHue » 23 Oct 2019, 20:33

happytm wrote: 19 Oct 2019, 21:28 Can you please publish the ESPNow code on GitHub so someone with these fancy equipment can test the code for us ? I myself do not have equipment to test it.

Thanks.
Build 5 seems stable, it has been running for several days here and the code is available on GitHub.

tim
Normal user
Posts: 52
Joined: 05 Dec 2015, 11:24

Re: New hackable ESP gadgets in local budget store "action" !!!

#57 Post by tim » 24 Oct 2019, 17:49

Thanks, will try this weekend.

For those who purchased this Action stuff, a forum on tweakers could be handy for more information:
https://gathering.tweakers.net/forum/li ... es/1944054
but it is in dutch language

happytm
Normal user
Posts: 107
Joined: 15 Aug 2016, 17:53

Re: New hackable ESP gadgets in local budget store "action" !!!

#58 Post by happytm » 25 Oct 2019, 00:49

Thanks.

FanOfHue
Normal user
Posts: 96
Joined: 06 Oct 2018, 10:08

Re: New hackable ESP gadgets in local budget store "action" !!!

#59 Post by FanOfHue » 25 Oct 2019, 07:36

Instead of info being scattered around this forum, I have added some more info on the github wiki, just in case someone wants to build one of my gadget projects. :geek:

Howto on the door and pir sensor:
https://github.com/SmartNodeRules/Docum ... mpleESPNOW

Howto on the experimental temperature / humidity sensor:
https://github.com/SmartNodeRules/Docum ... DoorSensor

A doorsensor has gone life in production in my home as of yesterday, controlling the "meterkast" lights. Acts much better than the original version and no Chinese tuya cloud involved :D

The temperature sensor is in test with some dangling wires to the ATTiny and an SI7021 attached. So no pictures yet.

I first need to verify battery life with a 10 minute boot interval. If this looks promising, I will build the final hardware version. I already figured out how to include the SI7021 in the original case.

barth
New user
Posts: 1
Joined: 27 Oct 2019, 15:09

Re: New hackable ESP gadgets in local budget store "action" !!!

#60 Post by barth » 27 Oct 2019, 15:36

I tried to use tuya-convert on the LSC Motion PIR Sensor, albeit no success. Does anyone else have different experience or know why it is not working? I opened the device and it contains a TYWE3S module, which is an ESP82 something.

Code: Select all

======================================================
Starting smart config pairing procedure
Waiting for the device to install the intermediate firmware
Put device in EZ config mode (blinking fast)
Sending SSID                  vtrust-flash
Sending wifiPassword
Sending token                 00000000
Sending secret                0101
................
SmartConfig complete.
Resending SmartConfig Packets
..................................................
Device did not appear with the intermediate firmware
Check the *.log files in the scripts folder
Do you want to flash another device? [y/N]


FanOfHue
Normal user
Posts: 96
Joined: 06 Oct 2018, 10:08

Re: New hackable ESP gadgets in local budget store "action" !!!

#61 Post by FanOfHue » 28 Oct 2019, 20:48

maxe2 wrote: 07 Oct 2019, 19:17 I tried to build my own firmware from here https://github.com/SmartNodeRules/ESPCoreRules with success but did not manage to get MQTT to work properly :(
While waiting for the battery charts to evolve in Domoticz, i'm currently checking out MQTT (and maybe uMQTTBroker) again. The MQTT code exits because I just wanted to see if one could transparently switch between the build-in UDP message bus or a message bus backed by an MQTT broker. It was based on R120 and assumed stable because R120 was labeled stable.

I reinstalled Mosquitto on my server and it still seems to work if you switch between UDP and MQTT. The nodes are not aware when it comes to events and nodelist. But to avoid interference with other MQTT clients, I decided at development time to use a fixed prefix "BROADCAST/" on all communication topics. You should be able to see this when subscribing to # with an MQTT client tool.

I'm not really familiar with MQTT so this may not be the best approach. Maybe I need a dedicated topic for system messages and push events on the bus as they are and use rules to subscribe to specific topics. So this may need more development or study :mrgreen:

On the other hand, I wonder if any of my contributions to this forum is actually used by anyone and if it would be worth while to invest more time.
I guess that i'm really on a very niche corner here. But happy with my personal 10+ smartnoderules as is.

jorgh
New user
Posts: 1
Joined: 02 Nov 2019, 00:32

Re: New hackable ESP gadgets in local budget store "action" !!!

#62 Post by jorgh » 02 Nov 2019, 00:46

Hi all,

I've bought among others one LCS doorsensor, my goal is to create some firmware with an easy setup (hotspot + captive portal for config and MQtt for connecting to non-cloud home automation). I share this information as this might be helpfull for others. If you spot any mistakes or have valuable additional information, feel free to respond;-)

I've been snooping at the communication between the ESP and the MCU on the doorsensor, and this is what I found:

The ESP is powered on when either the sensor is opened or closed, or when the button is pressed for 5 seconds. The ESP seems to spit out some garbage first, which is ignored by the MCU (at least I've not been able to recognize anything inn the data and the MCU does not seem to do anything with it).

As with most Tuya devices, the communication is initiated by the ESP to query product information, after which a dialog starts to monitor the progress of setting up the connection. After the ESP is successfully connected to both the WLAN and the Cloud, the MCU spits out a message containing among others the sensor status. After the last response from the ESP, the ESP is powered off. Below is the data I analysed with the explanation as per tuya protocol (but there seem to be some differences with the actual use here). As I was not able to trace both sides of the conversation at the same time, I've put the data in the order I believe to be correct. Command 05 seems to be used by the MCU to deliver the sensor status, and from the ESP that it can be powered down.

ESP:
[55] [aa] [00] [01] [00] [00] [00]
[55] [aa] header
[00] version
[01] Command (Query product information)
[00] [00] Data Length (36)
[00] Checksum

MCU:
[55] [aa] [00] [01] [00] [24] [7b] [22] [70] [22] [3a] [22] [69] [32] [32] [66] [72] [65] [79] [79] [70] [71] [64] [63] [69] [72] [71] [33] [22] [2c] [22] [76] [22] [3a] [22] [31] [2e] [30] [2e] [34] [22] [7d] [c6]
[55] [aa] header
[00] version
[01] Command (Query product information)
[00] [24] Data Length (36)
[7b] [22] [70] [22] [3a] [22] [69] [32] [32] [66] [72] [65] [79] [79] [70] [71] [64] [63] [69] [72] [71] [33] [22] [2c] [22] [76] [22] [3a] [22] [31] [2e] [30] [2e] [34] [22] [7d] {"p":"i22freyypqdcirq3","v":"1.0.4"}
[c6] Checksum


Following section can repeat:
--Start section --
MCU:
[55] [aa] [00] [02] [00] [00] [01]
[55] [aa] header
[00] version
[02] Command (Query the working mode of the Wi-Fi module)
[00] [00] Data Length (0)
[01] Checksum

ESP:
[55] [aa] [00] [02] [00] [01] [02] [04]
[55] [aa] header
[00] version
[02] Command (Query the working mode of the Wi-Fi module)
[00] [01] Data Length (1)
[02] The Wi-Fi is configured. However, the device fails to connect to the router.
[04] Checksum

OR

[55] [aa] [00] [02][00] [01] [03][05]
[55] [aa] header
[00] version
[02] Command (Query the working mode of the Wi-Fi module)
[00] [01] Data Length (1)
[03] The Wi-Fi is configured, and the device successfully connects to the router.
[05] Checksum
-- End Section –

Previous section repeats until ESP responds with:
[55] [aa] [00] [02] [00] [01] [04] [06]
[55] [aa] header
[00] version
[02] Command (Query the working mode of the Wi-Fi module)
[00] [01] Data Length (1)
[04] The device connects to the router and cloud.
[06] Checksum

MCU:
[55] [aa] [00] [05] [00] [05] [01] [01] [00] [01] [01] [0d]
[55] [aa] header
[00] version
[05] Command (Reset the Wi-Fi module and select a network configuration mode)
[00] [05] Data Length (5)
Sensor open: [01] [01] [00] [01] [01] or Sensor closed [01] [01] [00] [01] [00]
[0d] Checksum or [0c] when closed

ESP:
[55] [aa] [00] [05] [00] [01] [00] [05]
[55] [aa] header
[00] version
[05] Command (Reset the Wi-Fi module and select a network configuration mode)
[00] [01] Data Length (1)
[00] Data
[05] Checksum

Regards,

Jorg

tim
Normal user
Posts: 52
Joined: 05 Dec 2015, 11:24

Re: New hackable ESP gadgets in local budget store "action" !!!

#63 Post by tim » 02 Nov 2019, 10:31

Have tried to link smartnoderules and espeasy but no succes. The smartnoderules plugin does not work and looks i am alone trying this. So i stopped loosing more time there.

I just read this topic from the start and the conclusion until now:

* We have a minimum 9 doorsensor owners: Me,FanOfHue,Dick60,Patricx,RobinS,Legoracers,ManoBiletsky,jme,maxe2
* Several users checked the communication and wrote down the info here. I think we have all info that a developer need to now
* Fanofhue has its own private smartnoderules working with his plugin
* But nobody wants to use smartnoderules so this is also not good for me to be the only one. Support will not be good
* Everyone has problems with the doorsensor or did not report succes here on this forum to help others with the solution how they did it

Al i want is to turn on a light when the door opens and turn off when the door closes. There should not be a 5 seconds delay.

@fanofhue: Can you please try to convert the plugin to ESPEasy? I think this is the only right solution for all.
@all other doorsensor users: What did you do to get it to work or do you also have issues?

Flying Domotic
Normal user
Posts: 37
Joined: 27 Aug 2019, 23:57

Re: New hackable ESP gadgets in local budget store "action" !!!

#64 Post by Flying Domotic » 08 Nov 2019, 10:03

I also tried SmartNodeRules on LSC sensors. While this is working well with door sensor, it seems that the PIR sensors are not so good supported.

Globally, settings and comms seems good (you got an "off" message send when powering the device on), but there's no update after this initial message. As the MCU is not powered on/triggered again after initial message, I do suspect some issue on protocol btw MCU and "device". Should someone tell me how to enable trace, I'll be please to help debugging this problem ;-)

FYI, I tested with a couple of PIR, both shows the same behavior.

Flying Domotic
Normal user
Posts: 37
Joined: 27 Aug 2019, 23:57

Re: New hackable ESP gadgets in local budget store "action" !!!

#65 Post by Flying Domotic » 08 Nov 2019, 10:08

I also tried SmartNodeRules on LSC sensors. While this is working well with door sensor, it seems that the PIR sensors are not so good supported.

Globally, settings and comms seems good (you got an "off" message send when powering the device on), but there's no update after this initial message. As the MCU is not powered on/triggered again after initial message, I do suspect some issue on protocol btw MCU and "device". Should someone tell me how to enable trace, I'll be please to help debugging this problem ;-)

FYI, I tested with a couple of PIR, both shows the same behavior.

tim
Normal user
Posts: 52
Joined: 05 Dec 2015, 11:24

Re: New hackable ESP gadgets in local budget store "action" !!!

#66 Post by tim » 08 Nov 2019, 16:45

Flying Domotic wrote: 08 Nov 2019, 10:08 I also tried SmartNodeRules on LSC sensors. While this is working well with door sensor, it seems that the PIR sensors are not so good supported.

Globally, settings and comms seems good (you got an "off" message send when powering the device on), but there's no update after this initial message. As the MCU is not powered on/triggered again after initial message, I do suspect some issue on protocol btw MCU and "device". Should someone tell me how to enable trace, I'll be please to help debugging this problem ;-)

FYI, I tested with a couple of PIR, both shows the same behavior.
I think that the PIR sensor only triggers on motion detected. Not when no motion anymore. I replaced firmware but i can not remember that the original firmware sends motion on and motion off. Maybe cannot change this. Not even with other firmware in the ESP.

May i ask how long it takes before you receive the message? Without using ESPNOW it takes almost 5 seconds in my home network. ESPNOW is faster but much more difficult to get working with a gateway.

But i saw a guy that has the messsage in only 1.5 seconds with Tasmota, look at this forum (if you can read dutch or use google translate)
https://gathering.tweakers.net/forum/li ... 6#60541576
Maybe i switch to using Tasmota if it can connect that fast!

Flying Domotic
Normal user
Posts: 37
Joined: 27 Aug 2019, 23:57

Re: New hackable ESP gadgets in local budget store "action" !!!

#67 Post by Flying Domotic » 14 Nov 2019, 18:04

I think that the PIR sensor only triggers on motion detected. Not when no motion anymore. I replaced firmware but i can not remember that the original firmware sends motion on and motion off. Maybe cannot change this. Not even with other firmware in the ESP.
I got that. In my case, no messages outside the initial message, when booting the device by setting the batteries. Amazingly, this message gives a state "0". But nothing else, even if moving in front of the sensors. i should normally get at least state "1" messages each time something is movingin front of the PIR.
May i ask how long it takes before you receive the message? Without using ESPNOW it takes almost 5 seconds in my home network. ESPNOW is faster but much more difficult to get working with a gateway.
Almost immediate, between 0,5 and 1 second. To get this, I set a fixed address/mask/gateway/dns, and disabled NTP.

To move forward, I suspect some errors in initial dialog, as the internal LED is blinking first time when powered, a second time 1 second later, sending the initial message, and stays definitively off until powered down and then up.

Is there a way to turn some debug on to "see" what happens (I do suspect serial debug being difficult, as serial port in used to "discuss" btw ESP and internal "devices") ? :?:

tim
Normal user
Posts: 52
Joined: 05 Dec 2015, 11:24

Re: New hackable ESP gadgets in local budget store "action" !!!

#68 Post by tim » 15 Nov 2019, 16:45

Flying Domotic wrote: 14 Nov 2019, 18:04Almost immediate, between 0,5 and 1 second.
That is really great :o :o :o

I must do something wrong in my home. I already use static IP and NTP is off.
I wonder how you can get 0,5 seconds if the logic analyzer pictures from fanofhue show at least 0,5 sec delay before the ESP is power on.
Maybe you have different firmware in the MCU?

Can you tell me more details, so we do not talk maybe about different things:
* Firmware version of the doorsensor MCU ?, mine is 1.0.4
* Protocol used on the doorsensor to send the message, ESPNOW or MSGBUS or HTTP?
* Type of firmware and version used in ESP?
* Using WPA2 or other Wifi security on your AP?

I would love to make my module a lot faster but never succesful yet :(

SparX
New user
Posts: 1
Joined: 16 Nov 2019, 15:09

Re: New hackable ESP gadgets in local budget store "action" !!!

#69 Post by SparX » 16 Nov 2019, 15:12

Hey, guys :)
I just got the Action RGB bulb too.
I,ve opened it up and am going to flash it with Tasmota, so integration with Hassio will be easy.
I'll keep you informed!

Flying Domotic
Normal user
Posts: 37
Joined: 27 Aug 2019, 23:57

Re: New hackable ESP gadgets in local budget store "action" !!!

#70 Post by Flying Domotic » 16 Nov 2019, 22:19

tim wrote: 15 Nov 2019, 16:45 Can you tell me more details, so we do not talk maybe about different things:
* Firmware version of the doorsensor MCU ?, mine is 1.0.4
Don't know. I don't touch it. What's the way to get it?
* Protocol used on the doorsensor to send the message, ESPNOW or MSGBUS or HTTP?
ESPnow
* Type of firmware and version used in ESP?
ESPCoreRules build 5 (the one indicated earlier in this post), on both door sensor and serial gateway
* Using WPA2 or other Wifi security on your AP?
WPA2 (hidden SSID)

Just few small things compared to configurations given at https://github.com/SmartNodeRules/Docum ... mpleESPNOW:
  • I moved "tuyacheck" at end of configuration
  • I changed "Config,Rules,Clock" to zero (not one)
  • I removed "deepsleep 5" (even if this may save some power btw end of transmission and power off of ESP). I will try putting it back, I made this change when nothing was working, and didn't reverted it
  • I used chips real mac addresses instead those of the example

Neutrino
New user
Posts: 5
Joined: 10 Sep 2017, 14:41

Re: New hackable ESP gadgets in local budget store "action" !!!

#71 Post by Neutrino » 17 Nov 2019, 19:05

Hi !
Door sensor owner here :)
I just connect the reed to GPIO13.
20190825_165123.jpg
20190825_165123.jpg (79.57 KiB) Viewed 67677 times
It works since 25/08 without battery replacement.

Flying Domotic
Normal user
Posts: 37
Joined: 27 Aug 2019, 23:57

Re: New hackable ESP gadgets in local budget store "action" !!!

#72 Post by Flying Domotic » 18 Nov 2019, 10:13

Doing so, you've got an ESP powered only when contact changes, and can read contact value on GPIO 13 without need to board TUYA protocol, right?
Does EasyESP hav time to start and send the message within the powered interval?

Neutrino
New user
Posts: 5
Joined: 10 Sep 2017, 14:41

Re: New hackable ESP gadgets in local budget store "action" !!!

#73 Post by Neutrino » 18 Nov 2019, 16:13

That's right.
When contact changes, the esp power up connect to m'y AP and updates domoticz through http.
Then, the sensor is power off itself.
I use it on my fridge, not on a major access.

patricx
New user
Posts: 2
Joined: 30 Aug 2019, 13:15

Re: New hackable ESP gadgets in local budget store "action" !!!

#74 Post by patricx » 28 Nov 2019, 20:48

I have a working lsc doorsensor.

I use tasmota v7 with the commands below in the console command line



module 54
backlog TuyaMcu 11,1; TuyaMcu 51,51; TuyaMcu 12,3
rule1 ON Wifi#Connected DO backlog serialsend5 55 AA 00 01 00 00 00; delay 10; serialsend5 55 AA 00 02 00 01 04 06; delay 3; serialsend5 55 AA 00 05 00 01 00 05; ENDON
rule2 ON TuyaReceived#Data=55aa000200000155aa0005000501010001010d DO POWER ON ENDON
rule3 ON TuyaReceived#Data=55aa000200000155aa0005000501010001000c DO POWER OFF ENDON
restart 1

Robvs
New user
Posts: 3
Joined: 09 Sep 2019, 17:21

Re: New hackable ESP gadgets in local budget store "action" !!!

#75 Post by Robvs » 02 Dec 2019, 12:06

Hi patrick
can you explain how you us the device. does it report trough mqtt, do you use homeassistant or domoticz.
I want to use your code and iam using domoticz.


EDIT: I can confirm the solotion that patrick offers works! I used tasmota 7.1 firmware specifcly the tasmota.bin version (this has domoticz tab) to flash the firmware of the doorcontact (did use wired flash not OTA). In the console I pasted the code that Patrick wrote up!.

Then I set up Domoticz on a Rbpi and set up Mosquitto MQtt as well. Then I added a switch device that I configurerd as a doorswitch.

Then I filled in de MQTT information in the doorcontacts tasmota MQTT menu (You have to keep te doorcontact from shutting down by constantly adding and removing the magnet side or you can do it while the doorcontact is still connected to the flashing hardware (it powers the WIFI chip directly)).

And voila ...its works!

The doorswitch does take 5 seconds to switch a light after the realtime state is changed (eg the magnet is removed or added)

is there any way to make this faster?
great work!

Sincirely Rob

FanOfHue
Normal user
Posts: 96
Joined: 06 Oct 2018, 10:08

Re: New hackable ESP gadgets in local budget store "action" !!!

#76 Post by FanOfHue » 05 Dec 2019, 20:25

Robvs wrote: 02 Dec 2019, 12:06 The doorswitch does take 5 seconds to switch a light after the realtime state is changed (eg the magnet is removed or added)
is there any way to make this faster?
If Theo could as ESPNOW protocol to Tasmota it will be a lot faster (<1 Second)

mrrose
New user
Posts: 7
Joined: 11 Jul 2018, 16:42

Re: New hackable ESP gadgets in local budget store "action" !!!

#77 Post by mrrose » 14 Dec 2019, 17:47

patricx wrote: 28 Nov 2019, 20:48 I have a working lsc doorsensor.

I use tasmota v7 with the commands below in the console command line



module 54
backlog TuyaMcu 11,1; TuyaMcu 51,51; TuyaMcu 12,3
rule1 ON Wifi#Connected DO backlog serialsend5 55 AA 00 01 00 00 00; delay 10; serialsend5 55 AA 00 02 00 01 04 06; delay 3; serialsend5 55 AA 00 05 00 01 00 05; ENDON
rule2 ON TuyaReceived#Data=55aa000200000155aa0005000501010001010d DO POWER ON ENDON
rule3 ON TuyaReceived#Data=55aa000200000155aa0005000501010001000c DO POWER OFF ENDON
restart 1

HI,

not sure what i doing wrong. I install Tasmota 7.1.2 and copy the code above to the console.

After that I get Toggle 1 and Toggle 2. Is that correct?

But anyway i see by MQTT only "Off" it never changes to "On".

What i´m doing wrong?

Thanks for help.

duhen
New user
Posts: 1
Joined: 16 Dec 2019, 22:35

Re: New hackable ESP gadgets in local budget store "action" !!!

#78 Post by duhen » 16 Dec 2019, 22:48

@mrrose
Two Toggles are OK. Toggle 1 is the one to keep track of.
Mine is functioning fine, I get my MQTT messages on topic: stat/lsc_ds_01/POWER1
Schermafbeelding 2019-12-16 om 22.39.29.png
Schermafbeelding 2019-12-16 om 22.39.29.png (154.49 KiB) Viewed 65985 times
I entered the rules in the order Rule3,Rule2,Rule1 and then the backlog, because otherwise it's much harder to get the command in time to extend the stay-alive of the ESP-unit with:
Serialsend5 55 AA 00 02 00 01 00 02
Hope this helps you out

mrrose
New user
Posts: 7
Joined: 11 Jul 2018, 16:42

Re: New hackable ESP gadgets in local budget store "action" !!!

#79 Post by mrrose » 21 Dec 2019, 10:01

@Duhen Thanks mate that worked now :-) One question else: Did you see a chance to send the voltage of the battery as well?

FanOfHue
Normal user
Posts: 96
Joined: 06 Oct 2018, 10:08

Re: New hackable ESP gadgets in local budget store "action" !!!

#80 Post by FanOfHue » 21 Dec 2019, 14:57

After two months of operation as test device, reporting every 10 minutes, the battery voltage is still ok and the decline during the last month is even lower than the first month:
SensorBatVoltage.png
SensorBatVoltage.png (42.14 KiB) Viewed 65634 times
Looks promising, so yesterday i've build the first two units for production use:
DoorSensorModSI7021.png
DoorSensorModSI7021.png (232.69 KiB) Viewed 65634 times
Takes about 30 minutes of soldering and then we're live with temperature and bat voltage charts in Domoticz.

0xcafebabe
New user
Posts: 1
Joined: 29 Dec 2019, 22:51

Re: New hackable ESP gadgets in local budget store "action" !!!

#81 Post by 0xcafebabe » 29 Dec 2019, 22:56

mrrose wrote: 21 Dec 2019, 10:01 @Duhen Thanks mate that worked now :-) One question else: Did you see a chance to send the voltage of the battery as well?
@mrrose
Just follow the instructions https://templates.blakadder.com/TYMC-1.html and you get battery level information as well.
With tasmota 8.1, you can use this generic rule for all door sensors

Code: Select all

Rule1 ON TuyaReceived#Data=55AA00050005030400010213 DO publish2 stat/%topic%/BATT high ENDON ON TuyaReceived#Data=55AA00050005030400010114 DO publish2 stat/%topic%/BATT medium ENDON ON TuyaReceived#Data=55AA00050005030400010015 DO publish2 stat/%topic%/BATT low ENDON

Gouz91
New user
Posts: 1
Joined: 30 Dec 2019, 21:35

Re: New hackable ESP gadgets in local budget store "action" !!!

#82 Post by Gouz91 » 30 Dec 2019, 21:44

Good evening,

i'm trying to flash a LSC door sensor, tuya-convert didn't work because it isn't long enough online. Now i'm trying the hardware route but i'm in a bit of a struggle.
The ESP Easy software says it's offline by default, when i press the button with the battery's in it's going into slow blinking mode and ESP Easy says it's online.
However every few seconds it quickly turn's the connection of and right back on ( usb connect disconnect sound on windows )

I've soldered the VCC to the VCC of the TTL to usb
GND to the GND and GPIO0 to the GND of the TTL to usb
TX and RX are connected as well

Might i be doing something wrong with the GND? or is there a way to keep it alive long enough for it to flash tasmota?
I thought to gave flashing devices a try but it's quite hard if it's a battery powered device i learned.

With kind regards,
Gouz91

countcobolt
Normal user
Posts: 32
Joined: 12 Jun 2017, 11:12

Re: New hackable ESP gadgets in local budget store "action" !!!

#83 Post by countcobolt » 13 Jan 2020, 08:46

Neutrino wrote: 17 Nov 2019, 19:05 Hi !
Door sensor owner here :)
I just connect the reed to GPIO13.
20190825_165123.jpg
It works since 25/08 without battery replacement.
@Neutrino
a few questions:
1. Does the device go to deep sleep after a change is detected
2. Are you using stock firmware (espeasy/tasmota/?) to do the update? My preference would be to either read GPIO13, do a normal rule with sendHTTP to my domoticz and update the IDX of the sensor.
3. How did you define GPIO13?

Kind regards

countcobolt
Normal user
Posts: 32
Joined: 12 Jun 2017, 11:12

Re: New hackable ESP gadgets in local budget store "action" !!!

#84 Post by countcobolt » 13 Jan 2020, 08:51

FanOfHue wrote: 21 Sep 2019, 10:18
Legoracers wrote: 17 Sep 2019, 11:05 Has anyone got the door sensor running on custom firmware?
I have one running with SmartNodeRules. Just updated the plugin so it creates a rule event "TUYA#Event=<state>" when the sensor detects a change.

Sample rule:

Code: Select all

On TUYA#Event do
  msgbus %sysname%/DoorSwitch=%eventvalue%
endon
Any of the other smart nodes can now act upon this event
@FanofHue

It is possible for the event to define if is is door open or door closed? I basically want to have a TUYA#DoorClosed do and then use sendHTTP to my domoticz.

Kind regards

Steve

rola25
New user
Posts: 4
Joined: 23 Jan 2020, 01:10

Re: New hackable ESP gadgets in local budget store "action" !!!

#85 Post by rola25 » 23 Jan 2020, 01:14

Hi all

I tried to compile https://github.com/SmartNodeRules/ESPCoreRules (latest version) and uploaded it to my doorsensor, but it didn't work, no serial output or anything. Tasmota runs fine on the device. Can you give me the exact settings for Arduino IDE Generic ESP8266 Settings (Board Version, lwip, Vtables, etc.) so that I can check if I had just wrong settings?

Thanks
rola

rola25
New user
Posts: 4
Joined: 23 Jan 2020, 01:10

Re: New hackable ESP gadgets in local budget store "action" !!!

#86 Post by rola25 » 23 Jan 2020, 12:06

Today I tried to compile it with different board settings, uploaded it with different esptools, I also tried to upload it to a Wemos D1, but all I get is garbage on the serial console (even on the Wemos). Does anybody have a precompiled binary or another solution how to get it work?

rola

tim
Normal user
Posts: 52
Joined: 05 Dec 2015, 11:24

Re: New hackable ESP gadgets in local budget store "action" !!!

#87 Post by tim » 24 Jan 2020, 17:00

rola25 wrote: 23 Jan 2020, 12:06 Today I tried to compile it with different board settings, uploaded it with different esptools, I also tried to upload it to a Wemos D1, but all I get is garbage on the serial console (even on the Wemos). Does anybody have a precompiled binary or another solution how to get it work?

rola
Did you use this guide: https://github.com/SmartNodeRules/Docum ... mpleESPNOW
Do you get any reply when typing those serial commands?

rola25
New user
Posts: 4
Joined: 23 Jan 2020, 01:10

Re: New hackable ESP gadgets in local budget store "action" !!!

#88 Post by rola25 » 26 Jan 2020, 08:19

Yes I used these settings - no output when typing the serial commands. And as I said, tasmota runs fine on the device but SmartNodeRules doesn't boot - even ESPEasy works, With SmartNodeRules I get only garbage on the serial console. Do I have to install some version of ESPEasy first and then update it with SmartNodeRules? If yes, which version should I use?

Thanks

Flying Domotic
Normal user
Posts: 37
Joined: 27 Aug 2019, 23:57

Re: New hackable ESP gadgets in local budget store "action" !!!

#89 Post by Flying Domotic » 26 Jan 2020, 10:16

Should you get garbage at console, did you checked the serial port speed?

tim
Normal user
Posts: 52
Joined: 05 Dec 2015, 11:24

Re: New hackable ESP gadgets in local budget store "action" !!!

#90 Post by tim » 26 Jan 2020, 12:22

rola25 wrote: 26 Jan 2020, 08:19 Yes I used these settings - no output when typing the serial commands. And as I said, tasmota runs fine on the device but SmartNodeRules doesn't boot - even ESPEasy works, With SmartNodeRules I get only garbage on the serial console. Do I have to install some version of ESPEasy first and then update it with SmartNodeRules? If yes, which version should I use?

Thanks
Maybe you can compile it with this setting in the ESPcorerules.ino:
#define SERIALDEBUG true
And set speed to 115200 and see the output when booting.

I did my sensor sometime ago. I was installed with ESPEasy first but i remember after uploading ESPcorerules it copied the Wifi settings from ESPEasy and created a new boot.txt file with the wifi settings. It worked the first time, but using DHCP so check the router if it is connected. Or serial if that works

There is also a reset command that will format the flash. But you need serial to give the command

tim
Normal user
Posts: 52
Joined: 05 Dec 2015, 11:24

Re: New hackable ESP gadgets in local budget store "action" !!!

#91 Post by tim » 26 Jan 2020, 12:30

one other mistake i did in the start using serial monitor from Arduino is that the setting was "no line ending". The nothing seems to work.
I set it to "both NL & CR"

rola25
New user
Posts: 4
Joined: 23 Jan 2020, 01:10

Re: New hackable ESP gadgets in local budget store "action" !!!

#92 Post by rola25 » 27 Jan 2020, 11:23

It was indeed the serial console speed - I don't know why, but I had to set it to 74880 to get it work :o

Thanks

chib
New user
Posts: 3
Joined: 27 Jan 2020, 20:05

Re: New hackable ESP gadgets in local budget store "action" !!!

#93 Post by chib » 27 Jan 2020, 20:18

Hi,

I have a couple of PIR action switches running here for a while now. I wrote a super simple small firmware that will connect to wifi and send out a mqtt message. It is able to do it quite fast (< 1 second).
It works reasonably well to switch the lights on, the is only a small delay compared to wired pirs.

Now i'm looking into the door sensors. Why is it so slow? Is it really 7 seconds before it sends out a mqtt message?
Then it will be useless for switching lights on, I will hit a wall before that time I think :lol:

FanOfHue
Normal user
Posts: 96
Joined: 06 Oct 2018, 10:08

Re: New hackable ESP gadgets in local budget store "action" !!!

#94 Post by FanOfHue » 29 Jan 2020, 20:23

rola25 wrote: 27 Jan 2020, 11:23 It was indeed the serial console speed - I don't know why, but I had to set it to 74880 to get it work :o

Thanks
That baud rate is specific to the ROM bootloader. It will indeed show a human readable ROM boot message instead of garbage. But ESPCoreRules works at 115200 by default. Do you receive any ESP message after the bootloader process?

FanOfHue
Normal user
Posts: 96
Joined: 06 Oct 2018, 10:08

Re: New hackable ESP gadgets in local budget store "action" !!!

#95 Post by FanOfHue » 29 Jan 2020, 20:30

chib wrote: 27 Jan 2020, 20:18 Hi,

I have a couple of PIR action switches running here for a while now. I wrote a super simple small firmware that will connect to wifi and send out a mqtt message. It is able to do it quite fast (< 1 second).
It works reasonably well to switch the lights on, the is only a small delay compared to wired pirs.

Now i'm looking into the door sensors. Why is it so slow? Is it really 7 seconds before it sends out a mqtt message?
Then it will be useless for switching lights on, I will hit a wall before that time I think :lol:
In my enviroment, doorsensor allways takes 3 to 5 seconds whatever application i use (even a small custom firmware). It seems that the specific access point brand/model and authentication mode has a huge influence on actual connect times. Some people are lucky i guess, but not me...
But with ESPNOW protocol it takes only 0.8 second to boot and send the message so i'm using the ESPNOW route until i find a faster way. It only comes with a price of one additional ESP as gateway. Well that's another 4 euro... :D

chib
New user
Posts: 3
Joined: 27 Jan 2020, 20:05

Re: New hackable ESP gadgets in local budget store "action" !!!

#96 Post by chib » 29 Jan 2020, 23:50

FanOfHue wrote: 29 Jan 2020, 20:30 In my enviroment, doorsensor allways takes 3 to 5 seconds whatever application i use (even a small custom firmware). It seems that the specific access point brand/model and authentication mode has a huge influence on actual connect times. Some people are lucky i guess, but not me...
But with ESPNOW protocol it takes only 0.8 second to boot and send the message so i'm using the ESPNOW route until i find a faster way. It only comes with a price of one additional ESP as gateway. Well that's another 4 euro... :D
It seems like a lot of hassle, an extra esp for each door sensor? Or is it one in the entire house?

I wrote a small firmware that will connect to wifi using wifi channel and mac address. I read somewere this was the fastest way to connect an esp to wifi.
The wifi connect code looks like this:

Code: Select all

  WiFi.begin(Settings.WifiSSID, Settings.WifiKey, atoi(Settings.WifiChannel), mac);
the downside is that your wifi ssid has to be on a fixed channel, and you;ll have to set the macadress in config. And i also don't know if it actually helps :lol:
But my pir's connect <1 second so it was good enough and i stopped testing.

So maybe I will get a door sensor this weekend and will test it out then. Maybe it will have the same behaviour as the pir? But it has to wake up and read the door sensor state somehow? The pir just wakes up so that was easy.

FanOfHue
Normal user
Posts: 96
Joined: 06 Oct 2018, 10:08

Re: New hackable ESP gadgets in local budget store "action" !!!

#97 Post by FanOfHue » 31 Jan 2020, 16:47

I've added BSSID and channel as option into ESPCoreRules and indeed it connects a lot faster than usual.
Normal connect is about 3-4 seconds. With BSSID set, it is 1.05 second. ESP Boot takes 150 mSec, so total 1.2 seconds.

The doorsensor takes 0,5 seconds to power up the ESP so that would take 1.7 seconds for the entire process (in theory, did not test this).

ESPNOW is still a winner with 0.8 seconds total time.

tim
Normal user
Posts: 52
Joined: 05 Dec 2015, 11:24

Re: New hackable ESP gadgets in local budget store "action" !!!

#98 Post by tim » 02 Feb 2020, 14:29

Can you post it on github?

tim
Normal user
Posts: 52
Joined: 05 Dec 2015, 11:24

Re: New hackable ESP gadgets in local budget store "action" !!!

#99 Post by tim » 02 Feb 2020, 15:05

@fanofhue: Do you have something like a roadmap for ESPCoreRules?

FanOfHue
Normal user
Posts: 96
Joined: 06 Oct 2018, 10:08

Re: New hackable ESP gadgets in local budget store "action" !!!

#100 Post by FanOfHue » 03 Feb 2020, 19:54

tim wrote: 02 Feb 2020, 14:29 Can you post it on github?
I'm currently finishing work on build 7. Latest work is migrating all static allocated array structs to dynamic allocation that can be set at runtime instead of compile time. I just put it onto all production nodes at home to see if it looks stable enough to publish. May take a few days.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 30 guests