RFID  [Solved]

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

Moderator: leecollings

Post Reply
Peterus
Posts: 15
Joined: Wednesday 09 October 2019 14:34
Target OS: Linux
Domoticz version: 2021.1
Location: Stockholm, Sweden
Contact:

RFID

Post 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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: RFID  [Solved]

Post 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
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Peterus
Posts: 15
Joined: Wednesday 09 October 2019 14:34
Target OS: Linux
Domoticz version: 2021.1
Location: Stockholm, Sweden
Contact:

Re: RFID

Post by Peterus »

Great! Thank you so very much!
I will have a look later tonight!
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest