Status,g,<gpio>
Moderators: grovkillen, Stuntteam, TD-er
Status,g,<gpio>
Hi there, I´m unable to find a solution in this Forum nor the web......
According to the commandref "Status,g,<gpio>" gives you the status of the respetive GPIO.
Unfortunately it is a whole bunch of text, e.g.
{
"log": "",
"plugin": 1,
"pin": 12,
"mode": "output",
"state": 0
}
I only need the "1" or "0" to decide further actions....
My DeviceList is full with 12 devices so I cannot configure it there to get a simple 1 or 0.
Is there any formatting possible that I can use it in the rules?
For example like this:
if (status,g,12) = 1
event,do_something
else
event,do_somethingelse
endif
Thanks for your help!
According to the commandref "Status,g,<gpio>" gives you the status of the respetive GPIO.
Unfortunately it is a whole bunch of text, e.g.
{
"log": "",
"plugin": 1,
"pin": 12,
"mode": "output",
"state": 0
}
I only need the "1" or "0" to decide further actions....
My DeviceList is full with 12 devices so I cannot configure it there to get a simple 1 or 0.
Is there any formatting possible that I can use it in the rules?
For example like this:
if (status,g,12) = 1
event,do_something
else
event,do_somethingelse
endif
Thanks for your help!
Re: Status,g,<gpio>
"Status,g,..." I've never seen in EspEasy.
Edit: Ok, I've found it, it's a command. I think, it didn't work in if-clauses.
But
should work.
Edit: Ok, I've found it, it's a command. I think, it didn't work in if-clauses.
But
Code: Select all
if [Plugin#GPIO#Pinstate#12]=1
Re: Status,g,<gpio>
Thanks! It does
Does it also work this way with MCPGPIO or PCFGPIO pins?

Does it also work this way with MCPGPIO or PCFGPIO pins?
Re: Status,g,<gpio>
Hi ath,
unfortunately the link you posted brings me to the documentation page were I also found
"status,g,<gpiopin>" which does not work in an "if" statement as described....
So I assume "Status,MCP,<MCPGPIO>" will also provide more return info than needed in an if statement
Regards
unfortunately the link you posted brings me to the documentation page were I also found
"status,g,<gpiopin>" which does not work in an "if" statement as described....
So I assume "Status,MCP,<MCPGPIO>" will also provide more return info than needed in an if statement
Regards
Re: Status,g,<gpio>
Oh yes! That's great! Thank's for sharing!
Re: Status,g,<gpio>
A command does not return a value which you try to use in the if statement.
It isn't a programming language
Stuff wrapped between [] or %% will be replaced by some value before the rules line is being processed.
A command isn't one of these and will simply be executed but doesn't return a value after execution.
It isn't a programming language

Stuff wrapped between [] or %% will be replaced by some value before the rules line is being processed.
A command isn't one of these and will simply be executed but doesn't return a value after execution.
Re: Status,g,<gpio>
Thank's for explaining!
Who is online
Users browsing this forum: No registered users and 18 guests