Simple display of API request; Here: SureFlap
I’m looking for a module template to display the response for a specific API call.
I’ve got a Petcare SureFlap and already set up a REST API for it.
I’m only trying to display the current location of my cat on the mirror. The look should be similar to MMM-FHEM.
The request url looks like that:
So I’ll need the following config variables:
Name of the pet as title because it isn’t included in this specific call
The response looks like this:
The final module should display the pet’s name as title and the current location (preferrably with German translation) underneath it.
I hope that someone can point me in the right direction. I’ve already tried editing the existing MMM-FHEM because it looks just like what I want but I’m struggling with the extraction of values from the call.
@ferby09 is the response JSON text? if so,
var obj = JSON.parse(response_string)
to get an object.
then obj.key has the value
obj.location in this case
@sdetweil Yes, the response is JSON.
But a friend helped me doing a quick and dirty frontend workaround with XHR and css.
So this thread can be closed.