<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
    <version>5.2</version>
    <date>2026-10-07T00:00:00Z</date>
    <groups>
        <group>
            <name>Templates/MiRCA</name>
        </group>
    </groups>
    <templates>
        <template>
            <template>MiRCA Port 1 JK BMS 4G-GPS</template>
            <name>MiRCA Port 1 JK BMS 4G-GPS</name>
            <description>MiRCA serial port 1 running the 'JK BMS 4G-GPS' protocol (protocol id 2). SNMP v2c over the Ethernet interface, tree .1.3.6.1.4.1.2021.13.16.4.2.1 (doc/ports.md). Link 'MiRCA Device' too. JK BMS over the 4G-GPS protocol (000).</description>
            <groups>
                <group>
                    <name>Templates/MiRCA</name>
                </group>
            </groups>
            <applications>
                <application>
                    <name>Port 1</name>
                </application>
                <application>
                    <name>Battery</name>
                </application>
                <application>
                    <name>Cells</name>
                </application>
                <application>
                    <name>Temperature</name>
                </application>
            </applications>
            <items>
                <item>
                    <name>Port 1: protocol</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.1.1</snmp_oid>
                    <key>mirca.p1.protocol</key>
                    <delay>{$MIRCA.INTERVAL.SLOW}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>UNSIGNED</value_type>
                    <description>Protocol configured on the port</description>
                    <applications>
                        <application>
                            <name>Port 1</name>
                        </application>
                    </applications>
                    <valuemap>
                        <name>MiRCA protocol</name>
                    </valuemap>
                </item>
                <item>
                    <name>Port 1: online</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.1.2</snmp_oid>
                    <key>mirca.p1.online</key>
                    <delay>{$MIRCA.INTERVAL}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>UNSIGNED</value_type>
                    <description>1 while the device answers. All values read 0 while it is offline.</description>
                    <applications>
                        <application>
                            <name>Port 1</name>
                        </application>
                    </applications>
                    <valuemap>
                        <name>MiRCA online</name>
                    </valuemap>
                </item>
                <item>
                    <name>Port 1: seconds since last reply</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.1.3</snmp_oid>
                    <key>mirca.p1.age</key>
                    <delay>{$MIRCA.INTERVAL}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>FLOAT</value_type>
                    <units>s</units>
                    <description>-1: no reply since boot</description>
                    <applications>
                        <application>
                            <name>Port 1</name>
                        </application>
                    </applications>
                </item>
                <item>
                    <name>Port 1: voltage</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.1.10</snmp_oid>
                    <key>mirca.p1.voltage</key>
                    <delay>{$MIRCA.INTERVAL}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>FLOAT</value_type>
                    <units>V</units>
                    <applications>
                        <application>
                            <name>Battery</name>
                        </application>
                    </applications>
                    <preprocessing>
                        <step>
                            <type>MULTIPLIER</type>
                            <parameters>
                                <parameter>0.01</parameter>
                            </parameters>
                        </step>
                    </preprocessing>
                </item>
                <item>
                    <name>Port 1: current</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.1.11</snmp_oid>
                    <key>mirca.p1.current</key>
                    <delay>{$MIRCA.INTERVAL}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>FLOAT</value_type>
                    <units>A</units>
                    <description>+ charging, - discharging</description>
                    <applications>
                        <application>
                            <name>Battery</name>
                        </application>
                    </applications>
                    <preprocessing>
                        <step>
                            <type>MULTIPLIER</type>
                            <parameters>
                                <parameter>0.01</parameter>
                            </parameters>
                        </step>
                    </preprocessing>
                </item>
                <item>
                    <name>Port 1: SOC</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.1.13</snmp_oid>
                    <key>mirca.p1.soc</key>
                    <delay>{$MIRCA.INTERVAL}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>FLOAT</value_type>
                    <units>%</units>
                    <applications>
                        <application>
                            <name>Battery</name>
                        </application>
                    </applications>
                    <preprocessing>
                        <step>
                            <type>MULTIPLIER</type>
                            <parameters>
                                <parameter>0.1</parameter>
                            </parameters>
                        </step>
                    </preprocessing>
                </item>
                <item>
                    <name>Port 1: cycles</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.1.14</snmp_oid>
                    <key>mirca.p1.cycles</key>
                    <delay>{$MIRCA.INTERVAL.SLOW}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>UNSIGNED</value_type>
                    <applications>
                        <application>
                            <name>Battery</name>
                        </application>
                    </applications>
                </item>
                <item>
                    <name>Port 1: cell count</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.1.17</snmp_oid>
                    <key>mirca.p1.cell_count</key>
                    <delay>{$MIRCA.INTERVAL.SLOW}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>UNSIGNED</value_type>
                    <applications>
                        <application>
                            <name>Battery</name>
                        </application>
                    </applications>
                </item>
                <item>
                    <name>Port 1: power (calculated)</name>
                    <type>CALCULATED</type>
                    <key>mirca.p1.power.calc</key>
                    <delay>{$MIRCA.INTERVAL}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>FLOAT</value_type>
                    <units>W</units>
                    <params>last(mirca.p1.voltage)*last(mirca.p1.current)</params>
                    <description>Voltage x current; the protocol does not report power. + charging</description>
                    <applications>
                        <application>
                            <name>Battery</name>
                        </application>
                    </applications>
                </item>
            </items>
            <discovery_rules>
                <discovery_rule>
                    <name>Port 1: cells discovery</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>discovery[{#SNMPVALUE},1.3.6.1.4.1.2021.13.16.4.2.1.20]</snmp_oid>
                    <key>mirca.p1.cells.discovery</key>
                    <delay>1h</delay>
                    <filter>
                        <evaltype>AND</evaltype>
                        <conditions>
                            <condition>
                                <macro>{#SNMPVALUE}</macro>
                                <value>^[1-9]</value>
                                <formulaid>A</formulaid>
                            </condition>
                        </conditions>
                    </filter>
                    <lifetime>7d</lifetime>
                    <description>Cells the BMS reports (cell voltage &gt; 0 at discovery time)</description>
                    <item_prototypes>
                        <item_prototype>
                            <name>Port 1: cell {#SNMPINDEX} voltage</name>
                            <type>SNMP_AGENT</type>
                            <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.1.20.{#SNMPINDEX}</snmp_oid>
                            <key>mirca.p1.cell[{#SNMPINDEX}]</key>
                            <delay>{$MIRCA.INTERVAL}</delay>
                            <history>14d</history>
                            <trends>365d</trends>
                            <value_type>FLOAT</value_type>
                            <units>V</units>
                            <applications>
                                <application>
                                    <name>Cells</name>
                                </application>
                            </applications>
                            <preprocessing>
                                <step>
                                    <type>MULTIPLIER</type>
                                    <parameters>
                                        <parameter>0.001</parameter>
                                    </parameters>
                                </step>
                            </preprocessing>
                        </item_prototype>
                    </item_prototypes>
                    <trigger_prototypes>
                        <trigger_prototype>
                            <expression>{MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.cell[{#SNMPINDEX}].max(2m)}&lt;{$MIRCA.CELL.UV:"p1"} and {MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.online.last()}=1</expression>
                            <name>Port 1: cell {#SNMPINDEX} undervoltage (&lt;{$MIRCA.CELL.UV:"p1"}V)</name>
                            <priority>HIGH</priority>
                        </trigger_prototype>
                        <trigger_prototype>
                            <expression>{MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.cell[{#SNMPINDEX}].min(2m)}&gt;{$MIRCA.CELL.OV:"p1"} and {MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.online.last()}=1</expression>
                            <name>Port 1: cell {#SNMPINDEX} overvoltage (&gt;{$MIRCA.CELL.OV:"p1"}V)</name>
                            <priority>HIGH</priority>
                        </trigger_prototype>
                    </trigger_prototypes>
                </discovery_rule>
                <discovery_rule>
                    <name>Port 1: temperature sensors discovery</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>discovery[{#SNMPVALUE},1.3.6.1.4.1.2021.13.16.4.2.1.21]</snmp_oid>
                    <key>mirca.p1.temps.discovery</key>
                    <delay>1h</delay>
                    <filter>
                        <evaltype>AND</evaltype>
                        <conditions>
                            <condition>
                                <macro>{#SNMPVALUE}</macro>
                                <value>^-?[1-9]</value>
                                <formulaid>A</formulaid>
                            </condition>
                        </conditions>
                    </filter>
                    <lifetime>7d</lifetime>
                    <description>Temperature sensors the BMS reports (non-zero at discovery time)</description>
                    <item_prototypes>
                        <item_prototype>
                            <name>Port 1: temperature T{#SNMPINDEX}</name>
                            <type>SNMP_AGENT</type>
                            <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.1.21.{#SNMPINDEX}</snmp_oid>
                            <key>mirca.p1.temp[{#SNMPINDEX}]</key>
                            <delay>{$MIRCA.INTERVAL}</delay>
                            <history>14d</history>
                            <trends>365d</trends>
                            <value_type>FLOAT</value_type>
                            <units>°C</units>
                            <applications>
                                <application>
                                    <name>Temperature</name>
                                </application>
                            </applications>
                            <preprocessing>
                                <step>
                                    <type>MULTIPLIER</type>
                                    <parameters>
                                        <parameter>0.1</parameter>
                                    </parameters>
                                </step>
                            </preprocessing>
                        </item_prototype>
                    </item_prototypes>
                    <trigger_prototypes>
                        <trigger_prototype>
                            <expression>{MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.temp[{#SNMPINDEX}].min(5m)}&gt;{$MIRCA.TEMP.MAX:"p1"} and {MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.online.last()}=1</expression>
                            <name>Port 1: temperature T{#SNMPINDEX} is high (&gt;{$MIRCA.TEMP.MAX:"p1"}°C)</name>
                            <priority>AVERAGE</priority>
                        </trigger_prototype>
                        <trigger_prototype>
                            <expression>{MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.temp[{#SNMPINDEX}].max(5m)}&lt;{$MIRCA.TEMP.MIN:"p1"} and {MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.online.last()}=1</expression>
                            <name>Port 1: temperature T{#SNMPINDEX} is low (&lt;{$MIRCA.TEMP.MIN:"p1"}°C)</name>
                            <priority>WARNING</priority>
                        </trigger_prototype>
                    </trigger_prototypes>
                </discovery_rule>
            </discovery_rules>
            <macros>
                <macro>
                    <macro>{$MIRCA.INTERVAL}</macro>
                    <value>30s</value>
                    <description>Polling interval of live values</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.INTERVAL.SLOW}</macro>
                    <value>5m</value>
                    <description>Polling interval of slowly changing values (capacity, cycles, energy counters)</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.OFFLINE.TIME}</macro>
                    <value>5m</value>
                    <description>How long the device may stay silent before a problem is raised</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.SOC.WARN}</macro>
                    <value>20</value>
                    <description>SOC below this, %, raises a warning. Per port: {$MIRCA.SOC.WARN:"p1"}</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.SOC.CRIT}</macro>
                    <value>10</value>
                    <description>SOC below this, %, raises a high problem. Per port: {$MIRCA.SOC.CRIT:"p1"}</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.CELL.UV}</macro>
                    <value>2.9</value>
                    <description>Cell undervoltage threshold, V (LiFePO4 default). Per port: {$MIRCA.CELL.UV:"p1"}</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.CELL.OV}</macro>
                    <value>3.65</value>
                    <description>Cell overvoltage threshold, V (LiFePO4 default). Per port: {$MIRCA.CELL.OV:"p1"}</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.TEMP.MAX}</macro>
                    <value>50</value>
                    <description>Battery temperature sensor high threshold, °C. Per port: {$MIRCA.TEMP.MAX:"p1"}</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.TEMP.MIN}</macro>
                    <value>0</value>
                    <description>Battery temperature sensor low threshold, °C. Per port: {$MIRCA.TEMP.MIN:"p1"}</description>
                </macro>
            </macros>
        </template>
        <template>
            <template>MiRCA Port 2 JK BMS 4G-GPS</template>
            <name>MiRCA Port 2 JK BMS 4G-GPS</name>
            <description>MiRCA serial port 2 running the 'JK BMS 4G-GPS' protocol (protocol id 2). SNMP v2c over the Ethernet interface, tree .1.3.6.1.4.1.2021.13.16.4.2.2 (doc/ports.md). Link 'MiRCA Device' too. JK BMS over the 4G-GPS protocol (000).</description>
            <groups>
                <group>
                    <name>Templates/MiRCA</name>
                </group>
            </groups>
            <applications>
                <application>
                    <name>Port 2</name>
                </application>
                <application>
                    <name>Battery</name>
                </application>
                <application>
                    <name>Cells</name>
                </application>
                <application>
                    <name>Temperature</name>
                </application>
            </applications>
            <items>
                <item>
                    <name>Port 2: protocol</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.2.1</snmp_oid>
                    <key>mirca.p2.protocol</key>
                    <delay>{$MIRCA.INTERVAL.SLOW}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>UNSIGNED</value_type>
                    <description>Protocol configured on the port</description>
                    <applications>
                        <application>
                            <name>Port 2</name>
                        </application>
                    </applications>
                    <valuemap>
                        <name>MiRCA protocol</name>
                    </valuemap>
                </item>
                <item>
                    <name>Port 2: online</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.2.2</snmp_oid>
                    <key>mirca.p2.online</key>
                    <delay>{$MIRCA.INTERVAL}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>UNSIGNED</value_type>
                    <description>1 while the device answers. All values read 0 while it is offline.</description>
                    <applications>
                        <application>
                            <name>Port 2</name>
                        </application>
                    </applications>
                    <valuemap>
                        <name>MiRCA online</name>
                    </valuemap>
                </item>
                <item>
                    <name>Port 2: seconds since last reply</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.2.3</snmp_oid>
                    <key>mirca.p2.age</key>
                    <delay>{$MIRCA.INTERVAL}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>FLOAT</value_type>
                    <units>s</units>
                    <description>-1: no reply since boot</description>
                    <applications>
                        <application>
                            <name>Port 2</name>
                        </application>
                    </applications>
                </item>
                <item>
                    <name>Port 2: voltage</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.2.10</snmp_oid>
                    <key>mirca.p2.voltage</key>
                    <delay>{$MIRCA.INTERVAL}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>FLOAT</value_type>
                    <units>V</units>
                    <applications>
                        <application>
                            <name>Battery</name>
                        </application>
                    </applications>
                    <preprocessing>
                        <step>
                            <type>MULTIPLIER</type>
                            <parameters>
                                <parameter>0.01</parameter>
                            </parameters>
                        </step>
                    </preprocessing>
                </item>
                <item>
                    <name>Port 2: current</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.2.11</snmp_oid>
                    <key>mirca.p2.current</key>
                    <delay>{$MIRCA.INTERVAL}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>FLOAT</value_type>
                    <units>A</units>
                    <description>+ charging, - discharging</description>
                    <applications>
                        <application>
                            <name>Battery</name>
                        </application>
                    </applications>
                    <preprocessing>
                        <step>
                            <type>MULTIPLIER</type>
                            <parameters>
                                <parameter>0.01</parameter>
                            </parameters>
                        </step>
                    </preprocessing>
                </item>
                <item>
                    <name>Port 2: SOC</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.2.13</snmp_oid>
                    <key>mirca.p2.soc</key>
                    <delay>{$MIRCA.INTERVAL}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>FLOAT</value_type>
                    <units>%</units>
                    <applications>
                        <application>
                            <name>Battery</name>
                        </application>
                    </applications>
                    <preprocessing>
                        <step>
                            <type>MULTIPLIER</type>
                            <parameters>
                                <parameter>0.1</parameter>
                            </parameters>
                        </step>
                    </preprocessing>
                </item>
                <item>
                    <name>Port 2: cycles</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.2.14</snmp_oid>
                    <key>mirca.p2.cycles</key>
                    <delay>{$MIRCA.INTERVAL.SLOW}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>UNSIGNED</value_type>
                    <applications>
                        <application>
                            <name>Battery</name>
                        </application>
                    </applications>
                </item>
                <item>
                    <name>Port 2: cell count</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.2.17</snmp_oid>
                    <key>mirca.p2.cell_count</key>
                    <delay>{$MIRCA.INTERVAL.SLOW}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>UNSIGNED</value_type>
                    <applications>
                        <application>
                            <name>Battery</name>
                        </application>
                    </applications>
                </item>
                <item>
                    <name>Port 2: power (calculated)</name>
                    <type>CALCULATED</type>
                    <key>mirca.p2.power.calc</key>
                    <delay>{$MIRCA.INTERVAL}</delay>
                    <history>14d</history>
                    <trends>365d</trends>
                    <value_type>FLOAT</value_type>
                    <units>W</units>
                    <params>last(mirca.p2.voltage)*last(mirca.p2.current)</params>
                    <description>Voltage x current; the protocol does not report power. + charging</description>
                    <applications>
                        <application>
                            <name>Battery</name>
                        </application>
                    </applications>
                </item>
            </items>
            <discovery_rules>
                <discovery_rule>
                    <name>Port 2: cells discovery</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>discovery[{#SNMPVALUE},1.3.6.1.4.1.2021.13.16.4.2.2.20]</snmp_oid>
                    <key>mirca.p2.cells.discovery</key>
                    <delay>1h</delay>
                    <filter>
                        <evaltype>AND</evaltype>
                        <conditions>
                            <condition>
                                <macro>{#SNMPVALUE}</macro>
                                <value>^[1-9]</value>
                                <formulaid>A</formulaid>
                            </condition>
                        </conditions>
                    </filter>
                    <lifetime>7d</lifetime>
                    <description>Cells the BMS reports (cell voltage &gt; 0 at discovery time)</description>
                    <item_prototypes>
                        <item_prototype>
                            <name>Port 2: cell {#SNMPINDEX} voltage</name>
                            <type>SNMP_AGENT</type>
                            <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.2.20.{#SNMPINDEX}</snmp_oid>
                            <key>mirca.p2.cell[{#SNMPINDEX}]</key>
                            <delay>{$MIRCA.INTERVAL}</delay>
                            <history>14d</history>
                            <trends>365d</trends>
                            <value_type>FLOAT</value_type>
                            <units>V</units>
                            <applications>
                                <application>
                                    <name>Cells</name>
                                </application>
                            </applications>
                            <preprocessing>
                                <step>
                                    <type>MULTIPLIER</type>
                                    <parameters>
                                        <parameter>0.001</parameter>
                                    </parameters>
                                </step>
                            </preprocessing>
                        </item_prototype>
                    </item_prototypes>
                    <trigger_prototypes>
                        <trigger_prototype>
                            <expression>{MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.cell[{#SNMPINDEX}].max(2m)}&lt;{$MIRCA.CELL.UV:"p2"} and {MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.online.last()}=1</expression>
                            <name>Port 2: cell {#SNMPINDEX} undervoltage (&lt;{$MIRCA.CELL.UV:"p2"}V)</name>
                            <priority>HIGH</priority>
                        </trigger_prototype>
                        <trigger_prototype>
                            <expression>{MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.cell[{#SNMPINDEX}].min(2m)}&gt;{$MIRCA.CELL.OV:"p2"} and {MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.online.last()}=1</expression>
                            <name>Port 2: cell {#SNMPINDEX} overvoltage (&gt;{$MIRCA.CELL.OV:"p2"}V)</name>
                            <priority>HIGH</priority>
                        </trigger_prototype>
                    </trigger_prototypes>
                </discovery_rule>
                <discovery_rule>
                    <name>Port 2: temperature sensors discovery</name>
                    <type>SNMP_AGENT</type>
                    <snmp_oid>discovery[{#SNMPVALUE},1.3.6.1.4.1.2021.13.16.4.2.2.21]</snmp_oid>
                    <key>mirca.p2.temps.discovery</key>
                    <delay>1h</delay>
                    <filter>
                        <evaltype>AND</evaltype>
                        <conditions>
                            <condition>
                                <macro>{#SNMPVALUE}</macro>
                                <value>^-?[1-9]</value>
                                <formulaid>A</formulaid>
                            </condition>
                        </conditions>
                    </filter>
                    <lifetime>7d</lifetime>
                    <description>Temperature sensors the BMS reports (non-zero at discovery time)</description>
                    <item_prototypes>
                        <item_prototype>
                            <name>Port 2: temperature T{#SNMPINDEX}</name>
                            <type>SNMP_AGENT</type>
                            <snmp_oid>1.3.6.1.4.1.2021.13.16.4.2.2.21.{#SNMPINDEX}</snmp_oid>
                            <key>mirca.p2.temp[{#SNMPINDEX}]</key>
                            <delay>{$MIRCA.INTERVAL}</delay>
                            <history>14d</history>
                            <trends>365d</trends>
                            <value_type>FLOAT</value_type>
                            <units>°C</units>
                            <applications>
                                <application>
                                    <name>Temperature</name>
                                </application>
                            </applications>
                            <preprocessing>
                                <step>
                                    <type>MULTIPLIER</type>
                                    <parameters>
                                        <parameter>0.1</parameter>
                                    </parameters>
                                </step>
                            </preprocessing>
                        </item_prototype>
                    </item_prototypes>
                    <trigger_prototypes>
                        <trigger_prototype>
                            <expression>{MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.temp[{#SNMPINDEX}].min(5m)}&gt;{$MIRCA.TEMP.MAX:"p2"} and {MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.online.last()}=1</expression>
                            <name>Port 2: temperature T{#SNMPINDEX} is high (&gt;{$MIRCA.TEMP.MAX:"p2"}°C)</name>
                            <priority>AVERAGE</priority>
                        </trigger_prototype>
                        <trigger_prototype>
                            <expression>{MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.temp[{#SNMPINDEX}].max(5m)}&lt;{$MIRCA.TEMP.MIN:"p2"} and {MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.online.last()}=1</expression>
                            <name>Port 2: temperature T{#SNMPINDEX} is low (&lt;{$MIRCA.TEMP.MIN:"p2"}°C)</name>
                            <priority>WARNING</priority>
                        </trigger_prototype>
                    </trigger_prototypes>
                </discovery_rule>
            </discovery_rules>
            <macros>
                <macro>
                    <macro>{$MIRCA.INTERVAL}</macro>
                    <value>30s</value>
                    <description>Polling interval of live values</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.INTERVAL.SLOW}</macro>
                    <value>5m</value>
                    <description>Polling interval of slowly changing values (capacity, cycles, energy counters)</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.OFFLINE.TIME}</macro>
                    <value>5m</value>
                    <description>How long the device may stay silent before a problem is raised</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.SOC.WARN}</macro>
                    <value>20</value>
                    <description>SOC below this, %, raises a warning. Per port: {$MIRCA.SOC.WARN:"p1"}</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.SOC.CRIT}</macro>
                    <value>10</value>
                    <description>SOC below this, %, raises a high problem. Per port: {$MIRCA.SOC.CRIT:"p1"}</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.CELL.UV}</macro>
                    <value>2.9</value>
                    <description>Cell undervoltage threshold, V (LiFePO4 default). Per port: {$MIRCA.CELL.UV:"p1"}</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.CELL.OV}</macro>
                    <value>3.65</value>
                    <description>Cell overvoltage threshold, V (LiFePO4 default). Per port: {$MIRCA.CELL.OV:"p1"}</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.TEMP.MAX}</macro>
                    <value>50</value>
                    <description>Battery temperature sensor high threshold, °C. Per port: {$MIRCA.TEMP.MAX:"p1"}</description>
                </macro>
                <macro>
                    <macro>{$MIRCA.TEMP.MIN}</macro>
                    <value>0</value>
                    <description>Battery temperature sensor low threshold, °C. Per port: {$MIRCA.TEMP.MIN:"p1"}</description>
                </macro>
            </macros>
        </template>
    </templates>
    <triggers>
        <trigger>
            <expression>{MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.protocol.last()}&lt;&gt;2</expression>
            <name>Port 1: protocol is not JK BMS 4G-GPS (template does not match port settings)</name>
            <priority>WARNING</priority>
            <description>The port runs protocol {ITEM.LASTVALUE}. Change the port settings or link another template.</description>
        </trigger>
        <trigger>
            <expression>{MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.online.max({$MIRCA.OFFLINE.TIME})}=0 and {MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.protocol.last()}=2</expression>
            <name>Port 1: JK BMS 4G-GPS not responding</name>
            <priority>AVERAGE</priority>
            <description>No valid reply from the device for {$MIRCA.OFFLINE.TIME}. Check wiring, interface module, baud rate and device address.</description>
        </trigger>
        <trigger>
            <expression>{MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.soc.max(5m)}&lt;{$MIRCA.SOC.CRIT:"p1"} and {MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.online.last()}=1</expression>
            <name>Port 1: battery SOC is critically low (&lt;{$MIRCA.SOC.CRIT:"p1"}%)</name>
            <priority>HIGH</priority>
        </trigger>
        <trigger>
            <expression>{MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.soc.max(5m)}&lt;{$MIRCA.SOC.WARN:"p1"} and {MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.online.last()}=1</expression>
            <name>Port 1: battery SOC is low (&lt;{$MIRCA.SOC.WARN:"p1"}%)</name>
            <priority>WARNING</priority>
            <dependencies>
                <dependency>
                    <name>Port 1: battery SOC is critically low (&lt;{$MIRCA.SOC.CRIT:"p1"}%)</name>
                    <expression>{MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.soc.max(5m)}&lt;{$MIRCA.SOC.CRIT:"p1"} and {MiRCA Port 1 JK BMS 4G-GPS:mirca.p1.online.last()}=1</expression>
                </dependency>
            </dependencies>
        </trigger>
        <trigger>
            <expression>{MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.protocol.last()}&lt;&gt;2</expression>
            <name>Port 2: protocol is not JK BMS 4G-GPS (template does not match port settings)</name>
            <priority>WARNING</priority>
            <description>The port runs protocol {ITEM.LASTVALUE}. Change the port settings or link another template.</description>
        </trigger>
        <trigger>
            <expression>{MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.online.max({$MIRCA.OFFLINE.TIME})}=0 and {MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.protocol.last()}=2</expression>
            <name>Port 2: JK BMS 4G-GPS not responding</name>
            <priority>AVERAGE</priority>
            <description>No valid reply from the device for {$MIRCA.OFFLINE.TIME}. Check wiring, interface module, baud rate and device address.</description>
        </trigger>
        <trigger>
            <expression>{MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.soc.max(5m)}&lt;{$MIRCA.SOC.CRIT:"p2"} and {MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.online.last()}=1</expression>
            <name>Port 2: battery SOC is critically low (&lt;{$MIRCA.SOC.CRIT:"p2"}%)</name>
            <priority>HIGH</priority>
        </trigger>
        <trigger>
            <expression>{MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.soc.max(5m)}&lt;{$MIRCA.SOC.WARN:"p2"} and {MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.online.last()}=1</expression>
            <name>Port 2: battery SOC is low (&lt;{$MIRCA.SOC.WARN:"p2"}%)</name>
            <priority>WARNING</priority>
            <dependencies>
                <dependency>
                    <name>Port 2: battery SOC is critically low (&lt;{$MIRCA.SOC.CRIT:"p2"}%)</name>
                    <expression>{MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.soc.max(5m)}&lt;{$MIRCA.SOC.CRIT:"p2"} and {MiRCA Port 2 JK BMS 4G-GPS:mirca.p2.online.last()}=1</expression>
                </dependency>
            </dependencies>
        </trigger>
    </triggers>
    <graphs>
        <graph>
            <name>Port 1: voltage and current</name>
            <graph_items>
                <graph_item>
                    <sortorder>0</sortorder>
                    <color>1A7C11</color>
                    <item>
                        <host>MiRCA Port 1 JK BMS 4G-GPS</host>
                        <key>mirca.p1.voltage</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>1</sortorder>
                    <color>F63100</color>
                    <yaxisside>RIGHT</yaxisside>
                    <item>
                        <host>MiRCA Port 1 JK BMS 4G-GPS</host>
                        <key>mirca.p1.current</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
        <graph>
            <name>Port 1: SOC</name>
            <graph_items>
                <graph_item>
                    <sortorder>0</sortorder>
                    <color>1A7C11</color>
                    <item>
                        <host>MiRCA Port 1 JK BMS 4G-GPS</host>
                        <key>mirca.p1.soc</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
        <graph>
            <name>Port 1: power</name>
            <graph_items>
                <graph_item>
                    <sortorder>0</sortorder>
                    <color>1A7C11</color>
                    <item>
                        <host>MiRCA Port 1 JK BMS 4G-GPS</host>
                        <key>mirca.p1.power.calc</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
        <graph>
            <name>Port 2: voltage and current</name>
            <graph_items>
                <graph_item>
                    <sortorder>0</sortorder>
                    <color>1A7C11</color>
                    <item>
                        <host>MiRCA Port 2 JK BMS 4G-GPS</host>
                        <key>mirca.p2.voltage</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>1</sortorder>
                    <color>F63100</color>
                    <yaxisside>RIGHT</yaxisside>
                    <item>
                        <host>MiRCA Port 2 JK BMS 4G-GPS</host>
                        <key>mirca.p2.current</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
        <graph>
            <name>Port 2: SOC</name>
            <graph_items>
                <graph_item>
                    <sortorder>0</sortorder>
                    <color>1A7C11</color>
                    <item>
                        <host>MiRCA Port 2 JK BMS 4G-GPS</host>
                        <key>mirca.p2.soc</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
        <graph>
            <name>Port 2: power</name>
            <graph_items>
                <graph_item>
                    <sortorder>0</sortorder>
                    <color>1A7C11</color>
                    <item>
                        <host>MiRCA Port 2 JK BMS 4G-GPS</host>
                        <key>mirca.p2.power.calc</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
    </graphs>
    <value_maps>
        <value_map>
            <name>MiRCA online</name>
            <mappings>
                <mapping>
                    <value>0</value>
                    <newvalue>Offline</newvalue>
                </mapping>
                <mapping>
                    <value>1</value>
                    <newvalue>Online</newvalue>
                </mapping>
            </mappings>
        </value_map>
        <value_map>
            <name>MiRCA protocol</name>
            <mappings>
                <mapping>
                    <value>0</value>
                    <newvalue>Off</newvalue>
                </mapping>
                <mapping>
                    <value>1</value>
                    <newvalue>Victron VE.Bus</newvalue>
                </mapping>
                <mapping>
                    <value>2</value>
                    <newvalue>JK BMS 4G-GPS</newvalue>
                </mapping>
                <mapping>
                    <value>3</value>
                    <newvalue>PACE BMS</newvalue>
                </mapping>
                <mapping>
                    <value>4</value>
                    <newvalue>JBD BMS</newvalue>
                </mapping>
                <mapping>
                    <value>5</value>
                    <newvalue>JK BMS Modbus</newvalue>
                </mapping>
                <mapping>
                    <value>6</value>
                    <newvalue>Deye inverter Modbus</newvalue>
                </mapping>
                <mapping>
                    <value>7</value>
                    <newvalue>Serial capture</newvalue>
                </mapping>
                <mapping>
                    <value>8</value>
                    <newvalue>JK BMS parallel bus</newvalue>
                </mapping>
            </mappings>
        </value_map>
    </value_maps>
</zabbix_export>
