Page 12 of 16

Re: MySensors - Gateway to Domoticz

Posted: Sunday 15 November 2015 18:19
by fets
Already checked, this is the detail (setup) of sensor 11 on domoticz gui :
sensor setup
sensor setup
capture-mysensors.png (125.22 KiB) Viewed 6807 times
1) Sensors 2 and 3 receive message type 36. This is the received message on my node : 11;2;1;1;36;1\n

2) :shock: Looking at the picture, I just realize that sensor 5 and 6 are last seen today a few minutes ago when I used my garage door (so the notification is received) but the state is not reported on domoticz display.

3) I don't know what sensor 111 and 255 are. Any idea ?


Re: MySensors - Gateway to Domoticz

Posted: Monday 16 November 2015 15:50
by alexsh1
If USB connection is broken in case of the serial gateway, I can see it in the logs: Error opening /dev/USB20, trying in 30 secs.
What about the ethernet gateway? I cannot see Domoticz checking its presence and if it is disconnected then one has to restart Domoticz to make it work.
Am I correct?

Re: MySensors - Gateway to Domoticz

Posted: Monday 16 November 2015 18:02
by gizmocuz
alexsh1 wrote:If USB connection is broken in case of the serial gateway, I can see it in the logs: Error opening /dev/USB20, trying in 30 secs.
What about the ethernet gateway? I cannot see Domoticz checking its presence and if it is disconnected then one has to restart Domoticz to make it work.
Am I correct?
If the TCP connection gets disconnected it is displaying this in

MySensorsTCP::OnDisconnect()

if it is connected, a message is logged here:

void MySensorsTCP::OnConnect()

the only thing that is missing is a log message

Connecting to .....

Will implement this in the next beta version

Re: MySensors - Gateway to Domoticz

Posted: Monday 16 November 2015 18:13
by alexsh1
gizmocuz wrote:
the only thing that is missing is a log message

Connecting to .....

Will implement this in the next beta version
You are the star! I have been running MYSController in the absence of any TCP logging in Domoticz, but now ... :D

Re: MySensors - Gateway to Domoticz

Posted: Monday 16 November 2015 19:06
by gizmocuz
alexsh1 wrote:
gizmocuz wrote:
the only thing that is missing is a log message

Connecting to .....

Will implement this in the next beta version
You are the star! I have been running MYSController in the absence of any TCP logging in Domoticz, but now ... :D
New beta available #3603

have not tested it, i will have to build a ethernet gateway soon (no arduino's left)

Hope it works

Re: MySensors - Gateway to Domoticz

Posted: Monday 16 November 2015 20:34
by alexsh1
gizmocuz wrote:
alexsh1 wrote:
gizmocuz wrote:
the only thing that is missing is a log message

Connecting to .....

Will implement this in the next beta version
You are the star! I have been running MYSController in the absence of any TCP logging in Domoticz, but now ... :D
New beta available #3603

have not tested it, i will have to build a ethernet gateway soon (no arduino's left)

Hope it works

Upgrading and testing now.
Another unrelated question - do you know which value I should change in the DB (domoticz.db) in order to change the total consumption value (MySensors - node 10 - child 1)
I have changed the value below, but it did not work.

Re: MySensors - Gateway to Domoticz

Posted: Monday 16 November 2015 20:45
by alexsh1
gizmocuz wrote:
alexsh1 wrote:
gizmocuz wrote:
New beta available #3603

have not tested it, i will have to build a ethernet gateway soon (no arduino's left)

Hope it works
No, it does not work.

From the log file:

2015-11-16 19:36:01.618 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:36:02.870 (MySensors) General/kWh (Meter)
2015-11-16 19:36:02.891 (MySensors) General/kWh (Meter)
2015-11-16 19:36:12.913 (MySensors) Air Quality (Air Quality)
2015-11-16 19:36:22.936 (MySensors) General/kWh (Meter)
2015-11-16 19:36:22.967 (MySensors) General/kWh (Meter)
2015-11-16 19:36:31.730 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:36:35.998 (MySensors) Temp + Humidity (TempHum)
2015-11-16 19:36:36.020 (MySensors) Temp + Humidity (TempHum)
2015-11-16 19:36:43.043 (MySensors) General/kWh (Meter)
2015-11-16 19:36:43.064 (MySensors) General/kWh (Meter)
2015-11-16 19:36:47.086 (MySensors) Air Quality (Air Quality)
2015-11-16 19:37:01.840 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:37:03.118 (MySensors) General/kWh (Meter)
2015-11-16 19:37:03.140 (MySensors) General/kWh (Meter)
2015-11-16 19:37:21.163 (MySensors) Air Quality (Air Quality)
2015-11-16 19:37:23.194 (MySensors) General/kWh (Meter)
2015-11-16 19:37:23.226 (MySensors) General/kWh (Meter)
2015-11-16 19:37:23.949 (Z-Wave) General/Thermostat Mode (Kitchen Floor Thermostat)
2015-11-16 19:37:31.948 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:37:35.510 (Z-Wave) General/Thermostat Mode (Bathroom Floor Thermostat)
2015-11-16 19:37:43.259 (MySensors) General/kWh (Meter)
2015-11-16 19:37:43.290 (MySensors) General/kWh (Meter)
2015-11-16 19:37:43.320 (MySensors) Temp + Humidity (TempHum)
2015-11-16 19:37:43.351 (MySensors) Temp + Humidity (TempHum)
2015-11-16 19:37:55.384 (MySensors) Air Quality (Air Quality)
2015-11-16 19:38:02.054 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:38:03.406 (MySensors) General/kWh (Meter)
2015-11-16 19:38:03.427 (MySensors) General/kWh (Meter)
2015-11-16 19:38:22.450 (MySensors) General/kWh (Meter)
2015-11-16 19:38:22.481 (MySensors) General/kWh (Meter)

Ethernet gateway is now switched off.

2015-11-16 19:38:28.367 (Netatmo Weather Station) Temp + Humidity (Outdoor)
2015-11-16 19:38:28.390 (Netatmo Weather Station) Rain (Rain gauge)
2015-11-16 19:38:28.419 (Netatmo Weather Station) Temp + Humidity (Bedroom)
2015-11-16 19:38:28.440 (Netatmo Weather Station) Air Quality (Bedroom)
2015-11-16 19:38:28.461 (Netatmo Weather Station) Temp + Humidity + Baro (Living room)
2015-11-16 19:38:28.483 (Netatmo Weather Station) Air Quality (Living room)
2015-11-16 19:38:28.504 (Netatmo Weather Station) General/Sound Level (Living room)
2015-11-16 19:38:28.526 (Netatmo Weather Station) Temp + Humidity (Outdoor)
2015-11-16 19:38:28.528 (Netatmo Weather Station) Temp + Humidity + Baro (Indoor)
2015-11-16 19:38:28.529 (Netatmo Weather Station) Air Quality (Indoor)
2015-11-16 19:38:28.531 (Netatmo Weather Station) General/Sound Level (Indoor)
2015-11-16 19:38:28.532 (Netatmo Weather Station) Temp + Humidity (Outdoor module)
2015-11-16 19:38:28.534 (Netatmo Weather Station) Temp + Humidity + Baro (Indoor)
2015-11-16 19:38:28.535 (Netatmo Weather Station) Air Quality (Indoor)
2015-11-16 19:38:28.536 (Netatmo Weather Station) General/Sound Level (Indoor)
2015-11-16 19:38:28.879 (Z-Wave) Temp (Kitchen Floor Temperature)
2015-11-16 19:38:32.143 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:38:40.402 (Z-Wave) Temp (Bathroom Floor Temp)
2015-11-16 19:39:02.232 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:39:32.319 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:40:02.430 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:40:32.517 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:41:02.629 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:41:32.738 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:41:43.650 (Z-Wave) General/Thermostat Mode (Kitchen Floor Thermostat)
2015-11-16 19:41:55.066 (Z-Wave) General/Thermostat Mode (Bathroom Floor Thermostat)
2015-11-16 19:42:02.844 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:42:32.948 Hardware Monitor: Fetching data (System sensors)
2015-11-16 19:42:48.576 (Z-Wave) Temp (Kitchen Floor Temperature)
2015-11-16 19:42:59.955 (Z-Wave) Temp (Bathroom Floor Temp)
2015-11-16 19:43:03.068 Hardware Monitor: Fetching data (System sensors)

Nothing in the log about the ethernet gateway

EDIT: I have to restart domoticz every time I power down/power up the gateway. Otherwise it is not seen by domoticz unlike the serial gateway.

Re: MySensors - Gateway to Domoticz

Posted: Tuesday 17 November 2015 7:25
by gizmocuz
Okey, i have to build myself an Ethernet controller to test this

Re: MySensors - Gateway to Domoticz

Posted: Tuesday 17 November 2015 10:24
by alexsh1
gizmocuz wrote:Okey, i have to build myself an Ethernet controller to test this
As I have one, can I be of any assistance to you at all? :mrgreen:

Re: MySensors - Gateway to Domoticz

Posted: Tuesday 17 November 2015 10:36
by darknico31
I can confirm I have the same behavior.
I have to restart domoticz when I restart my Ethernet gateway.
Also available to assist :)

Edit: A workaround would be to set a data timeout on the ethernet gateway.
But, it's not the good way to do that.

Re: MySensors - Gateway to Domoticz

Posted: Tuesday 17 November 2015 19:00
by gizmocuz
Okey, build a ethernet gateway

there is no way of knowing that you unplugged your ethernet gateway, it is not a gracefully shutdown of the tcp socket

there is only one option, and that is set the data timeout in the hardware setup.

For instance you know you should receive data at least every 5 minutes (or minute), then you set the data timeout to 5 minutes.
If nothing is received for 5 minutes, then it mysensors ethernet hardware is restarted

i checked if i received 0 bytes, or an error, but nothing is received... it is just waiting for new data

of course you won't unplug the ethernet gateway often, but i would set the above data timeout to be sure.

another issue, it seems the ethernet gateway does not send the gateway version info on connect... (serial does)
Fixed, and will be available in the next beta version

Re: MySensors - Gateway to Domoticz

Posted: Tuesday 17 November 2015 19:22
by darknico31
It's nice that you fixed the version "problem".
Data timeout will work, but it's not very "clean".
If we don't have sensors and only actuator, it will not work.

Maybe we can work on some keepalive ?
A quick google search confirm that W5100 support sending keepalive.

I'll try to mod the gateway sketch to send keepalive and see what's happen.
I'll let you know.

Re: MySensors - Gateway to Domoticz

Posted: Tuesday 17 November 2015 19:32
by gizmocuz
darknico31 wrote:It's nice that you fixed the version "problem".
Data timeout will work, but it's not very "clean".
If we don't have sensors and only actuator, it will not work.

Maybe we can work on some keepalive ?
A quick google search confirm that W5100 support sending keepalive.

I'll try to mod the gateway sketch to send keepalive and see what's happen.
I'll let you know.
Great, in the mean time i asked Henrik if a PING/PONG solution might work
If we don't have sensors and only actuator, it will not work.
true

Re: MySensors - Gateway to Domoticz

Posted: Tuesday 17 November 2015 23:20
by darknico31
If by ping/pong you mean icmp ping.
I don't think it could work.
Because if you ping lets say, every minute, the gateway boot time is so fast that you will never miss a ping.
And after restart, the telnet connection will be dead but the ping ok.

I dug a little more about W5100 keepalive. it seems to exist but I couldn't find anyone who make it work.

So here is another idea, why not use mysensors protocol to make or own "keep-alive".
If we try to send anything over the broken connection we should be able to catch the error and restart the worker.
We can for example request the gateway version every x min.

Re: MySensors - Gateway to Domoticz

Posted: Wednesday 18 November 2015 19:01
by gizmocuz
I meant via the mysensors method

I made a new beta version that now handles this case (#3608)

It may take up to 30 seconds.... but we now use the I_HEARTBEAT message,
it needs to be checked as i do not receive anything back, but sending this, will cause the TCP class to know there are problems

Re: MySensors - Gateway to Domoticz

Posted: Wednesday 18 November 2015 22:19
by darknico31
Nice, I didn't know about the I_HEARTBEAT message.
Is this a mysensors 1.6 thing ?
Because it's not referenced here :
http://www.mysensors.org/download/serial_api_15
In your code you use internal code 18, and the documentation stop at 17.

Re: MySensors - Gateway to Domoticz

Posted: Thursday 19 November 2015 7:42
by gizmocuz
Yes, its part of 1.6, and not documented
also 1.5 gateways will ignore it, so it works for this as well

but is it working?

Re: MySensors - Gateway to Domoticz

Posted: Thursday 19 November 2015 9:28
by darknico31
I've just compiled a fresh 3608.
I'm not a home, so I have no way to shutdown the ethernet gateway to test.
I'll will test as soon as a get home.
I'll keep you informed.

Speeking of 1.6, the other day, in have found a page that explained how to modify 1.5 sketch to be 1.6.
I don't find it anymore. Do you have a link to something like that ?

Re: MySensors - Gateway to Domoticz

Posted: Friday 20 November 2015 10:27
by darknico31
I've done some tests yesterday.
It acted weird at first but it seems ok now.

First restart after compiling, I've not looked on the logs, but it was connected.
When I came home, I reset the gateway and waited for the keepalive to do is job, but nothing happened (I've waited at least 5min).
So I decided to restart domoticz, but the only log entry about mysensors was "trying to connect to ..." but It never seems to try.
I've restarted domoticz again, and this time it was connected, gateway version appeared , sensor OK.
After that every gateway reset triggered the keepalive functionality.
Even with more domoticz restart (I really tried to stress it).
The only downside I see is that the keepalive functionality only work in case of gateway reset.
If the gateway is really down, nothing happen.
Probably because when the gateway is reset, it's send back a connection refused/reset when domoticz try to use the old connection.
When the gateway is down nothing is send back, so domoticz do nothing.
The problem is if you do something when there is no response to the heartbeat request, it will not work with the version 1.5 that ignore the heartbeat.
Maybe we could us the gateway version request to determine how to act with the heartbeat non response.
BTW, All my tests were done with an 1.5 gateway.
I'll try to make an 1.6 version this weekend.

Re: MySensors - Gateway to Domoticz

Posted: Saturday 21 November 2015 14:54
by gizmocuz
there has been an update to the 1.6 development branch
try using the new code to make your ethernet gateway
working good here

you get log messages from two different classes, the MySensorsTCP and the AsyncTCP class
the asynctcp will try to reconnect every 30 seconds