webiopi().callMacro("getLedStatus")
--
You received this message because you are subscribed to the Google Groups "WebIOPi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webiopi+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Hi Caroline,
True
2014-01-29 13:52:30 - HTTP - DEBUG - "POST /macros/get_DoorStatus/0 HTTP/1.1" 200 -
2014-01-29 13:52:30 - HTTP - DEBUG - "GET /* HTTP/1.1" 200 -
2014-01-29 13:52:31 - HTTP - DEBUG - "GET /* HTTP/1.1" 200 -
Open
2014-01-29 13:52:31 - HTTP - DEBUG - "GET /* HTTP/1.1" 200 -
True
2014-01-29 13:52:32 - HTTP - DEBUG - "POST /macros/get_DoorStatus/0 HTTP/1.1" 200 -
2014-01-29 13:52:32 - HTTP - DEBUG - "GET /* HTTP/1.1" 200 -
2014-01-29 13:52:33 - HTTP - DEBUG - "GET /* HTTP/1.1" 200 -
2014-01-29 13:52:33 - HTTP - DEBUG - "GET /* HTTP/1.1" 200 -
Open
I am really running out of ideas, not sure what else it can be :/
--
--
Hi SlappyWell presumably you were following the code in this original post and you are calling a macro in your script.py to get the state of the gpio - high or low and amending the button with the callback, if so then you could add the following in RED
setInterval ("callMacro_get_DoorStatus()", 5000);{}function callMacro_get_DoorStatus(){var args = [0]//Get data form script.py and return it with Callback
webiopi().callMacro("get_DoorStatus", args, macro_get_DoorStatus_Callback);}
function macro_get_DoorStatus_Callback(macro, args, data){
p0 = data.split(" ")[0];if (p0==1){webiopi().setClass("macro1", "Open");webiopi().setLabel("macro1", "Door Open");
document.getElementById("pic0").src = "/webiopi/htdocs/Switch_Low.png"; }
else{webiopi().setClass("macro1", "Closed");webiopi().setLabel("macro1", "Door Closed");
document.getElementById("pic0").src = "/webiopi/htdocs/Switch_High.png"; }}Then in the head section add<div><img name="pic0" id="pic0"></div>If this is not the case and your not using python then you could check the state of the GPIO - High or Low in the index.html file, see attached, I am sure there are loads of other perhaps better ways to achieve this, but it should give you some ideas to check (obviously you would change the example .png's to your images)
It’s very nice of Toshi to offer helping you while he’s on vacation! Hopefully I can help so he can relax. :-)
GP, it looks like you have some copy/paste errors in your javascript. If you open the javascript console, you would see where the messages are. Press F12 in Chrome browser.
First error is at the end of your webiopi().ready(function () {}); function.
// you can also create a button which calls a different function for mouse down and up events
button = webiopi().createButton("", "Tapparella Destra Giù", mousedown4, mouseup);
content.append(button);
webiopi().refreshGPIO(true);
if(0){ // looks like you forgot the IF statement here - so I added one to make it happy
webiopi().setClass("macro1", "Ok");
webiopi().setLabel("macro1", "Ok");}
else{
webiopi().setClass("macro1", "Alarm");
webiopi().setLabel("macro1", "Alarm");} // remove this closing bracket at the end of this line
}
webiopi().refreshGPIO(true); // remove this - no need to call it twice
});
The second error is at the very end of your </script> section. You started a new function declaration, but didn’t finish it.
function callMacro_get_SalaStatus(){
var args = [0] //Get data form script.py and return it with Callback
webiopi().callMacro("get_SalaStatus", args, macro_get_SaStatus_Callback);}
function macro_get_SalaStatus_Callback(macro, args, data)
{
} // this bracket was missing - so I added one to make it happy
</script>
One more thing, your <div id="content" align="Left"></div> is outside of your <body></body> tags. It might work for certain browsers, but technically isn’t valid HTML. You might as well move it inside like this:
<body bgcolor="#ECF4F3">
<div id="content" align="Left"></div>
</body>