'Inteligenty' dom ze sterownikiem PLC

 Language:
Szukanie zaawansowane  

Aktualności:

Powrót do strony głównej: www.edom-plc.pl

Autor Wątek: Sterowanie przez komórke  (Przeczytany 26449 razy)

DZIKI_2005

  • Newbie
  • *
  • Wiadomości: 12
    • Zobacz profil
Sterowanie przez komórke
« dnia: Marca 05, 2011, 06:28:49 pm »

Jak załatwić najprościej sterowanie przez komórkę?
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #1 dnia: Marca 06, 2011, 03:19:34 pm »

Witam,

Wszystko zależy od tego, co chcemy robić.  Jeśli sterować kilkoma funkcjami, wystarczy jakiś odbiornik/nadajnik z kartą sim, który odbierze smsy i zewrze wybrane obwody.  Jedno z wyjść mojego ATG-SV1 mam połączone ze sterownikiem PLC i jestem w stanie wysyłąjąc smsa wyłączyć wszystkie światła w domu.

Do bardziej złożonych funkcji używam nie tyle telefonu, co przeglądarki www, która jest dostępna w większości aparatów.  Telefon łączy się z domową siecią przez Wifi, w przeglądarce wybieram adres sterownika PLC, otwiera się strona ze skryptem SSI, przez którą mogę tak naprawdę wszystko. 

Trochę więcej znajdziesz na http://www.wspin.duu.pl/index.php?option=com_content&view=article&id=64:ssi&catid=29:podsystemy&Itemid=54

Pozdrawiam,
Zapisane

krwi

  • Newbie
  • *
  • Wiadomości: 47
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #2 dnia: Sierpnia 17, 2011, 06:37:49 pm »

Nie wiem czy spotkałeś się z tą aplikacją ale poszukując możliwych rozwiązań sterowania przez komórkę z Androidem natknąłem się na ten film:
http://www.youtube.com/watch?v=D5yT-I9efjg
Sam program znalazłem tu:
http://code.google.com/p/wagoandroid/
Niestety opis bardzo skromny, w dodatku po Niemiecku, którego nie znam ale być może dało by się ten program wykorzystać.
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #3 dnia: Sierpnia 22, 2011, 10:16:38 am »

Witam,

Wielkie dzięki za linki, nie znalazłem wcześniej tej strony.  Wielki plus jest taki, że to wszystko jest open source i można przebudowywać dowolnie. Minus to niestety spora złożoność, na rozgryzanie której brakuje teraz czasu.  Tak, czy inaczej, jestem zdania, że przyszłością jest tablet z Androidem przyczepiony do ściany z programem do sterowania domem, z pocztą, Skypem itd...  Dedykowane panele z roździelczością 400x600 na potrzeby domu to przeszłość.

Pozdrawiam,



Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #4 dnia: Listopada 30, 2011, 12:50:00 pm »

Hi,

I hope you speak English, because I dont speak Polish.
I translate everyting with Google translate.
I found your video on You tube very interesting.
Iworking on a simulair project:
http://www.youtube.com/watch?v=3tYHzOOuLBA

But I placed de HTML and Java code in the plc and jou on a other website I think?
I work with this princip from Wago:
http://www.youtube.com/watch?v=PdAKm0_YiRs
http://www.youtube.com/watch?v=IzarLfoPwLg

I can give the code, from my and from Wago.

regards Janus from Spain

Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #5 dnia: Listopada 30, 2011, 08:07:00 pm »

I forgot my url  ;D
http://www.jan-karina.be/android/wago_test2.html

For Android Windows and Iphone
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #6 dnia: Grudnia 01, 2011, 08:44:30 am »

Hello Janus,

I'm glad you found my project interesting.  I have visited your site.  PLC is not as astonishing as all the photos from your journeys.  Very impressive!

I also started with placing SSI scripts and the htm pages on the PLC.  I have, however, quickly noticed it is an outdated technology.  A page placed at the server must be refreshed each time you want to have new data.  That is not an user experience of our dreams.

It is, in my opinion, much more effective to have a web page stored locally, on the device which you use (PC, mobile phone etc.) and use AJAX request to fetch the data from the server.  There are 2 main benefits of such an approach:

1. The page loads quicker, as it is available locally, so all the html, js, jpg/png files do not need to be downloaded,
2. The Ajax request can be launched at any time, many at once, can be controlled, cued, terminated etc.

Since it was difficult for me to write a script using HtmlRequest, which would work on all browsers, I used the jQuery library, which takes care for all the details.  You can see an example page here.

So I still use the READPI, WRITEPI commands but send requests in bulks.  All the rest you see in the movie is a 'fancy' html and some graphics.

If the link above does not work or the example code is not clear enough, please let me know and I will try to write something better.

Cheers!



Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #7 dnia: Grudnia 01, 2011, 11:01:42 am »

Hi, I refresh some variables with a javascript
<script language="JavaScript">
var int=self.setInterval("varupdate()",1000);
function varupdate()
{
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","tag_list.XML",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
document.getElementById("MW0").innerHTML="Datum en tijd van PLC (UTC): " + xmlDoc.getElementsByTagName("var1")[0].childNodes[0].nodeValue;
document.getElementById("MW1").innerHTML= xmlDoc.getElementsByTagName("var2")[0].childNodes[0].nodeValue;
}
   </script>

So I don't refresh the whole page.
But I think your Ajax is better.
I dit try it but it does not work??

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#Button1').click(function() {
$.post('http://www.mysite.com:8080/READPI',
{ADR: 'QX6.0', FORMAT1: '%d'},
function(data){$('#Result').append(data);
}
);
});
});
</script>
</Head>
<body>
<Div id ="Button1" > Kilknij mij! </div>
<Div id ='Result'></div>
</Body>
</Html>
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #8 dnia: Grudnia 01, 2011, 11:59:57 am »

Hi,

It seems we are doing the same thing ;)  XMLHttpRequest is a pain in the a... to work with, that's why I prefer a ready-to-use solutions.

Please try to extend the $(document).ready(function() {...}) with additional lines:

    $.ajaxSetup({
        username: 'ABCABC',
        password: 'ABCABC',
    });
   

What error message do you get from the javascriptconsole or the $.post querry?.  I use Chrome to debug the pages and enjoy its 'Test element'/right click funcion.

A javascript command like:  $.post("http://192.168.1.1/READPI", {ADR: "QX0.0", FORMAT: "%d"}, function(data) {alert(data);});
proceeded by the $.ajaxSetup information works for me like a charm.

Cheers!
Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #9 dnia: Grudnia 01, 2011, 10:06:46 pm »

Can I ask if you want to take a look at it?
This is the website.
http://www.jan-karina.be/android/Test_pool.html

And here is mij PLC:

http://jan-karina.dlinkddns.com:8080/plc/webvisu.htm
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #10 dnia: Grudnia 01, 2011, 10:52:06 pm »

Hi,

I have sent you an email with a file, which - when placed at my desktop - reads the status of your output being 0

I do hope there is no risk of somebody hacking you site when now you have the address posted publicly...

Best regards,

Piotr
Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #11 dnia: Grudnia 02, 2011, 06:46:56 am »

I do hope there is no risk of somebody hacking you site when now you have the address posted publicly
Normaly the PLC is protected  ;D

I tryed your file on my desktop but it is not working???
Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #12 dnia: Grudnia 11, 2011, 01:10:13 pm »

So after one week of testing  ??? someone give me the solution  ;D
Instead of getting data direct from the plc $. posten ('http://www.mysite. com: 8080/READPI ', Ik get it from a PHP page > $.ajax({
type: 'GET',
url: "http://www.mysite.com/wago.php",
data: {ADR: $(this).data('address'), FORMAT1: "%d"},
ajaxParent: $(this),
success: function(data){
this.ajaxParent.append(data)

And on this page I put this code > <?php
$url 
"http://www.mysite. com: 8080/READPI?ADR=" $_REQUEST['ADR'] . "&FORMAT1=" $_REQUEST['FORMAT1'] ;

$handle fopen($url,"r") ;
$contents stream_get_contents($handle) ;
fclose($handle) ;
echo 
$contents;
?>

That was the trick for me, hopefully  it is also usefull for someone else.
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #13 dnia: Grudnia 12, 2011, 08:55:19 am »

Hello Janus,

many thanks for sharing the solution... I took us some time to test all the options.  At the end the idea of redirecting through another server was briliant.  Thank you.

For all the others: attached is the file we used to test the connection.

Good luck!
Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #14 dnia: Grudnia 29, 2011, 10:11:24 am »

So my site is almost ready.
You can see en test here: http://www.jan-karina.be/piotr/index_pc.html
The 2 buttons on the left "licht zembad" and "pomp zwembad" are test buttons to to write and read.
I'm only hope for a button to write a certain value in the plc.
I need that as a thermostat to start my heating system.
eg. 21 will be 21° in the living.
Zapisane

andreas

  • Newbie
  • *
  • Wiadomości: 4
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #15 dnia: Stycznia 03, 2012, 10:37:42 pm »

Hi,

I found your site via Janus and a German Wago Forum.

First of all, I'm very impressed by your installation/solution! I downloaded your package from http://www.wspin.duu.pl/wago/jquery.e-dom.plugin.zip and run it (after modifying regarding my own setting).

I run into the same cross scripting problem as Janus with Chrome (it doesn't allow accessing data from another site without tricks) but got it somehow working with Firefox.

Now I can switch on a light by pressing the "button", but the spinning wheel never stop (even though all posts are ok, as far as I can see from the javascript console). Furthermore the light bulb (image) won't light up even though the related output (QX1.1) is true.

Any tipps for me?

Kind regards,
 Andreas


PS: Are you going to replace your "regular" visualisation (ie. http://www.wspin.duu.pl/plugins/content/mavikthumbnails/thumbnails/172x116-images-stories-e-dom-ScreenShot002.jpg) with an Ajax solution as well?
Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #16 dnia: Stycznia 03, 2012, 10:48:44 pm »

Try to uncheck your webserver security
Zapisane

andreas

  • Newbie
  • *
  • Wiadomości: 4
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #17 dnia: Stycznia 03, 2012, 11:02:04 pm »

Thank you Janus for you suggestion. I tried it, but it didn't work for me.

Tomorrow I'll try to use your php redirect "trick".

Andreas
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #18 dnia: Stycznia 04, 2012, 02:57:34 pm »

Hello Andreas,
Hello Janus,

I do not know why it happens that there is a problem with accessing data within the same network.  Based on the Janus experience pls try using the redirection via a php file.  If you need support at making it work, please let me know.

I will not replace the visualizations.  What works through the CoDeSys HMI is fine.  If however I get a bigger tablet to hang on the wall I will prepare a new visualization based on html/javascript.  I think it is easier to transfer between environments and will be usable in 10 years from now...  Anyway - I am sure it is possible to build even better and more fancy things with html.  The number of sliders/counters and other gadgets is unlimited.

A new version of the plugin is on its way.  I want to make it more general.  Janus keeps inspiring me of new interesting usages ;)

All the best!

Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #19 dnia: Stycznia 05, 2012, 08:32:10 pm »

And Andreas,

Do you make any progress?
Zapisane

andreas

  • Newbie
  • *
  • Wiadomości: 4
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #20 dnia: Stycznia 10, 2012, 08:34:47 pm »

Well, read request are working now - I use a generic php-proxy (see http://www.troywolf.com/articles/php/class_http/proxy.phps). For write requests I'm able to send the correct value to the wago, but when the wago tries to redirect to the result page it run into infinite redirections...

This is more complicated than I thought it would be :-)

Andreas
Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #21 dnia: Stycznia 14, 2012, 12:06:13 am »

Sorry Andreas, I mist your post, to bussy with my own project  ;D

But why are you not just using the php we I use??
<?php
IF  ($_REQUEST['TYPE']=='READPI') {
   
$url "http://www.mysite.com/READPI?ADR=" $_REQUEST['ADR'] . "&FORMAT=" $_REQUEST['FORMAT'] ;
};

IF  (
$_REQUEST['TYPE']=='WRITEPI') {
   
$url "http://www.mysite.com/WRITEPI?ADR1=" $_REQUEST['ADR1'] . "&VALUE1=" $_REQUEST['VALUE1'] . "&FORMAT1=" $_REQUEST['FORMAT1']  ;
};
$handle fopen($url,"r") ;
$contents stream_get_contents($handle) ;
fclose($handle) ;
echo 
$contents;
?>
Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #22 dnia: Stycznia 14, 2012, 12:10:59 am »

Update,
Now with  Google Gaugemeters and a slider.



For safety, only button "licht zwembad" and the slider are working  :wink:
http://www.jan-karina.be/piotr/index_gauge.html

Ps, There are some browser issues, in IE before version 9 the meters are not working.
« Ostatnia zmiana: Stycznia 15, 2012, 02:28:43 pm wysłana przez admin »
Zapisane

andreas

  • Newbie
  • *
  • Wiadomości: 4
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #23 dnia: Stycznia 14, 2012, 11:30:25 am »

W O W !!

Absolutely cool!

I'll try to use your PHP script this afternoon. The vacum cleaner just got busted and I have to get a new one :-)

Andreas
Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #24 dnia: Maja 19, 2016, 09:07:18 pm »

Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #25 dnia: Maja 21, 2016, 06:18:03 pm »

Hi,

You are looking for the link to the files, or the files are not working?

https://code.google.com/archive/p/jsgauge/
Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #26 dnia: Maja 21, 2016, 07:55:56 pm »

Hi I'm looking for the link to the files

The are not in the download files where you point to.
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #27 dnia: Maja 21, 2016, 08:52:52 pm »

Hi,

it seems google has abandoned the project

There is a copy at: https://github.com/Nirvason/jsgauge

or try to use the attachment :)
Zapisane

janus

  • Newbie
  • *
  • Wiadomości: 15
    • Zobacz profil
Odp: Sterowanie przez komórke
« Odpowiedź #28 dnia: Maja 21, 2016, 09:09:01 pm »

Thank you very much, you make my day  :)

It is working again with the zip file.
Zapisane