Ack

Moderator: leecollings

espenf
Posts: 9
Joined: Tuesday 01 September 2015 21:21
Target OS: -
Domoticz version:
Contact:

Ack

Post 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..
NewFolk
Posts: 39
Joined: Wednesday 02 September 2015 11:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ack

Post 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.
erik
Posts: 4
Joined: Tuesday 07 April 2015 17:54
Target OS: Linux
Domoticz version: V2.3191
Location: Netherlands
Contact:

Re: Ack

Post by erik »

Is there some more information about this functionality in Domoticz? I'm trying to find a solution for this..
NewFolk
Posts: 39
Joined: Wednesday 02 September 2015 11:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ack

Post by NewFolk »

No any news? mb gizmocuz could help as?
User avatar
gizmocuz
Posts: 2521
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Ack

Post by gizmocuz »

Please have a look in the MySensorsBase.cpp file and debug ? That would be the fastest way
Quality outlives Quantity!
NewFolk
Posts: 39
Joined: Wednesday 02 September 2015 11:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ack

Post 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 ?
User avatar
gizmocuz
Posts: 2521
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Ack

Post by gizmocuz »

See above

Sent from my A0001 using Tapatalk
Quality outlives Quantity!
NewFolk
Posts: 39
Joined: Wednesday 02 September 2015 11:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ack

Post 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!
User avatar
gizmocuz
Posts: 2521
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Ack

Post 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 ?
Quality outlives Quantity!
NewFolk
Posts: 39
Joined: Wednesday 02 September 2015 11:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ack

Post 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.
User avatar
gizmocuz
Posts: 2521
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Ack

Post 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?
Quality outlives Quantity!
NewFolk
Posts: 39
Joined: Wednesday 02 September 2015 11:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ack

Post 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);
pj-r
Posts: 140
Joined: Wednesday 17 December 2014 17:30
Target OS: Linux
Domoticz version: V3.8650
Location: Jyväskylä, Finland
Contact:

Re: Ack

Post 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)
LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors
Yury
Posts: 4
Joined: Sunday 13 September 2015 16:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ack

Post 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.
User avatar
gizmocuz
Posts: 2521
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Ack

Post 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)
Quality outlives Quantity!
NewFolk
Posts: 39
Joined: Wednesday 02 September 2015 11:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ack

Post 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 :(
User avatar
gizmocuz
Posts: 2521
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Ack

Post 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 ;)
Quality outlives Quantity!
User avatar
gizmocuz
Posts: 2521
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Ack

Post 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)
Quality outlives Quantity!
NewFolk
Posts: 39
Joined: Wednesday 02 September 2015 11:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ack

Post 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.
pj-r
Posts: 140
Joined: Wednesday 17 December 2014 17:30
Target OS: Linux
Domoticz version: V3.8650
Location: Jyväskylä, Finland
Contact:

Re: Ack

Post 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.
LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests