Page 1 of 3

Ack

Posted: Tuesday 01 September 2015 21:37
by espenf
Hi!
I'm new at this and trying to learn a thing or two in the process :)
I'm trying to build a few sensors, switches and some servo-controlled blinds. I have a couple of questions that I couldn't find any understandable answers to for a newbie:

Is there possible to demand an ack from the node before the "soft-switch" in domoticz changes state, like the Zwave-protocol does?
Would be great to build more dependable switches for my heater and my blinds.

And also, is it possible the other way (from sensors to gateway)? I've built a humidity-sensor (with a sensebender-board) that only updates my controller on its state once in a while..

Re: Ack

Posted: Wednesday 02 September 2015 11:59
by NewFolk
espenf wrote: Is there possible to demand an ack from the node before the "soft-switch" in domoticz changes state, like the Zwave-protocol does?
This will be great. On sensor node i could resend if ack is fail, but on controller side I could not event to know if it is fail.

Re: Ack

Posted: Sunday 27 September 2015 11:08
by erik
Is there some more information about this functionality in Domoticz? I'm trying to find a solution for this..

Re: Ack

Posted: Sunday 11 October 2015 15:27
by NewFolk
No any news? mb gizmocuz could help as?

Re: Ack

Posted: Sunday 11 October 2015 18:36
by gizmocuz
Please have a look in the MySensorsBase.cpp file and debug ? That would be the fastest way

Re: Ack

Posted: Monday 12 October 2015 13:50
by NewFolk
I mean that Vera has possibility to react on "Ack"
hek on mysensors.org "Vera automatically asks for ack when sending out command. If vera doesn't receive an ack, the state of the ON/OFF button won't change."
http://forum.mysensors.org/topic/1876/a ... or-example

Will Domoticz have the same feature ?

Re: Ack

Posted: Tuesday 13 October 2015 20:01
by gizmocuz
See above

Sent from my A0001 using Tapatalk

Re: Ack

Posted: Saturday 17 October 2015 15:31
by NewFolk
Hello,
Than you for your answer
if i don`t mistake Domoticz does not request Ack from node.

Code: Select all

void MySensorsBase::SendCommand(const int NodeID, const int ChildID, const _eMessageType messageType, const int SubType, const std::string &Payload)
{
	std::stringstream sstr;
	sstr << NodeID << ";" << ChildID << ";" << int(messageType) << ";0;" << SubType << ";" << Payload << '\n';
	WriteInt(sstr.str());
Could you implement it ?

Thank you!

Re: Ack

Posted: Sunday 18 October 2015 18:10
by gizmocuz
NewFolk wrote:Hello,
Than you for your answer
if i don`t mistake Domoticz does not request Ack from node.

Code: Select all

void MySensorsBase::SendCommand(const int NodeID, const int ChildID, const _eMessageType messageType, const int SubType, const std::string &Payload)
{
	std::stringstream sstr;
	sstr << NodeID << ";" << ChildID << ";" << int(messageType) << ";0;" << SubType << ";" << Payload << '\n';
	WriteInt(sstr.str());
Could you implement it ?

Thank you!
Did you test this ? Will it work ?

Do all sensors reply with an ACK if we send this ?
What happens when a sensor does not ACK ? Can we see this somewhere ?

Re: Ack

Posted: Sunday 18 October 2015 19:08
by NewFolk
Hello.

Mysensors example "RelayWithButtonActuator" use Ack
http://www.mysensors.org/build/relay#re ... or-example
https://codebender.cc/sketch:47534#Rela ... tuator.ino

On serial API
http://www.mysensors.org/download/serial_api_15
The ack parameter has the following meaning:
Outgoing: 0 = unacknowledged message, 1 = request ack from destination node
Incoming: 0 = normal message, 1 = this is an ack message
If I don`t mistake all sensors could/would send ack back.
If node does not Ack (signal fail) we will not get any information.

But the lack of information, Is information.

Yes, the chance that signal will reach node and than come back to GW is smaller. But if it come we could be sure that everything is ok.

It seems to me domoticz should send msg to node, and update DB from ack/incoming msg.

Re: Ack

Posted: Monday 19 October 2015 8:09
by gizmocuz
i dont see where/how a node sends to the gateway an 'ack' when the message is received... do you know how this works?

Re: Ack

Posted: Monday 19 October 2015 10:05
by NewFolk
Hello,
It seems to me, that in MyTransport.cpp https://github.com/mysensors/Arduino/bl ... nsport.cpp
I`m not the deleveper of mysensors, so i could be wrong. It will be great if you contact hek

Code: Select all

// Check if sender requests an ack back.
		if (mGetRequestAck(_msg)) {
			// Copy message
			_msgTmp = _msg;
			mSetRequestAck(_msgTmp,false); // Reply without ack flag (otherwise we would end up in an eternal loop)
			mSetAck(_msgTmp,true);
			_msgTmp.sender = _nc.nodeId;
			_msgTmp.destination = sender;
			_sendRoute(_msgTmp);

Re: Ack

Posted: Thursday 22 October 2015 3:21
by pj-r
Just quessing..
I see there two different use cases for ack.
1. when sensor sends value to domoticz it could reguest ack and for example retry untill it gets its message delivered. (imo this should be quite simple to implement)
2. when actuator is driven from domoticz it should request for ack and if no response -> action failed -> dont chance actuator state in domoticz (this might need configuration/actuator and would be bit harder to implement)

Re: Ack

Posted: Thursday 22 October 2015 21:18
by Yury
pj-r wrote:Just quessing..
2. when actuator is driven from domoticz it should request for ack and if no response -> action failed -> dont chance actuator state in domoticz (this might need configuration/actuator and would be bit harder to implement)
I guess this is most critical. Especially with NRF24 radios. If Gizmocuz could spare his time on ACK implementations for actuators driven from domoticz the system will look super robust. Aliexpress' NRF24 modules are pretty sketchy with radio stability and range so ACK will improve greatly all things.

Re: Ack

Posted: Saturday 24 October 2015 14:16
by gizmocuz
How would the software (domoticz, so not the gateway) send an ack ?
(a link above (mytransport) is for the gateway and is not for domoticz)

Re: Ack

Posted: Saturday 24 October 2015 17:45
by NewFolk
Hello, mb I misunderstood the question, but in my opinion domoticz should not send the ack.
Ack it`s build in function in mysensors. It`s like ping (does the signal reached the target?)

At the moment when I press button Domoticz send signal - update DB - update UI.
I see implementation of ACK something like
I press button Domoticz send signal with ask for ACK. That all.
sstr << NodeID << ";" << ChildID << ";" << int(messageType) << ";0;" << SubType << ";" << Payload << '\n';
After this node will send the same signal back to GW.
Domoticz listen the GW and update DB and UI from it.

If signal does not come no DB and UI update.
It`s the most simple way.

Another way. After domoticz send signal, wait some time ~1s and there will not me ACK signal back write somewhere in UI FAIL.
I don`t know how to realize this :(

Re: Ack

Posted: Saturday 24 October 2015 19:45
by gizmocuz
i already log if a present/switch is send with 'ack', maybe you could make a patch and provide a git pull request?
i personally don't like the idea of waiting... but... if a node as 'ack' then ... it maybe should wait ;)

Re: Ack

Posted: Saturday 24 October 2015 19:47
by gizmocuz
i still think this should belong in the gateway code, and not in domoticz!
If the gateway knows a node is using 'ack' then it should send/retry until xx times
if not received an ack, then notify somehow the controller (domoticz) it did not send it correctly (like openzwave does, ... node=dead)

Re: Ack

Posted: Saturday 24 October 2015 20:46
by NewFolk
gizmocuz wrote: maybe you could make a patch and provide a git pull request?
I`m afraid, I`m not good in programming.
I still think this should belong in the gateway code, and not in domoticz!
Mb you are right. But if i don`t mistake MySensors project was created for Vera. And It has this logic on controller (Vera) side.

So you know something about v 1.6 ? Will it be any changes in ACK functionality?
Could you contact hek or somebody from Mysensors.org project to discuss ACK functionality?

I just know that domoticz+mysensors lacks this functionality in the project.

Re: Ack

Posted: Saturday 24 October 2015 21:22
by pj-r
I can think one case when It could be better if the controller handles the ack. Case where contoller has jammed some how and and cannot receive messages from gw.

Could it be handled with "pending ack list" where are the nnodes/messages pending ack?
Send actuator update and add sent message to ack list. When received the ack find the message from list, remove and update status to ui/db. This way there is no waiting in main thread.
just my 2cents :)

ps. the z-wave way sounds good also.