NEWS
Chipkarten mit RFID Reader PN532 in ioBroker steuern
-
Hallo zusammen,
ich habe mir mal ein Blockly-Script zusammen gestellt,für die Steuerung meiner Geräte in der Werkstatt.
Wenn Script komplett fertig ist,sollen verschiedene Messgeräte (Netzteile , Multimeter , Lötstation , Absaugung usw.) mit einem RFID Schlüsselanhänger oder Karte eingeschaltet werden.Meine Hardware ist wie folgt :
Raspberry Pi 3 Model B+ mit ioBrocker und aktiven I2C-Bus für Ansteuerung vom MCP 23017 als Output (Relaissteuerung)
Alexa Echo Do
Sonoff 4ch mit Tasmota Firmware geflasht
Sonoff POW mit Tasmota Firmware geflasht
SONOFF Basic mit Tasmota Firmware geflasht
ESP 8266 (ESP-12E) mit der ESP-Easy Software
RFID Reader PN532 über I2C-Bus am ESP 8266 angeschlossen.
Spannung- und Stromsensor INA219 über I2C-Bus am ESP 8266 angeschlossen und
mehre Temperatursensoren vom Typ DS18b20 ebenfalls über I2C-Bus am ESP 8266 angeschlossen.Das Blockly-Script schaltet mit einem RFID Schlüsselanhänger mein Netzteil und den Ausgang B0 vom MCP 23017 ein und aus.
<xml xmlns="http://www.w3.org/1999/xhtml"> <block type="comment" id="Dp(3PV*Q;}9zI1G[bM,{" x="388" y="-662"> <field name="COMMENT">Echte Geräte</field> </block> <block type="comment" id="h7eCawXb@AbJc:j[h$Cm" x="37" y="-88"> <field name="COMMENT">Geräte mit RFID-Karten Ein- und Ausschalten</field> <next> <block type="on_ext" id="8C3e8Lq[~XBg%k~vhzTm"> <mutation items="1"></mutation> <field name="CONDITION">any</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="l@6wJHU1Y.wbFMQ,n@2L"> <field name="oid">mqtt.0.espsensor.rfid.Tag</field> </shadow> </value> <statement name="STATEMENT"> <block type="comment" id="[QkJ0Nu89KP]{P4aq(H6"> <field name="COMMENT">KEYSIGHT Tripel Output einschalten</field> <next> <block type="controls_if" id="$4Q0_Y_j6O;~claT*+x8"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_compare" id="LBW3?UfUT}Y[im4LQ|rj"> <field name="OP">EQ</field> <value name="A"> <block type="logic_compare" id="ntTkyMdYVr(_V880V=ke"> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id="m6mrov6z8`YZ.bk.gcT+"> <field name="ATTR">val</field> <field name="OID">mqtt.0.espsensor.rfid.Tag</field> </block> </value> <value name="B"> <block type="text" id="4k:HeaEPH[oaW0His!kc"> <field name="TEXT">1227141722</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="s^7.;x4{p-1mAw{V|#1Y"> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id="*mzzv-cMv1HS-=-Cu0UD"> <field name="ATTR">val</field> <field name="OID">sonoff.0.DVES_490D57.POWER3</field> </block> </value> <value name="B"> <block type="logic_boolean" id="6u2bH_Lr^LZatW|ln/4m"> <field name="BOOL">FALSE</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="(|dQU:#xj!;M+TX+5y|S"> <mutation delay_input="true"></mutation> <field name="OID">sonoff.0.DVES_490D57.POWER3</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">1000</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="Cpo{5^S^,XT=ieqM5,IJ"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="comment" id="BE-%lKcT#T.BXp63CYD}"> <field name="COMMENT">LED über I2C Adapter und MCP 23017 einschalten</field> <next> <block type="control" id="+Ub2a%bT%Co^v4r6!^:6"> <mutation delay_input="true"></mutation> <field name="OID">i2c.0.0x20.B0</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">1000</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="{,*P}M20:]Jh{b`e2dxd"> <field name="BOOL">TRUE</field> </block> </value> </block> </next> </block> </next> </block> </statement> <value name="IF1"> <block type="logic_compare" id="G0|,*1pvnn~:7/r{8v,="> <field name="OP">EQ</field> <value name="A"> <block type="logic_compare" id="E+)LS``B|esgwv-oXhVR"> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id="9,6SSh#I~DEfC_$9YadJ"> <field name="ATTR">val</field> <field name="OID">mqtt.0.espsensor.rfid.Tag</field> </block> </value> <value name="B"> <block type="text" id=":/A@hq$(qGE_q0JAgny."> <field name="TEXT">1227141722</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="2VbSr`4gNHl:#/.P35d8"> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id="?JLT,(Mi8dtfor?X1(1]"> <field name="ATTR">val</field> <field name="OID">sonoff.0.DVES_490D57.POWER3</field> </block> </value> <value name="B"> <block type="logic_boolean" id="R:N?h_-tSdIgY-[,tAkw"> <field name="BOOL">TRUE</field> </block> </value> </block> </value> </block> </value> <statement name="DO1"> <block type="comment" id="Zgl_l3JE1#cNDy+M_^8b"> <field name="COMMENT">KEYSIGHT Tripel Output ausschalten</field> <next> <block type="control" id="rF04!B@:I_ow}dpzy4[o"> <mutation delay_input="true"></mutation> <field name="OID">sonoff.0.DVES_490D57.POWER3</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">1000</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id=":loan,#~lNKHAZQsu+qD"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="comment" id="(V_|L+Bt7_7pP@-H69{T"> <field name="COMMENT">LED über I2C Adapter und MCP 23017 ausschalten</field> <next> <block type="control" id=";a-8SlQs3h8JB%z-r!y1"> <mutation delay_input="false"></mutation> <field name="OID">i2c.0.0x20.B0</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="JyWwL$Psas5y1/k=#bT]"> <field name="BOOL">FALSE</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </statement> </block> </next> </block> </xml>
Bei den Einstellungen habe ich in ioBrocker das schreiben auf den TFID-Tag abgestellt,da es oft zu mehrfachen Ein. und Ausschalten kam.
Mfg Bernd