Community discussions

MikroTik App
 
nemke
Member Candidate
Member Candidate
Topic Author
Posts: 157
Joined: Thu Jul 31, 2014 2:52 am

Dude conversion

Mon Jul 11, 2022 12:40 am

Hello
I have 3 oid for Raspberry pi, which shows status of Relay on bord
REL1 Stat: [oid("1.3.6.1.2.1.25.1.21")]
REL2 Stat: [oid("1.3.6.1.2.1.25.1.22")]
REL3 Stat: [oid("1.3.6.1.2.1.25.1.23")]
It work, see real state of all 3 relays. BUT value are 1 or 0. 1 for ON and 0 for OFF
So in dude i se like this:
REL1 Stat: 1
REL2 Stat: 0
REL3 Stat: 0

I like to convert this so when dude receve 1 to be show ON, and when dude receve 0 to show OFF
REL1 Stat: ON
REL2 Stat: OFF
REL3 Stat: OFF
How to do this ?

Also CPU temperature oid shows value like 54237, so this mean temp is 54C. So I want to use only first 2 number to show me in dude. How to cut the rest

Thank you
 
nemke
Member Candidate
Member Candidate
Topic Author
Posts: 157
Joined: Thu Jul 31, 2014 2:52 am

Re: Dude conversion  [SOLVED]

Mon Jul 11, 2022 12:02 pm

Solved

REL1 Stat: [oid("1.3.6.1.2.1.25.1.21")]
REL2 Stat: [oid("1.3.6.1.2.1.25.1.22")]
REL3 Stat: [oid("1.3.6.1.2.1.25.1.23")]
Need to be like this:
REL1 Stat: [if((oid("1.3.6.1.2.1.25.1.21")=1),"ON", "OFF")]
REL2 Stat: [if((oid("1.3.6.1.2.1.25.1.22")=1),"ON", "OFF")]
REL3 Stat: [if((oid("1.3.6.1.2.1.25.1.23")=1),"ON", "OFF")]

And CPU temp shou be
CpuTemp: [round(oid("1.3.6.1.2.1.25.1.8")/"1000")]°C in this case 54°C is shown
CpuTemp: [oid("1.3.6.1.2.1.25.1.8")]°C in this case 54378°C is show

Who is online

Users browsing this forum: panisk0 and 21 guests