Oh man… i found it out… Problem was that i let the libraries folder in the sketch-folder, too
Sorry…
Learning by doing…
-
mysensors Esp8266gateway with direct rest-api access to pimatic
-
Great, seems working…
At the moment i am not at home, so gateway cannot reach pimatic-server:ESP8266 MySensors Gateway with pimatic interface
Connecting to Fritzbox7390
…Connected!
IP: 192.168.0.135
0;0;3;0;9;gateway started, id=0, parent=0, distance=0
0;0;3;0;9;read: 15-15-0 s=255,c=3,t=15,pt=2,l=2,sg=0:0
15;255;3;0;15;0
Node-Sensor (yourvariable) 15-255; Value 0
connection failed
0;0;3;0;9;read: 15-15-0 s=255,c=0,t=17,pt=0,l=5,sg=0:1.5.4
15;255;0;0;17;1.5.4
Node-Sensor (yourvariable) 15-255; Value 1.5.4
connection failed
0;0;3;0;9;read: 15-15-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
15;255;3;0;6;0
Node-Sensor (yourvariable) 15-255; Value 0
connection failed
0;0;3;0;9;read: 15-15-0 s=255,c=3,t=11,pt=0,l=23,sg=0:Temperatursenso
15;255;3;0;11;Temperatursensoren Pool
Node-Sensor (yourvariable) 15-255; Value Temperatursensoren Pool
connection failed
0;0;3;0;9;read: 15-15-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.3
15;255;3;0;12;1.3
Node-Sensor (yourvariable) 15-255; Value 1.3
connection failed
0;0;3;0;9;read: 15-15-0 s=1,c=1,t=0,pt=7,l=5,sg=0:31.1
15;1;1;0;0;31.1
Node-Sensor (yourvariable) 15-1; Value 31.1
connection failed
0;0;3;0;9;read and forward: 15-15-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
0;0;3;0;9;read: 15-15-0 s=2,c=1,t=1,pt=2,l=2,sg=0:1106772019
15;2;1;0;1;1090519091
Node-Sensor (yourvariable) 15-2; Value 1090519091
connection failedJust a question, what does “yourvariable” means? Should it not be filled with some information?
Thank you… -
Okay, now i am a step further…
But… Data which came from my temperature-sensor (Sensebender micro from mysensors) are a little bit confusing for me.
“15-2; Value 1090519091” Should be Humidity
"15-1; Value 31.1" Should be temperature… Thats okay…
“15-255; Value 1.3” Should be battery… mhh strage?
And iam missing some more data from my sensor…
Here is a string of my serial-output from mysensor:Sensebender Micro FW 1.3send: 15-15-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0
send: 15-15-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.4
send: 15-15-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
sensor started, id=15, parent=0, distance=1- Online!
send: 15-15-0-0 s=255,c=3,t=11,pt=0,l=23,sg=0,st=ok:Temperatursensoren Pool
send: 15-15-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.3
send: 15-15-0-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=fail:
send: 15-15-0-0 s=2,c=0,t=7,pt=0,l=0,sg=0,st=fail:
isMetric: 1
TempDiff :125.00
HumDiff :155.00
T: 25.89
H: 55
T1: Device Address: 0000000000000000 Temp C: -127.00 Temp F: -196.60
T2: Device Address: 0000000000000000 Temp C: -127.00 Temp F: -196.60
send: 15-15-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:25.9
send: 15-15-0-0 s=2,c=1,t=1,pt=2,l=2,sg=0,st=fail:55
send: 15-15-0-0 s=255,c=3,t=0,pt=1,l=1,sg=0,st=fail:101
So i marked my sensors bold…
Strange?
Some idea? - Online!
-
Okay aim giving up for now.
Gateway prints and sends some totally strange values to pimatic.
Sensor sends definitely out the correct ones, and it looks like sometimes the very first value which is printed out in the serial monitor is correct, but if the next ones are send by the sensor the value is false. Only the temperature of the build in sensor (sensebender) seems to be correct he whole time…
I was looking in the code and tried several things out… but with no success…
Thank you and good night -
sorry to hear! maybe the next days somebody with mysensor knowledge is able to have a closer look at your issue.
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
@HarrySteff said in mysensors Esp8266gateway with direct rest-api access to pimatic:
Just a question, what does “yourvariable” means? Should it not be filled with some information?
Thank you…That’s a stupid typo. It should say “your variable”, but better would have been “variable to use in pimatic”, because that is what it actually means.
I currently do not understand what causes the weird settings for the humidity. The debug line of the mysensors output also mentions
0;0;3;0;9;read: 15-15-0 s=2,c=1,t=1,pt=2,l=2,sg=0:1106772019 15;2;1;0;1;1090519091
However, the debug output of the next post mentions
send: 15-15-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:25.9 send: 15-15-0-0 s=2,c=1,t=1,pt=2,l=2,sg=0,st=fail:55 send: 15-15-0-0 s=255,c=3,t=0,pt=1,l=1,sg=0,st=fail:101
It really bugs me. Maybe the
fail:
before the value has something to do with it.
But I don’t have a solution yet.
(And I don’t have much time today and will be away the next 3 days) -
Hey Harry, Thank you for your reply … I will try to support and help you as much as i can! Maybe i will become a Programmer… I already created some debug outputs for helping me to understand when what happened - iam not on my pc right now, if iam back i will post more Information here! I think the fail: only means that the gateway was not reachable at this Moment… If i find Time, i will Post again both serial outputs…
-
Okay, so now i tested a little bit… Strange things happen here.
Maybe you are right with these fail: flags… sometimes i get them sometimes not…Serial output Gateway:
0;0;3;0;9;read: 15-15-0 s=1,c=1,t=0,pt=7,l=5,sg=0:22.7 15;1;1;0;0;22.7 Node-Sensor (yourvariable) 15-1; Value 22.7 0;0;3;0;9;read: 15-15-0 s=2,c=1,t=1,pt=2,l=2,sg=0:1102381122 15;2;1;0;1;1090519106 Node-Sensor (yourvariable) 15-2; Value 1090519106 0;0;3;0;9;read: 15-15-0 s=3,c=1,t=0,pt=6,l=1,sg=0:00 15;3;1;0;0;00 Node-Sensor (yourvariable) 15-3; Value 00 0;0;3;0;9;read: 15-15-0 s=4,c=1,t=0,pt=6,l=1,sg=0:00 15;4;1;0;0;00 Node-Sensor (yourvariable) 15-4; Value 00
Serial output mysensor (sensebender micro) with 2 optional external sensors (not connected at the moment)
send: 15-15-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=ok:23.6 send: 15-15-0-0 s=2,c=1,t=1,pt=2,l=2,sg=0,st=fail:63 send: 15-15-0-0 s=3,c=1,t=0,pt=6,l=1,sg=0,st=ok:00 send: 15-15-0-0 s=4,c=1,t=0,pt=6,l=1,sg=0,st=fail:00 send: 15-15-0-0 s=255,c=3,t=0,pt=1,l=1,sg=0,st=ok:100 Locating devices...Found 0 devices. Parasite power is: OFF Unable to find address for Device 0 Unable to find address for Device 1 Device 0 Address: 0000000000000000 Device 1 Address: 0000000000000000 Device 0 Resolution: 0 Device 1 Resolution: 0 TempDiff :0.64 HumDiff :0.00 T: 23.64 H: 63 T1: Device Address: 0000000000000000 Temp C: -127.00 Temp F: -196.60 T2: Device Address: 0000000000000000 Temp C: -127.00 Temp F: -196.60 send: 15-15-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=ok:23.6 send: 15-15-0-0 s=2,c=1,t=1,pt=2,l=2,sg=0,st=ok:63 send: 15-15-0-0 s=3,c=1,t=0,pt=6,l=1,sg=0,st=fail:00 send: 15-15-0-0 s=4,c=1,t=0,pt=6,l=1,sg=0,st=ok:00 TempDiff :0.64 HumDiff :0.50 T: 23.22 H: 64 T1: Device Address: 0000000000000000 Temp C: -127.00 Temp F: -196.60 T2: Device Address: 0000000000000000 Temp C: -127.00 Temp F: -196.60 send: 15-15-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=ok:23.2 send: 15-15-0-0 s=2,c=1,t=1,pt=2,l=2,sg=0,st=ok:64 send: 15-15-0-0 s=3,c=1,t=0,pt=6,l=1,sg=0,st=ok:00 send: 15-15-0-0 s=4,c=1,t=0,pt=6,l=1,sg=0,st=ok:00
So i tried to upload a standard-sketch for ESP8266 wifi gateway from mysensors. Same behavior…
So maybe something in the “gateway-send-function” in sense bender sketch is bad…
Searching goes on…
-
Somebody in MySensors Forum told me that this could come from a Problem converting a Variable…
See here:"Yveaux MOD vor 9 Monaten
@Yveaux said:
Possibly a variable somewhere that has a different size on ESP
Pretty sure I found the cause: the messages exchanged between sensor and gateway contain int types.
These have a size of 2 bytes on Arduino and 4 bytes on ESP.
An int sent from the Arduino is sent as 2 bytes, but the ESP expects 4. The upper 2 will be filled with garbage.
Still a hypothesis which has to be verified & fixed.
To be continued!We should use the Development Build from MySensors … I will try it out…
See here in this Thread: https://forum.mysensors.org/topic/2118/esp8266-wifi-gateway-issue/24 -
Yveaux is the one who built the first esp8266 gateway for mysensors.
(And hist last name is not MOD . That stands for MODerator in the forum).Yveaux seems to be correct.
Your value1090519091
converted to binary gives1000001000000000000000000110011
. This is 4 bytes.
If I strip the 2 high bytes and keep the 2 low bytes I get00110111
. Guess what? In decimal that is55
.As mentioned: my ino is based on mysensors 1.5 as I don’t understand where to put my code in the new 2.0 version setup.
Besides: there are ways to convert 2-byte int to 4-byte int and vice-versa (or from 2byte int into to 4byte char etc.) by using byte shifts, or simply strip the bytes like shown above. I will also have a look at that next weekend when I’m back. -
Hey Harry,
great to hear. Because i did not get it working with the dev release of mysensors…
Maybe we can get support do convert sketch to mysensors 2.0… I will try to get som help in mysensors forum… i think there will be more persons interest in this? Or do you think the better way is to insert WiFi Gateway into mysensors plugin? Maybe @mwittig or mysensors-plugin developer DheerajKhajuria (don’t know if he is active here) can tell us more?
Looking forward to hear from you… -
@Harry-van-der-Wolf @HarrySteff maybe I can be a bit of a help to you both:
As I have written in the mysensors forum, I had the same problem that Harry explained here. But Yveaux has written an update for the mysensors lib which works fine with a new version of ESP8266 lib (I think it’s good for >=2.0).
In case you need help to update the ESP lib just ask, I will give you help when at my PC at home.
Second topic about how to switch to the new dev branch of MySensors with the new structure: Easiest is to just have a look at the examples. To make it easier to read and maintain they seperated the presentation part of the code from the setup and moved it to a own process (void presentation()
). And you do not need thegw.begin
anymore. Also thegw.
in front of any send (or other mysensors related stuff) is gone. In case you want to set a specific node id (which was done in the gw.begin) you can now#define MY_NODE_ID XXX
or use#define MY_REPEATER_FEATURE
to enable repeater.
Thevoid loop()
has not changed that much. Only enhancement is that you don’t have to callgw.process()
to handle incoming messages, that is done automatically now.
If you have troubles converting your 1.5 sektches to dev 2.0 just ask. -
@Anduril: Currently I’m using both 1.5 and 2.0 version libraries and ino’s. It is simple to add extra sensors in 2.0
The Esp8266MQTTclientGateway, for which I wrote the howto, is also in 2.0.What you mention here has nothing to do with the use of the REST-API functionality. What’s more: it is blocking the pimatic REST-API functionality.
You mention the exact point where my problem is: the setupGateway(…) and my modified gw.begin. The whole pimatic functionality is based on that now not existing anymore gw.begin. I need that, or something likewise, to be able to expand the standard gateway with the pimatic functionality.
The presentation() and loop() are not usable for my functionality.So: I have no problem at all using 1.5 and 2.0 sketches for sensors, and to mix them. It is this specific gateway with this specific pimatic functionality.
-
sorry, I misread your post about where to put your code in 2.0. Did you already had a look at the MySensorsCore.cpp in the core folder of the mysensors library? Beginning from line 35 they seem to define what happens in the process routin which is called somewhere else. Maybe you can insert your code there… but I don’t know.
-
Hello together,
thank you @Anduril that you care about this!
thank you @Harry-van-der-Wolf
if i can help somehow please tell me… i will try to help as good as i can… -
I checked last night but it is above my head. I asked assistance in the mysensors forum.
-
I got a very speedy response from Yveaux and I have now a working gateway for mysensors version 2.0. You can find it on my github in a new (default) branch.
It should also include the fix for the 2byte arduino integer to 4byte esp8266 integer.
-
Are you serious??? Great i cannot believe this… i will try this out… Will give feedback as soon as possible here… THANK YOU!!!
-
What should i say, it is working!!! Great so many thanks, i would have never get this working without your support! Thank you so much!!!
-
if i get some time i need to check this out.
nice work @Harry-van-der-Wolf !!pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !