[SOLVED] DzVents door.state is always open?

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Milifax
Posts: 69
Joined: Friday 23 June 2017 9:27
Target OS: Linux
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by Milifax »

dannybloe wrote: And, the question is: should events be triggered when you switch Master and Slave(s) are synced? I'd say yes. When a device changes, ALWAYS trigger scripts.
So, what you're bascily saying is that scripts are not triggered when this syncing is activated? And thus the state is not update?
On top of that, the nValue isn't something you should be using in dzVents I guess as I hope all devices have more sane/readable attributes.
Ok, noted. But, out of curiosity, why is there a nValue available in Dzvents as mentioned on the wiki and why isn't it displaying the correct information, or equal information as in the db?
Wiki --> nValue: Number. Numerical representation of the state.
Milifax
Posts: 69
Joined: Friday 23 June 2017 9:27
Target OS: Linux
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by Milifax »

jvandenbroek wrote:Yes, danny described it thorough. Conclusion for now: Only switch master through slaves only, not directly or via scripting. The trick in this case would probably just adding a second slave and use that for the timer.
Could you explain that a bit more?
Bot, master and slave, are devices which are triggered from a message to RFLink. How can I add an extra slave. If I want to do that Domoticz says it is already in use.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: DzVents door.state is always open?

Post by dannybloe »

Milifax wrote: Ok, noted. But, out of curiosity, why is there a nValue available in Dzvents as mentioned on the wiki and why isn't it displaying the correct information, or equal information as in the db?
Wiki --> nValue: Number. Numerical representation of the state.
Goog question. Guess it is a left-over from earlier dzVents versions. This nValue is just handed to dzVents from Domoticz. To be honest I have no idea how exactly it is constructed.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
jvandenbroek
Posts: 37
Joined: Wednesday 12 March 2014 16:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by jvandenbroek »

Milifax wrote:
jvandenbroek wrote:Yes, danny described it thorough. Conclusion for now: Only switch master through slaves only, not directly or via scripting. The trick in this case would probably just adding a second slave and use that for the timer.
Could you explain that a bit more?
Bot, master and slave, are devices which are triggered from a message to RFLink. How can I add an extra slave. If I want to do that Domoticz says it is already in use.
Isn't it possible to add a dummy slave next to the rflink slaves and use this one to switch on/off through scripting (dzVents)? Not tested, just an idea..
Milifax
Posts: 69
Joined: Friday 23 June 2017 9:27
Target OS: Linux
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by Milifax »

jvandenbroek wrote:
Milifax wrote:
jvandenbroek wrote:Yes, danny described it thorough. Conclusion for now: Only switch master through slaves only, not directly or via scripting. The trick in this case would probably just adding a second slave and use that for the timer.
Could you explain that a bit more?
Bot, master and slave, are devices which are triggered from a message to RFLink. How can I add an extra slave. If I want to do that Domoticz says it is already in use.
Isn't it possible to add a dummy slave next to the rflink slaves and use this one to switch on/off through scripting (dzVents)? Not tested, just an idea..
What should I use to switch on then? As scripts are not triggered, only when the door opens. And not when it closes.
jvandenbroek
Posts: 37
Joined: Wednesday 12 March 2014 16:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by jvandenbroek »

Ah I understand what you mean. You should create a dummy device as master and add both RFLink devices as slaves to it. Now you should get the correct status on the dummy device..

Edit: Well I think I understand it, is it correct that you have 2 RFLink devices, one only triggers when door is open and the other when door is closed? And do they sent the correct On and Off status, or both the same (always On or Off)? If the latter is the case, you should use a script and not master/slave devices.
Milifax
Posts: 69
Joined: Friday 23 June 2017 9:27
Target OS: Linux
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by Milifax »

jvandenbroek wrote:Ah I understand what you mean. You should create a dummy device as master and add both RFLink devices as slaves to it. Now you should get the correct status on the dummy device..

Edit: Well I think I understand it, is it correct that you have 2 RFLink devices, one only triggers when door is open and the other when door is closed? And do they sent the correct On and Off status, or both the same (always On or Off)? If the latter is the case, you should use a script and not master/slave devices.
Nope no luck unfortunately,

the master swithes on once and stays on.
The dummy devices are always open if I log the states.
Milifax
Posts: 69
Joined: Friday 23 June 2017 9:27
Target OS: Linux
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by Milifax »

Maybe not the cleanest solution, but the nvalue is the one probably I can use now as it switches on the door.

Is there a way, through python or such, to read the value of nvalue out of the db directly?
jvandenbroek
Posts: 37
Joined: Wednesday 12 March 2014 16:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by jvandenbroek »

Milifax wrote:
jvandenbroek wrote:Ah I understand what you mean. You should create a dummy device as master and add both RFLink devices as slaves to it. Now you should get the correct status on the dummy device..

Edit: Well I think I understand it, is it correct that you have 2 RFLink devices, one only triggers when door is open and the other when door is closed? And do they sent the correct On and Off status, or both the same (always On or Off)? If the latter is the case, you should use a script and not master/slave devices.
Nope no luck unfortunately,

the master swithes on once and stays on.
The dummy devices are always open if I log the states.
I guess your hardware send On or Off for both states, but as different devices.. Then you could do something like this:

Create 1 dummy device named 'Achterdeur'
Name your RFLink device as 'Achterdeur_Open' and 'Achterdeur_Dicht'

Code: Select all

return {
	active = true,
	on = {
		devices = {
			'Achterdeur_Open',
			'Achterdeur_Dicht'
		}
	},

	execute = function(domoticz, device)
		if (device.name == 'Achterdeur_Open') then
			domoticz.devices('Achterdeur').switchOn()
		else
			domoticz.devices('Achterdeur').switchOff()
		end
	end
}
Now you could use your scripting on dummy 'Achterdeur' for the correct status...?
And don't make any devices slaves, just keep them as stand-alone.

Don't depend on the nvalue, this is somewhat an 'illegal' way of obtaining the correct status.. Sure it may work for now, but might not in the future.
Milifax
Posts: 69
Joined: Friday 23 June 2017 9:27
Target OS: Linux
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by Milifax »

jvandenbroek wrote: I guess your hardware send On or Off for both states, but as different devices.
No, it only sends On apparently for an Open and an On for Close, two different devices.
Then you could do something like this:.....
Nope, doesn't work as the script doesn't get triggered.
Don't depend on the nvalue, this is somewhat an 'illegal' way of obtaining the correct status.. Sure it may work for now, but might not in the future.
But I see it as the only solution. I can't get my head around the fact the GUI states the correct state and everything else doesn't.
Maybe the question should be, where does the GUI gets it state from?
jvandenbroek
Posts: 37
Joined: Wednesday 12 March 2014 16:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by jvandenbroek »

Yes the GUI gets it's info from DB directly, so no strange behaviour here and all as expected ;) Well then I'm out of options then, because the script above should definitely work if you've got 2 separate RFlink devices sending the On status (or Off, doesn't matter). But to be clear: We're not talking about one RFLink device sending always On, but 2 separate ones? Otherwise it would be much simpler, you could just toggle the state...
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: DzVents door.state is always open?

Post by dannybloe »

Just spoke to gizmocus and the master/slave thing is intended for Kaku (like) devices in combination with linked/paired remote controls where the light isn't able to tell Domoticz that it is switched on.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Milifax
Posts: 69
Joined: Friday 23 June 2017 9:27
Target OS: Linux
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by Milifax »

jvandenbroek wrote:Yes the GUI gets it's info from DB directly, so no strange behaviour here and all as expected ;)-
So why not get the right data that way? If only I knew how :)
Well then I'm out of options then, because the script above should definitely work if you've got 2 separate RFlink devices sending the On status (or Off, doesn't matter). But to be clear: We're not talking about one RFLink device sending always On, but 2 separate ones? Otherwise it would be much simpler, you could just toggle the state...
I'm out of options as well, hench my question to do it on a dirty way and get the nValue out of the db.

The script above definitely doesn't work ;) I tested it right here, just now and multiple times before :), and no luck.

The device is 1 device. But it sends as two devices, how can I explain. The device sends an On state for opening and an On state for closing:
2017-08-04 15:14:08.399 RFLink: 20;DD;EV1527;ID=03b2c0;SWITCH=0e;CMD=ON;
2017-08-04 15:14:08.401 (RFLink) Light/Switch (Achterdeur_Dicht)
2017-08-04 15:14:10.658 RFLink: 20;DE;EV1527;ID=03b2c0;SWITCH=0a;CMD=ON;
2017-08-04 15:14:10.659 (RFLink) Light/Switch (Achterdeur_Open)
Milifax
Posts: 69
Joined: Friday 23 June 2017 9:27
Target OS: Linux
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by Milifax »

My main question still remains:

Why is the state in the GUI different from the state which I call in the scripts.
I cannot get my head around that one.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: DzVents door.state is always open?

Post by dannybloe »

But the script is executed right? When the door opens or closes? Do you get dzVents logging in the logs?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
jvandenbroek
Posts: 37
Joined: Wednesday 12 March 2014 16:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by jvandenbroek »

Milifax wrote:
jvandenbroek wrote:Yes the GUI gets it's info from DB directly, so no strange behaviour here and all as expected ;)-
So why not get the right data that way? If only I knew how :)
Because it now accidentally works for you and gives the correct value, but it's not intended to use the way you do, resulting in unexpected behaviour. Switching master will always put the slave device to Off, despite being set to On or Off... And the script should just work, period :lol: Just make sure you've got 3 devices (1 dummy, 2 RFLink) and maybe to be sure, first add the 'Achterdeur' as On/Off switch, not a Door type. Also check for On and Off status instead of Open / Close while testing this...
Milifax
Posts: 69
Joined: Friday 23 June 2017 9:27
Target OS: Linux
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by Milifax »

jvandenbroek wrote: And the script should just work, period :lol: Just make sure you've got 3 devices (1 dummy, 2 RFLink) and maybe to be sure, first add the 'Achterdeur' as On/Off switch, not a Door type. Also check for On and Off status instead of Open / Close while testing this...
Believe me, tried it, tried it, tried it....
The script doesn't work, period :lol: and I think the reason is because the device only sends an On. Never an Off.
jvandenbroek
Posts: 37
Joined: Wednesday 12 March 2014 16:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by jvandenbroek »

Milifax wrote:
jvandenbroek wrote: And the script should just work, period :lol: Just make sure you've got 3 devices (1 dummy, 2 RFLink) and maybe to be sure, first add the 'Achterdeur' as On/Off switch, not a Door type. Also check for On and Off status instead of Open / Close while testing this...
Believe me, tried it, tried it, tried it....
The script doesn't work, period :lol: and I think the reason is because the device only sends an On. Never an Off.
Doesn't matter, it just checks for a device change, not whether it's On or Off... Well then it could potentially be a bug in dzvents... :roll: And this in Lua?:

Code: Select all

commandArray = {}
if (devicechanged['Achterdeur_Open']) then
	commandArray['Achterdeur'] = 'On'
elseif (devicechanged['Achterdeur_Dicht']) then
	commandArray['Achterdeur'] = 'Off'
end
return commandArray
Edit: oops, don't forget the return commandArray!
Milifax
Posts: 69
Joined: Friday 23 June 2017 9:27
Target OS: Linux
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by Milifax »

jvandenbroek wrote: Doesn't matter, it just checks for a device change, not whether it's On or Off... Well then it could potentially be a bug in dzvents... :roll: And this in Lua?:
Tried it, tried it just now again, no luck.

If I detach the slave/master, nothing switches. Both are On, as the device sends only On.
jvandenbroek
Posts: 37
Joined: Wednesday 12 March 2014 16:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: DzVents door.state is always open?

Post by jvandenbroek »

But you see the logic in the script? When 'something' from Achterdeur_Open arrives (could just be On every time), it will set Achterdeur to On. If 'something' from Achterdeur_Dicht arrives (could also just be On every time), it will set it to Off. Achterdeur must change it's status, really weird if it doesn't. Are you using the latest beta btw? Because a few days ago there was a little issue, should be fine on latest version.

Also name the lua script something like script_device_justsomethingtotallyrandom.lua and not with the device name in the file name!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests