Using REST api to get input gpio state #334

Open
opened 2020-07-21 17:35:07 +01:00 by 5thLabRat · 5 comments
5thLabRat commented 2020-07-21 17:35:07 +01:00 (Migrated from github.com)

Does anyone know if it is possible to use the REST api to check the current state for a gpio input?

I'm currently using a mechanical switch to detect the end of the filament but I would like to be able to monitor this switch from my Home Assistant server.

If I use the list specific input endpoint I get the correct json response but none of the entries appear to be the actual state.

Does anyone know if it is possible to use the REST api to check the current state for a gpio input? I'm currently using a mechanical switch to detect the end of the filament but I would like to be able to monitor this switch from my Home Assistant server. If I use the list specific input endpoint I get the correct json response but none of the entries appear to be the actual state.
mrath commented 2020-12-08 19:26:26 +00:00 (Migrated from github.com)

Did you resolve this? I’m in the same boat - would also like to exposure temperature readings through homebridge, but no luck so far.

Did you resolve this? I’m in the same boat - would also like to exposure temperature readings through homebridge, but no luck so far.
vitormhenrique commented 2020-12-08 19:30:21 +00:00 (Migrated from github.com)

i just tested here using

http://**{URL}**/plugin/enclosure/getOutputStatus?apikey=**{APIKEY}**

and got reply with:

[{"status": false, "index_id": 6}]

what endpoints are you trying to use?

i just tested here using ``` http://**{URL}**/plugin/enclosure/getOutputStatus?apikey=**{APIKEY}** ``` and got reply with: ``` [{"status": false, "index_id": 6}] ``` what endpoints are you trying to use?
mrath commented 2020-12-08 21:38:38 +00:00 (Migrated from github.com)

I am not sure what you mean. We are trying to get the state of an input.
I managed to use the api to get a long, seemingly general-purpose JSON with the input data (input is index 1):
http://**{URL}**/plugin/enclosure/inputs/1
... so I guess I just have to find a way to get temp and humidity from that JSON into homebridge.

I am not sure what you mean. We are trying to get the state of an input. I managed to use the api to get a long, seemingly general-purpose JSON with the input data (input is index 1): `http://**{URL}**/plugin/enclosure/inputs/1` ... so I guess I just have to find a way to get temp and humidity from that JSON into homebridge.
martinezpenya commented 2020-12-23 21:18:37 +00:00 (Migrated from github.com)

I'm facing same problem, I want to get temp sensor from enclosure plugin through REST to put it in Home Assistant.
If I use the old API documentation as @mrath suggested I get 404 error....
the getOutputStatus with apikey from @vitormhenrique is woking well.... but... how I get temp and humidity from my dht22 attached sensor??

I'm facing same problem, I want to get temp sensor from enclosure plugin through REST to put it in Home Assistant. If I use the old API documentation as @mrath suggested I get 404 error.... the getOutputStatus with apikey from @vitormhenrique is woking well.... but... how I get temp and humidity from my dht22 attached sensor??
steviehs commented 2021-02-23 22:44:41 +00:00 (Migrated from github.com)

Hmm... I am rather confused now:
I am running in exactly the same issue while trying to use the API for Octodash:

http://**{URL}**/plugin/enclosure/getOutputStatus?apikey=**{APIKEY}**

works, but

http://**{URL}**/plugin/enclosure/inputs

gives me a 404. Running 4.12 ....

What am I doing wrong? How are the both API specs (in Wiki and the md file in the repo) related?

Hmm... I am rather confused now: I am running in exactly the same issue while trying to use the API for Octodash: `http://**{URL}**/plugin/enclosure/getOutputStatus?apikey=**{APIKEY}**` works, but ` http://**{URL}**/plugin/enclosure/inputs` gives me a 404. Running 4.12 .... What am I doing wrong? How are the both API specs (in Wiki and the md file in the repo) related?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gandalf/OctoPrint-Enclosure#334