Page 1 of 1

RFID

Posted: Friday 15 November 2019 9:02
by Peterus
Hi all

Sorry for a newbie question.
I have most of my scripts in Blockly but sometimes they stop working (I have no idea about why!) and I have to re-write the exact same code again and save to make it work again.

Now I am trying to replace the Blockly code with Dzvents but since I don't know much about programming I am kind of stuck.
I have managed to write some scripts with timer functions that trigger devices at certain times.
Now i am trying to get my RFID reader to trigger a virtual device but I can't understand how to write it.
It is a Zipato Mini RFiD Keypad.

The Blockly code run something like this:

If RFID=On then turn virtual device On

Another script would be:
If RFID=Off then turn virtual device Off

Any takers?

Best regards
Peter

Re: RFID  [Solved]

Posted: Friday 15 November 2019 9:20
by waaren
Peterus wrote: Friday 15 November 2019 9:02 Now i am trying to get my RFID reader to trigger a virtual device but I can't understand how to write it.
This should do it. Please also take some time to have a look at the dzVents wiki

Code: Select all

return 
{
	on = { devices = { 'Exact name of RFID device' }}, -- change 
		
	execute = function(dz, item)
	    dz.log('State of Device ' .. item.name .. ' is now ' .. item.state, dz.LOG_INFO)
		local follower = dz.devices('Exact name of your virtual device') -- change
		
		if item.state == 'On' then
	        follower.switchOn()
	    else
	        follower.switchOff()
        end
        
	end
}

Re: RFID

Posted: Friday 15 November 2019 9:28
by Peterus
Great! Thank you so very much!
I will have a look later tonight!