Orvibo S20 plugs integrated successfully into Domoticz!
Moderator: leecollings
-
- Posts: 10
- Joined: Saturday 26 September 2015 16:33
- Target OS: Windows
- Domoticz version:
- Location: Spain
- Contact:
Orvibo S20 plugs integrated successfully into Domoticz!
Hello to everyone, my name is Eduardo and I have a few weeks / months in the world of home automation.
Initially I bought a pair of Orvibo S20 plugs to test the operation through mobile. The truth is that local operation is so-so and thru Internet is very bad.
So I opted for Z-Wave protocol. Although I have some Raspberry Pi, the hardware that I'm using is a miniPC PIPO X7 with Windows 10 and Sigma Z-Wave adapter.
Some of the devices that I have are power consumption meter G2 from Aeon Labs, Multifunctional Movement Detector from Fibaro, power strip 6 outlets from Greenwave and some Fibaro hidden modules.
The fact is that as a result of searching on Internet about the possibility of communicating with plugs Orvibo S20 through the local network, I found the stikonas blog (https://stikonas.eu/wordpress/2015/02/2 ... 20-socket/) with useful information and a Windows application for command line. I spent some time testing in PHP but I could not communicate directly with the plug to turn on and off. These days I have been searching new information on Google again and I've run into two very interesting links that allowed me, with some modifications, to integrate Orvibo S20 plugs to Domoticz.
- First, I found the GitHub repository of pcp135 / Orvibo https://github.com/pcp135/Orvibo where with a simple scripting and using their programmed class, I managed to create a virtual switch that allowed me on Domoticz to turn on and off the plug!
- And thanks to sergejey / majordomo-orvibo https://github.com/sergejey/majordomo-orvibo I could make other changes using their code to update the actual/real status of the plugs to Domoticz when the status is changed manually / physically in the Orvibo S20.
The code is very dirty because I do not have much time but if anyone is interested in it and has some S20 at home you want to use, tell me and I will put the code (as soon as I clean a little) and steps.
The interesting thing is that it saves money in the automation as these plugs (uncontrolled consumption, not always necessary) are 20$ each.
Regards to all!
---
Spanish:
Hola a todos, mi nombre es Eduardo y llevo desde hace unas pocas semanas/meses en el mundo de la domótica.
Inicialmente compré un par de enchufes Orvibo S20 para probar el funcionamiento a través del móvil. La verdad que funcionan regular en local y fatal a través de Internet.
Entonces me decidí por Z-Wave. Aunque tengo algunos Raspberry, el hardware que estoy empleando es un miniPC PIPO X7 con Windows 10 y el adaptador Z-Wave de Sigma.
Algunos de los dispositivos que tengo son Medidor de consumo eléctrico G2 de Aeon Labs, Detector de Movimiento multifunción de Fibaro, Regleta de 6 enchufes Greenwave y algunos módulos ocultos de Fibaro.
El caso es que a raíz de buscar en Internet sobre la posibilidad de comunicarme con los enchufes Orvibo S20 a través de la red local, me encontré el blog de stikonas (https://stikonas.eu/wordpress/2015/02/2 ... 20-socket/) con información muy útil y una aplicación para Windows por línea de comandos muy útil. Estuve un tiempo haciendo pruebas en PHP pero no conseguí comunicarme directamente con el enchufe para poderlo encender y apagar. Estos días he estado buscando nuevamente información en Google y me he topado con 2 enlaces muy interesantes que me han permitido, haciendo unas modificaciones, integrar los enchufes Orvibo S20 a Domoticz.
- Primero me encontré con el repositorio GitHub de pcp135 / Orvibo https://github.com/pcp135/Orvibo donde con un sencillo script y aprovechando su clase programada, conseguí crear un Interruptor virtual en Domoticz que me permitía encender y apagar el enchufe al momento!
- Y gracias al de sergejey / majordomo-orvibo https://github.com/sergejey/majordomo-orvibo pude realizar otras modificaciones aprovechando su código para actualizar el estado real del enchufe a Domoticz por si se cambia el estado manualmente/físicamente en el Orvibo S20.
Ahora mismo todo el código está muy sucio ya que no dispongo de mucho tiempo pero si alguien está interesado porque tiene algún S20 por casa que le quiere dar uso, que me lo indique y pongo el código (tan pronto como lo limpie un poco) y pasos a seguir.
Lo interesante de esto es que permite ahorrar un dinero en el tema domótico ya que estos enchufes sin control de consumo (no siempre es necesario) están a 20$.
¡Un cordial saludo a todos!
Initially I bought a pair of Orvibo S20 plugs to test the operation through mobile. The truth is that local operation is so-so and thru Internet is very bad.
So I opted for Z-Wave protocol. Although I have some Raspberry Pi, the hardware that I'm using is a miniPC PIPO X7 with Windows 10 and Sigma Z-Wave adapter.
Some of the devices that I have are power consumption meter G2 from Aeon Labs, Multifunctional Movement Detector from Fibaro, power strip 6 outlets from Greenwave and some Fibaro hidden modules.
The fact is that as a result of searching on Internet about the possibility of communicating with plugs Orvibo S20 through the local network, I found the stikonas blog (https://stikonas.eu/wordpress/2015/02/2 ... 20-socket/) with useful information and a Windows application for command line. I spent some time testing in PHP but I could not communicate directly with the plug to turn on and off. These days I have been searching new information on Google again and I've run into two very interesting links that allowed me, with some modifications, to integrate Orvibo S20 plugs to Domoticz.
- First, I found the GitHub repository of pcp135 / Orvibo https://github.com/pcp135/Orvibo where with a simple scripting and using their programmed class, I managed to create a virtual switch that allowed me on Domoticz to turn on and off the plug!
- And thanks to sergejey / majordomo-orvibo https://github.com/sergejey/majordomo-orvibo I could make other changes using their code to update the actual/real status of the plugs to Domoticz when the status is changed manually / physically in the Orvibo S20.
The code is very dirty because I do not have much time but if anyone is interested in it and has some S20 at home you want to use, tell me and I will put the code (as soon as I clean a little) and steps.
The interesting thing is that it saves money in the automation as these plugs (uncontrolled consumption, not always necessary) are 20$ each.
Regards to all!
---
Spanish:
Hola a todos, mi nombre es Eduardo y llevo desde hace unas pocas semanas/meses en el mundo de la domótica.
Inicialmente compré un par de enchufes Orvibo S20 para probar el funcionamiento a través del móvil. La verdad que funcionan regular en local y fatal a través de Internet.
Entonces me decidí por Z-Wave. Aunque tengo algunos Raspberry, el hardware que estoy empleando es un miniPC PIPO X7 con Windows 10 y el adaptador Z-Wave de Sigma.
Algunos de los dispositivos que tengo son Medidor de consumo eléctrico G2 de Aeon Labs, Detector de Movimiento multifunción de Fibaro, Regleta de 6 enchufes Greenwave y algunos módulos ocultos de Fibaro.
El caso es que a raíz de buscar en Internet sobre la posibilidad de comunicarme con los enchufes Orvibo S20 a través de la red local, me encontré el blog de stikonas (https://stikonas.eu/wordpress/2015/02/2 ... 20-socket/) con información muy útil y una aplicación para Windows por línea de comandos muy útil. Estuve un tiempo haciendo pruebas en PHP pero no conseguí comunicarme directamente con el enchufe para poderlo encender y apagar. Estos días he estado buscando nuevamente información en Google y me he topado con 2 enlaces muy interesantes que me han permitido, haciendo unas modificaciones, integrar los enchufes Orvibo S20 a Domoticz.
- Primero me encontré con el repositorio GitHub de pcp135 / Orvibo https://github.com/pcp135/Orvibo donde con un sencillo script y aprovechando su clase programada, conseguí crear un Interruptor virtual en Domoticz que me permitía encender y apagar el enchufe al momento!
- Y gracias al de sergejey / majordomo-orvibo https://github.com/sergejey/majordomo-orvibo pude realizar otras modificaciones aprovechando su código para actualizar el estado real del enchufe a Domoticz por si se cambia el estado manualmente/físicamente en el Orvibo S20.
Ahora mismo todo el código está muy sucio ya que no dispongo de mucho tiempo pero si alguien está interesado porque tiene algún S20 por casa que le quiere dar uso, que me lo indique y pongo el código (tan pronto como lo limpie un poco) y pasos a seguir.
Lo interesante de esto es que permite ahorrar un dinero en el tema domótico ya que estos enchufes sin control de consumo (no siempre es necesario) están a 20$.
¡Un cordial saludo a todos!
-
- Posts: 890
- Joined: Tuesday 30 September 2014 8:49
- Target OS: Linux
- Domoticz version: beta
- Location: The Netherlands
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
Nice, but these are only switches right? Or do they also measure current consumption?
I am using a Ubiquiti plug which works over wifi and can switch the outlet, but can also measure the energy consumption of the attached load.
Works fine, see my post here: http://domoticz.com/forum/viewtopic.php ... 124#p50124
I am using a Ubiquiti plug which works over wifi and can switch the outlet, but can also measure the energy consumption of the attached load.
Works fine, see my post here: http://domoticz.com/forum/viewtopic.php ... 124#p50124
I am not active on this forum anymore.
-
- Posts: 10
- Joined: Saturday 26 September 2015 16:33
- Target OS: Windows
- Domoticz version:
- Location: Spain
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
I did not know the ubiquiti plugs.
The Orvibo S20 does not measure consumption but It is always interesting to know the different possibilities we have to connect different devices to Domoticz.
In my case, I already had before Domoticz these plugs so I can now make good use of
The Orvibo S20 does not measure consumption but It is always interesting to know the different possibilities we have to connect different devices to Domoticz.
In my case, I already had before Domoticz these plugs so I can now make good use of
-
- Posts: 2
- Joined: Monday 28 September 2015 22:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
Hola Eduardo. Yo estoy recién llegado a esto de la demótica y me interesaría echar un vistazo a tu código para manejar el orvibo s20 desde Domoticz
gracias por adelantado y un saludo
gracias por adelantado y un saludo
- mvveelen
- Posts: 678
- Joined: Friday 31 October 2014 10:22
- Target OS: NAS (Synology & others)
- Domoticz version: Beta
- Location: Hoorn, The Netherlands
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
Hi dcazorla, could you please post in English next time ?
i ran it through Google translate:
Hello Eduardo. I am a newcomer to this the demotic and I would be interested to look at your code to handle the orvibo s20 from Domoticz
thanks in advance and greetings
i ran it through Google translate:
Hello Eduardo. I am a newcomer to this the demotic and I would be interested to look at your code to handle the orvibo s20 from Domoticz
thanks in advance and greetings
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
-
- Posts: 2
- Joined: Monday 28 September 2015 22:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
sorry mvveelen ... i was so excited ... that i forgot to write in english.
Re: Orvibo S20 plugs integrated successfully into Domoticz!
Please man ... share your code
-
- Posts: 10
- Joined: Saturday 26 September 2015 16:33
- Target OS: Windows
- Domoticz version:
- Location: Spain
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
Hi again!
I'm cleaning a little the code. In a couple of days I will publish here the code and a little readme.
Meanwhile tell me your configuration about your Domoticz and how many orvibo s20 do you have!
The code is in PHP and for convenience you will need apache+php (to call a local URL). In Windows I usually use XAMPP. I think you will have to change the SSL port to XAMPP to start. And the standard port 80 is fine if you have the Domoticz installation in port 8080, or viceversa.
Regards!
I'm cleaning a little the code. In a couple of days I will publish here the code and a little readme.
Meanwhile tell me your configuration about your Domoticz and how many orvibo s20 do you have!
The code is in PHP and for convenience you will need apache+php (to call a local URL). In Windows I usually use XAMPP. I think you will have to change the SSL port to XAMPP to start. And the standard port 80 is fine if you have the Domoticz installation in port 8080, or viceversa.
Regards!
-
- Posts: 10
- Joined: Saturday 26 September 2015 16:33
- Target OS: Windows
- Domoticz version:
- Location: Spain
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
[Documentación en inglés y español]
Orvibo S20 Domoticz
======================
I made some slight modifications to adapt the PHP programming code from third parties to Domoticz.
Thanks for the code to pcp135 / Orvibo https://github.com/pcp135/Orvibo (Orvibo Class for switching plugs) and
sergejey / butler-orvibo https://github.com/sergejey/majordomo-orvibo (code to obtain the status)
The work I did was test the code of pcp135 to get it to work and create a small script to communicate with Domoticz.
On the code of sergejey what I did was break a bit the code by removing a lot of to get communication with switchs to know the status and send it to Domoticz.
Since I do not have time, I can not improve it, clean it and put everything in a nice class, but the important thing is that it works.
NEEDS
---------
Its need Apache + PHP on the same machine as Domoticz. In my case, it is a Windows Domoticz on port 8080. I installed XAMPP on port 80 and 444 (SSL 443 was busy and Apache did not start).
Important: S20 Orvibo outlets must be previously configured for the network that will work.
THE CODE
--------
The code consists of two parts:
1. Orvibo.php and s20.php
With these codes, we can turn on and off Orvibo plugs S20.
We must know the MAC address of the socket (you can use any network scanning as netscan program or command line program from Andrius Štikonas https://stikonas.eu/wordpress/2015/02/2 ... 20-socket/ or perhaps even the other side of the module).
Create the folder s20 in the root of our apache server and copy the files. It will use the URL:
http://IP-DOMOTICZ/s20/s20.php?mac=accf ... &accion=on
http://IP-DOMOTICZ/s20/s20.php?mac=accf ... accion=off
At this point you must turn on and off quickly any plug.
2. cron.php and cron.bat (windows)
This code is responsible for launching a status request to the network by UDP port 10000 and listening for a response, it generates an array and sends the status of the plugs to Domoticz. This is needed if we turn on the plug or turn off manually and want to update their status to Domoticz (JSON).
We can try to launch the URL and it should return debug code.
http://IP-DOMOTICZ/s20/cron.php
USE DOMOTICZ
--------
Step 1: Create a virtual switch through Setup > Hardware.
Name: Orvibo
Type: Dummy
Step 2: Create as many virtual switches and outlets Orvibo S20 we have (remember that plugs should already be pre-configured and running on your network), assign them a name and write down IDX (Setup > Devices).
We have our dummy plugs that do absolutely nothing.
Step 3: Include switches and assign a name through Setup > Devices > (Arrow). The switches will appear in Switches section but still does not work.
Step 4: Editing a plug and fill On Action and Off Action with:
http://localhost/s20/s20.php?mac=MACADDRESS01&accion=on
http://localhost/s20/s20.php?mac=MACADD ... accion=off
Where MACADDRESS01 is the MAC address of the plug we are configurin and have previously tried before throwing the URL and worked OK.
Save it.
At this moment our plug works! Turns on and off quickly. We can make rules and play with it.
Now you must run the CRON if the state outlet outside Domoticz changes manually. This requires modifying the PHP and configure it. I have set the CRON every 5 minutes (in my Windows machine).
CONFIGURATION
------
cron.php must be configured manually to update the state correctly to Domoticz JSON.
To do this, edit the cron.php and modify the lines regarding:
$domoticz_server > the base URL of Domoticz, for example http://localhost:8080
and several lines
$mienchufe['accf23514ddd'] = '106'; // Description ddd
$mienchufe['accf23514eee'] = '107'; // Description eee
which it is an array with the MAC address and the IDX assigned to the virtual plug in Domoticz.
Chim Pum!
Eduardo Pagán
http://blog.eduardopagan.com/
Orvibo S20 a Domoticz
======================
He hecho algunas modificaciones y pequeñas programaciones para adaptar el código PHP de terceros a Domoticz.
Gracias por el código a pcp135 / Orvibo https://github.com/pcp135/Orvibo (Clase Orvibo para encender y apagar los enchufes) y
sergejey / mayordomo-orvibo https://github.com/sergejey/majordomo-orvibo (código para conocer el estado de los mismos)
El trabajo que hice fue probar el código pcp135 hasta conseguir que funcionara y crear un pequeño script para la comunicación con Domoticz.
Sobre el código de sergejey lo que hice fue romperlo un poco quitando mucho código hasta conseguir la comunicación con los enchufes para saber el estado y enviarlo a Domoticz.
Como no dispongo de tiempo, no puedo mejorarlo, limpiarlo y meterlo todo en una bonita clase, pero lo importante es que funciona.
NECESIDADES
---------
Lo más cómodo es disponer de Apache+PHP en la misma máquina que Domoticz. En mi caso, es un Windows con Domoticz en el puerto 8080. He instalado XAMPP en el puerto 80 y 444 (ya que el 443 SSL estaba ocupado y no iniciaba).
Importante: Los enchufes de Orvibo S20 previamente deben de estar configurados para la red en la que vamos a trabajar.
EL CÓDIGO
--------
El código consta de dos partes:
1. Orvibo.php y s20.php
Con estos códigos, podemos encender y apagar los enchufes Orvibo S20.
Debemos conocer la dirección MAC del enchufe (podemos utilizar algún programa escaneo de red como netscan o el programa de línea de comandos de Andrius Štikonas https://stikonas.eu/wordpress/2015/02/2 ... 20-socket/ o quizás incluso la otra parte del módulo).
Crearemos la carpeta s20 dentro de la raíz de nuestro servidor apache y copiaremos los ficheros y emplearemos la URL:
http://IP-DOMOTICZ/s20/s20.php?mac=accf ... &accion=on
http://IP-DOMOTICZ/s20/s20.php?mac=accf ... accion=off
En este punto se debe encender y apagar con rapidez.
2. cron.php y cron.bat (windows)
Este código se encarga de lanzar una petición de estado a la red por UDP puerto 10000 y se queda escuchando la respuesta, genera un array y envía el estado de los enchufes a Domoticz. Esto es por si encendemos el enchufe o lo apagamos de forma manual y queremos que se actualice su estado en Domoticz por JSON.
Podemos probar a lanzar la URL y debería de retornar código debug.
http://IP-DOMOTICZ/s20/cron.php
USO EN DOMOTICZ
--------
Paso 1: Creamos un interruptor virtual a través de Setup > Hardware.
Nombre: Orvibo
Tipo: Dummy
Paso 2: Creamos tantos interruptores virtuales como enchufes Orvibo S20 tengamos (recuerdo que ya deben estar preconfigurados y funcionando en la red), les asignamos un nombre y nos anotamos el IDX (Setup > Devices).
Ya tenemos nuestros enchufes Dummy que no hacen absolutamente nada.
Paso 3: Los incluimos en nuestros Switches y les ponemos nombre. Nos aparecerán en Switches pero seguirán sin hacer nada.
Paso 4: Editamos un enchufe y rellenamos On Action y Off Action con:
http://localhost/s20/s20.php?mac=MACADDRESS01&accion=on
http://localhost/s20/s20.php?mac=MACADD ... accion=off
Donde MACADDRESS01 es la dirección MAC de ese enchufe y que previamente hemos probado antes lanzando a mano la URL y funcionaba OK.
Guardamos.
¡Desde este momento nuestro enchufe ya funciona! Enciende y apaga rápidamente. Ya podemos hacer reglas y jugar con él.
Ahora hay que ejecutar el CRON por si se modifica el estado del enchufe de forma física fuera de Domoticz. Para ello hay que modificar el PHP y configurarlo. Yo he puesto el CRON cada 5 minutos en Windows. Cada uno que lo haga como quiera (si no se sabe, buscar en Google).
Si se utiliza el .bat habrá que modificar las rutas.
CONFIGURACIÓN
------
En el caso del cron.php hay que configurarlo de forma manual para que actualice el estado correctamente a Domoticz por JSON.
Para ello editamos el cron.php y modificamos las líneas referentes a:
$domoticz_server donde indicaremos la URL base de Domoticz, por ejemplo http://localhost:8080
y varias líneas de
$mienchufe['accf23514ddd'] = '106'; // Description
$mienchufe['accf23514eee'] = '107'; // Description
que es un array donde se indica la MAC y la IDX asignada en Domoticz a ese enchufe virtual.
Chim pum!
Eduardo Pagán
http://blog.eduardopagan.com/
Orvibo S20 Domoticz
======================
I made some slight modifications to adapt the PHP programming code from third parties to Domoticz.
Thanks for the code to pcp135 / Orvibo https://github.com/pcp135/Orvibo (Orvibo Class for switching plugs) and
sergejey / butler-orvibo https://github.com/sergejey/majordomo-orvibo (code to obtain the status)
The work I did was test the code of pcp135 to get it to work and create a small script to communicate with Domoticz.
On the code of sergejey what I did was break a bit the code by removing a lot of to get communication with switchs to know the status and send it to Domoticz.
Since I do not have time, I can not improve it, clean it and put everything in a nice class, but the important thing is that it works.
NEEDS
---------
Its need Apache + PHP on the same machine as Domoticz. In my case, it is a Windows Domoticz on port 8080. I installed XAMPP on port 80 and 444 (SSL 443 was busy and Apache did not start).
Important: S20 Orvibo outlets must be previously configured for the network that will work.
THE CODE
--------
The code consists of two parts:
1. Orvibo.php and s20.php
With these codes, we can turn on and off Orvibo plugs S20.
We must know the MAC address of the socket (you can use any network scanning as netscan program or command line program from Andrius Štikonas https://stikonas.eu/wordpress/2015/02/2 ... 20-socket/ or perhaps even the other side of the module).
Create the folder s20 in the root of our apache server and copy the files. It will use the URL:
http://IP-DOMOTICZ/s20/s20.php?mac=accf ... &accion=on
http://IP-DOMOTICZ/s20/s20.php?mac=accf ... accion=off
At this point you must turn on and off quickly any plug.
2. cron.php and cron.bat (windows)
This code is responsible for launching a status request to the network by UDP port 10000 and listening for a response, it generates an array and sends the status of the plugs to Domoticz. This is needed if we turn on the plug or turn off manually and want to update their status to Domoticz (JSON).
We can try to launch the URL and it should return debug code.
http://IP-DOMOTICZ/s20/cron.php
USE DOMOTICZ
--------
Step 1: Create a virtual switch through Setup > Hardware.
Name: Orvibo
Type: Dummy
Step 2: Create as many virtual switches and outlets Orvibo S20 we have (remember that plugs should already be pre-configured and running on your network), assign them a name and write down IDX (Setup > Devices).
We have our dummy plugs that do absolutely nothing.
Step 3: Include switches and assign a name through Setup > Devices > (Arrow). The switches will appear in Switches section but still does not work.
Step 4: Editing a plug and fill On Action and Off Action with:
http://localhost/s20/s20.php?mac=MACADDRESS01&accion=on
http://localhost/s20/s20.php?mac=MACADD ... accion=off
Where MACADDRESS01 is the MAC address of the plug we are configurin and have previously tried before throwing the URL and worked OK.
Save it.
At this moment our plug works! Turns on and off quickly. We can make rules and play with it.
Now you must run the CRON if the state outlet outside Domoticz changes manually. This requires modifying the PHP and configure it. I have set the CRON every 5 minutes (in my Windows machine).
CONFIGURATION
------
cron.php must be configured manually to update the state correctly to Domoticz JSON.
To do this, edit the cron.php and modify the lines regarding:
$domoticz_server > the base URL of Domoticz, for example http://localhost:8080
and several lines
$mienchufe['accf23514ddd'] = '106'; // Description ddd
$mienchufe['accf23514eee'] = '107'; // Description eee
which it is an array with the MAC address and the IDX assigned to the virtual plug in Domoticz.
Chim Pum!
Eduardo Pagán
http://blog.eduardopagan.com/
Orvibo S20 a Domoticz
======================
He hecho algunas modificaciones y pequeñas programaciones para adaptar el código PHP de terceros a Domoticz.
Gracias por el código a pcp135 / Orvibo https://github.com/pcp135/Orvibo (Clase Orvibo para encender y apagar los enchufes) y
sergejey / mayordomo-orvibo https://github.com/sergejey/majordomo-orvibo (código para conocer el estado de los mismos)
El trabajo que hice fue probar el código pcp135 hasta conseguir que funcionara y crear un pequeño script para la comunicación con Domoticz.
Sobre el código de sergejey lo que hice fue romperlo un poco quitando mucho código hasta conseguir la comunicación con los enchufes para saber el estado y enviarlo a Domoticz.
Como no dispongo de tiempo, no puedo mejorarlo, limpiarlo y meterlo todo en una bonita clase, pero lo importante es que funciona.
NECESIDADES
---------
Lo más cómodo es disponer de Apache+PHP en la misma máquina que Domoticz. En mi caso, es un Windows con Domoticz en el puerto 8080. He instalado XAMPP en el puerto 80 y 444 (ya que el 443 SSL estaba ocupado y no iniciaba).
Importante: Los enchufes de Orvibo S20 previamente deben de estar configurados para la red en la que vamos a trabajar.
EL CÓDIGO
--------
El código consta de dos partes:
1. Orvibo.php y s20.php
Con estos códigos, podemos encender y apagar los enchufes Orvibo S20.
Debemos conocer la dirección MAC del enchufe (podemos utilizar algún programa escaneo de red como netscan o el programa de línea de comandos de Andrius Štikonas https://stikonas.eu/wordpress/2015/02/2 ... 20-socket/ o quizás incluso la otra parte del módulo).
Crearemos la carpeta s20 dentro de la raíz de nuestro servidor apache y copiaremos los ficheros y emplearemos la URL:
http://IP-DOMOTICZ/s20/s20.php?mac=accf ... &accion=on
http://IP-DOMOTICZ/s20/s20.php?mac=accf ... accion=off
En este punto se debe encender y apagar con rapidez.
2. cron.php y cron.bat (windows)
Este código se encarga de lanzar una petición de estado a la red por UDP puerto 10000 y se queda escuchando la respuesta, genera un array y envía el estado de los enchufes a Domoticz. Esto es por si encendemos el enchufe o lo apagamos de forma manual y queremos que se actualice su estado en Domoticz por JSON.
Podemos probar a lanzar la URL y debería de retornar código debug.
http://IP-DOMOTICZ/s20/cron.php
USO EN DOMOTICZ
--------
Paso 1: Creamos un interruptor virtual a través de Setup > Hardware.
Nombre: Orvibo
Tipo: Dummy
Paso 2: Creamos tantos interruptores virtuales como enchufes Orvibo S20 tengamos (recuerdo que ya deben estar preconfigurados y funcionando en la red), les asignamos un nombre y nos anotamos el IDX (Setup > Devices).
Ya tenemos nuestros enchufes Dummy que no hacen absolutamente nada.
Paso 3: Los incluimos en nuestros Switches y les ponemos nombre. Nos aparecerán en Switches pero seguirán sin hacer nada.
Paso 4: Editamos un enchufe y rellenamos On Action y Off Action con:
http://localhost/s20/s20.php?mac=MACADDRESS01&accion=on
http://localhost/s20/s20.php?mac=MACADD ... accion=off
Donde MACADDRESS01 es la dirección MAC de ese enchufe y que previamente hemos probado antes lanzando a mano la URL y funcionaba OK.
Guardamos.
¡Desde este momento nuestro enchufe ya funciona! Enciende y apaga rápidamente. Ya podemos hacer reglas y jugar con él.
Ahora hay que ejecutar el CRON por si se modifica el estado del enchufe de forma física fuera de Domoticz. Para ello hay que modificar el PHP y configurarlo. Yo he puesto el CRON cada 5 minutos en Windows. Cada uno que lo haga como quiera (si no se sabe, buscar en Google).
Si se utiliza el .bat habrá que modificar las rutas.
CONFIGURACIÓN
------
En el caso del cron.php hay que configurarlo de forma manual para que actualice el estado correctamente a Domoticz por JSON.
Para ello editamos el cron.php y modificamos las líneas referentes a:
$domoticz_server donde indicaremos la URL base de Domoticz, por ejemplo http://localhost:8080
y varias líneas de
$mienchufe['accf23514ddd'] = '106'; // Description
$mienchufe['accf23514eee'] = '107'; // Description
que es un array donde se indica la MAC y la IDX asignada en Domoticz a ese enchufe virtual.
Chim pum!
Eduardo Pagán
http://blog.eduardopagan.com/
- Attachments
-
- orvibo-s20-domoticz.zip
- Orvibo S20 Domoticz - adaptación por Antikton
- (15.97 KiB) Downloaded 599 times
Orvibo S20 plugs integrated successfully into Domoticz!
On/off php file are not working for me.(shows on and of but nothing else matters XD ). Do you know if the name of the device is HF-LPB100?
FYI: ping to that device is working OK
FYI: ping to that device is working OK
-
- Posts: 10
- Joined: Saturday 26 September 2015 16:33
- Target OS: Windows
- Domoticz version:
- Location: Spain
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
Hi Pepo,
Tell me your configuration and how do you call the PHP (via browser?) ?
I understand that if you can make ping is because it is configured correctly and can turn on and off via official app.
Any firewall rules blocking port 10000?
Do you have a Windows to test the compiled 32-bit and 64-bit windows binaries from Štikonas (https://stikonas.eu/wordpress/2015/02/2 ... 20-socket/)?
Tell me your configuration and how do you call the PHP (via browser?) ?
I understand that if you can make ping is because it is configured correctly and can turn on and off via official app.
Any firewall rules blocking port 10000?
Do you have a Windows to test the compiled 32-bit and 64-bit windows binaries from Štikonas (https://stikonas.eu/wordpress/2015/02/2 ... 20-socket/)?
Re: Orvibo S20 plugs integrated successfully into Domoticz!
I call it via browser. It works ok using oficial iphone app and the 64bit version of stikonas. So I think that firewall is not he problem. The php server is a Synology nas
-
- Posts: 10
- Joined: Saturday 26 September 2015 16:33
- Target OS: Windows
- Domoticz version:
- Location: Spain
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
I will not dismiss a firewall issue since you have make test outside the NAS (app, exe,...). I dont know the Synologic NAS. Does this NAS have a firewall or something else?
Can you access to Apache/PHP error log? Can you test in a real PC?
Can you access to Apache/PHP error log? Can you test in a real PC?
Re: Orvibo S20 plugs integrated successfully into Domoticz!
I will be your beta tester ... tomorrow I will install a Wamp to test it. I'll keep in touch.
-
- Posts: 10
- Joined: Saturday 26 September 2015 16:33
- Target OS: Windows
- Domoticz version:
- Location: Spain
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
Hi Pepo, did you make the test?
-
- Posts: 41
- Joined: Monday 19 October 2015 12:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Spain
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
Hi!
It works but the command in tutorial is wrong.
Try this...
http://localhost/s20/s20.php?ip=XXX.XXX ... &accion=on
and
http://localhost/s20/s20.php?ip=XXX.XXX ... accion=off
Scpecify IP address is the key.
http://yourwebserverip/s20folder/s20.php?
+
ip=XXX.XXX.XXX.XXX
+
mac=XXXXXXXXXXXXX
+
accion=on or off
Greetings from spain.
It works but the command in tutorial is wrong.
Try this...
http://localhost/s20/s20.php?ip=XXX.XXX ... &accion=on
and
http://localhost/s20/s20.php?ip=XXX.XXX ... accion=off
Scpecify IP address is the key.
http://yourwebserverip/s20folder/s20.php?
+
ip=XXX.XXX.XXX.XXX
+
mac=XXXXXXXXXXXXX
+
accion=on or off
Greetings from spain.
-
- Posts: 5
- Joined: Sunday 25 October 2015 13:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
Hello,
I can fill the 'link' into a browser and i get a response from the script.
Even the socket if working write.
I've set a cronjob every minute for the cron.php.
That part is not working properly.
I've insert the IDX and mac adress, even the server ip is good. What can be te problem?
I've installed domoticz on my raspberry.
I can fill the 'link' into a browser and i get a response from the script.
Even the socket if working write.
I've set a cronjob every minute for the cron.php.
That part is not working properly.
I've insert the IDX and mac adress, even the server ip is good. What can be te problem?
I've installed domoticz on my raspberry.
-
- Posts: 41
- Joined: Monday 19 October 2015 12:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Spain
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
Hi!
Check the installed php packages.
Try..
sudo apt-get install php5 php5-cgi php5-cli php5-common php5-mysql
Greetings from spain
Check the installed php packages.
Try..
sudo apt-get install php5 php5-cgi php5-cli php5-common php5-mysql
Greetings from spain
-
- Posts: 10
- Joined: Saturday 26 September 2015 16:33
- Target OS: Windows
- Domoticz version:
- Location: Spain
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
Hello,
satanasinc, I have not to insert the IP, it uses a generic broadcast IP and it should be enough; but if with the IP works... perfect!
490123, when you say "Even the socket if working write", did you mean "Even the socket is working fine"??
The cronjob is "optional" only in the case that you usually change the status of the socket physically.
What is the response of the cron.php via browser?
satanasinc, I have not to insert the IP, it uses a generic broadcast IP and it should be enough; but if with the IP works... perfect!
490123, when you say "Even the socket if working write", did you mean "Even the socket is working fine"??
The cronjob is "optional" only in the case that you usually change the status of the socket physically.
What is the response of the cron.php via browser?
-
- Posts: 5
- Joined: Sunday 25 October 2015 13:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Orvibo S20 plugs integrated successfully into Domoticz!
Antikton; Yes, I'm sorry. The socket is working fine...
The cronjob is for me important because the socket sometimes is used manually. (physic button on the socket)
-------------------------------
This is the response of the cron.php:
Socket created Socket bind (0.0.0.0:10000) OK 19:00:57 Discover timeout, rediscovering ... 19:00:58 Discovering ... 19:00:58 Sending multicast: 686400067161 19:00:58 Waiting for data ... 19:00:58 192.168.1.240 : 686400067161 19:00:58 Waiting for data ... 19:00:58 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035d9e8d8d900 19:00:58 MAC: accf234b64e2 Command: 7161 19:00:58 Discover reply from accf234b64e2 Socket - accf234b64e2 19:00:58 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:00:58 Waiting for data ... 19:01:08 Need discover flag set ... 19:01:08 Discovering ... 19:01:08 Sending multicast: 686400067161 19:01:08 Waiting for data ... 19:01:08 192.168.1.240 : 686400067161 19:01:08 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 Array ( [accf234b64e2] => 0 )
-------------------------
FYI: There are 3 sockets set in the cron.php.
The cronjob is for me important because the socket sometimes is used manually. (physic button on the socket)
-------------------------------
This is the response of the cron.php:
Socket created Socket bind (0.0.0.0:10000) OK 19:00:57 Discover timeout, rediscovering ... 19:00:58 Discovering ... 19:00:58 Sending multicast: 686400067161 19:00:58 Waiting for data ... 19:00:58 192.168.1.240 : 686400067161 19:00:58 Waiting for data ... 19:00:58 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035d9e8d8d900 19:00:58 MAC: accf234b64e2 Command: 7161 19:00:58 Discover reply from accf234b64e2 Socket - accf234b64e2 19:00:58 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:00:58 Waiting for data ... 19:01:08 Need discover flag set ... 19:01:08 Discovering ... 19:01:08 Sending multicast: 686400067161 19:01:08 Waiting for data ... 19:01:08 192.168.1.240 : 686400067161 19:01:08 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 19:01:09 Waiting for data ... 19:01:09 192.168.1.70 : 6864002a716100accf234b64e2202020202020e2644b23cfac202020202020534f43303035e4e8d8d900 19:01:09 MAC: accf234b64e2 Command: 7161 19:01:09 Discover reply from accf234b64e2 Socket - accf234b64e2 19:01:09 Sending subscribe request: 6864001e636caccf234b64e2202020202020e2644b23cfac202020202020 Array ( [accf234b64e2] => 0 )
-------------------------
FYI: There are 3 sockets set in the cron.php.
Who is online
Users browsing this forum: Eugene and 1 guest