cherezov / orvibo Goto Github PK
View Code? Open in Web Editor NEWPython module to controll Orvibo devices, such as s20 wifi sockets and AllOne IR blasters
License: MIT License
Python module to controll Orvibo devices, such as s20 wifi sockets and AllOne IR blasters
License: MIT License
It is work grab IR and send Ir code but after 5 time send It i have this error:
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Mar 8 19:46:46 2016 from 192.168.1.21
root@raspberrypi:~# python /usr/share/openhab/addons/orvibo.py -i 192.168.1.26 -t /usr/share/openhab/addons/ir/test.ir
Traceback (most recent call last):
File "/usr/share/openhab/addons/orvibo.py", line 519, in
d = Orvibo.discover(ip)
File "/usr/share/openhab/addons/orvibo.py", line 241, in discover
with _orvibo_socket() as s:
File "/usr/lib/python2.7/contextlib.py", line 17, in enter
return self.gen.next()
File "/usr/share/openhab/addons/orvibo.py", line 99, in _orvibo_socket
sock.bind(('', PORT))
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use
Hi,
If I use orvibo.py in Console mode it works good, the AllOne works and beams.
I am trying to use it as a module to eliminate the long lag so I need to activate the keep_connection option.
But it doesn't work :(
After instantiated the orvibo object, I set up the keep_connect to true but I get an error:
running this:
import orvibo
from orvibo.orvibo import Orvibo
orv = Orvibo('192.168.168.115','accf232991f4', 'irda')
orv.keep_connection = True
I get :
File "test.py", line 7, in
orv.keep_connection = True
File "/Users/riccardo/orviboServer/orvibo/orvibo/orvibo.py", line 309, in keep_connection
if self.__subscribe(self.__socket) is None:
File "/Users/riccardo/orviboServer/orvibo/orvibo/orvibo.py", line 382, in __subscribe
subscr_packet.send(s)
File "/Users/riccardo/orviboServer/orvibo/orvibo/orvibo.py", line 191, in send
sock.sendto(bytearray(self.data), (self.ip, PORT))
OSError: [Errno 56] Socket is already connected
python version:
Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 08:49:46)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
RIc
root@raspberrypi:/var/www/html# python orvibo.py -i 192.168.10.78 -e test.ir
Orvibo[type=irda, ip=192.168.10.78, mac=accf23794678]
Sometimes it does not work
I see in readme support for python 2.7. And actually have only python 2.7 in my openhab docker container.
[x] Consider python 2.7 support
I tested script with python 2.7 and its behavior is unpredictable, but no errors in console. Below example how i recorded 3 commands
~$ python -V
Python 2.7.12
$ python /var/openhab/orvibo/orvibo.py -L debug -i 192.168.0.53 -m accf232aeee6 -x irda -t /var/openhab/orvibo/power2.ir
Orvibo[type=irda, ip=192.168.0.53, mac=accf232aeee6]
DEBUG:[email protected]:Entering to Learning IR/RF433 mode
INFO:[email protected]:Waiting 15 sec for IR/RF433 signal...
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
INFO:[email protected]:The rest time: 14 sec
INFO:[email protected]:The rest time: 13 sec
INFO:[email protected]:The rest time: 12 sec
DEBUG:[email protected]:SUCCESS:
MAGIC + 01c2 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 02a801 + ZEROS_4 + a801 + ZEROS_4 + + ZEROS_4 + 98011e11e711ec01c206d101c406ec01c306d201ac02eb017802d1017802ea015f02ec019102eb01c306d201c306ec01c206d201ac02ea017802d0017802ec015d02ec01ab02d1017802d101dd06d2017802d001ad02ec017702d0017802ea016802e3019102ec01c206ed015d02ea01c306d201f706eb01c406d201c306ec01c306d001c406ec0142b811110212d101c406ed01c206d201c206ed01ab02d1017802eb017702d1017802cf01ae02d101c306ed01c206d101c406eb01ad02cf017902eb017702cf017902d201ab02ec015c02ea01c406ea015f02ec01ac02d2017702ec017702d2017702d101ac02d101de06d0017902d101c306ed01f606d001c506eb01c406d201c206ed01c206d10146b82911ec11ed01c206d101c406ec01c306d201ac02eb017802d2017702ec015d02ec019102ea01c406d101c406ed01c206d101ad02ec017702d1017802ec015d02eb01ad02d0017902d001aa0605027802d101ab02e9017902d9017002ec015c02eb019202eb01c306ed015c02e901c506d201f706ed01c206d101c406ed01c206d001c406ea010000
INFO:[email protected]:IR/RF433 signal got successfuly and saved to "/var/openhab/orvibo/power2.ir" file
Teach IR done
$ python /var/openhab/orvibo/orvibo.py -L debug -i 192.168.0.53 -m accf232aeee6 -x irda -t /var/openhab/orvibo/volume-up2.irOrvibo[type=irda, ip=192.168.0.53, mac=accf232aeee6]
DEBUG:[email protected]:Entering to Learning IR/RF433 mode
INFO:[email protected]:Waiting 15 sec for IR/RF433 signal...
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
INFO:[email protected]:The rest time: 14 sec
INFO:[email protected]:The rest time: 13 sec
INFO:[email protected]:The rest time: 12 sec
DEBUG:[email protected]:SUCCESS:
MAGIC + 013a + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 022001 + ZEROS_4 + 2001 + ZEROS_4 + + ZEROS_4 + 10012f11d01106028f0620028f0606028f06200278020502440239022a02060244020502780206028e0621028e0607028e06210277020502430239022a02060243020602770206028f0621028e0607028e0621027702060243023a022a021d022c02060277022102430206024202210228022002c30607028e0621028e061e02760621028e060702a9b74811ce1108028d0623028c0607028d06240275020802410222024102080241020702760207028d0623028c0608028d06230275020702420222024102070242020a02730207028d0623028c0608028d0623027502080242022202410207024202070276022202410207024202220227022202c10607028e0622028e0607028f0621028e0606020000
INFO:[email protected]:IR/RF433 signal got successfuly and saved to "/var/openhab/orvibo/volume-up2.ir" file
Teach IR done
$ python /var/openhab/orvibo/orvibo.py -L debug -i 192.168.0.53 -m accf232aeee6 -x irda -t /var/openhab/orvibo/volume-down2.ir
Orvibo[type=irda, ip=192.168.0.53, mac=accf232aeee6]
DEBUG:[email protected]:Entering to Learning IR/RF433 mode
INFO:[email protected]:Waiting 15 sec for IR/RF433 signal...
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
DEBUG:[email protected]:Skipped:
Empty packet = MAGIC + 0018 + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 00
INFO:[email protected]:The rest time: 14 sec
INFO:[email protected]:The rest time: 13 sec
INFO:[email protected]:The rest time: 12 sec
DEBUG:[email protected]:SUCCESS:
MAGIC + 013a + LEARN_IR + accf232aeee6 + SPACES_6 + 01 + ZEROS_4 + 022001 + ZEROS_4 + 2001 + ZEROS_4 + + ZEROS_4 + 10011311e811ea01aa060602a906e901ac0606029202e901600204025f02e9015f02e9019402ea01aa061c029306eb01aa061c027b02ea015f021f0244020102480201027c02010293061c0292061c022d021c02c7061c024702010247021c022d021c027c02010247021c022d021b02920602027b02010292061c029206020292061c0292060202a7b74111d311010293061c029206010293061c027b02010248021b0247020102480201027c02010293061c029306010293061d027c02000248021c0247020102470201027c02010293061c0292061c022d021c02c6061c024702010247021b022d021b027c02010247021b022d021b02920602027c02010292061c029206020293061e02910604020000
INFO:[email protected]:IR/RF433 signal got successfuly and saved to "/var/openhab/orvibo/volume-down2.ir" file
Teach IR done
All files above has suffix 2
. I can say that above recorded commands don't work.
Also i recorded commands with python3, they don't have suffix
$ python3 -V
Python 3.5.2
Let's compare files
$ ls -l /var/openhab/orvibo
-rw-r--r-- 1 dms dms 24681 Oct 28 23:43 orvibo.py
-rw-rw-r-- 1 dms dms 426 Oct 30 10:26 power2.ir
-rw-rw-r-- 1 dms dms 426 Oct 29 23:03 power.ir
-rw-rw-r-- 1 dms dms 290 Oct 30 10:27 volume-down2.ir
-rw-rw-r-- 1 dms dms 426 Oct 29 23:03 volume-down.ir
-rw-rw-r-- 1 dms dms 290 Oct 30 10:27 volume-up2.ir
-rw-rw-r-- 1 dms dms 426 Oct 29 23:02 volume-up.ir
All commands for python3 have size 426, but 2 of 3 files for python 2.7 have size 290. Probably it's the reason.
Is it possible to fix script for 2.7?
Currently the library does not recognise it. Neither with python orvibo.py
nor python orvibo.py -i 192.168.1.X
. ---> Device ip=192.168.1.X not found in [].
.
Another test i did was:
python orvibo.py -i 192.168.1.X -m 5ccf7f2**** -x irda -t signal.ir
Orvibo[type=irda, ip=192.168.1.X, mac=5ccf7f2****]
WARNING:[email protected]:Subscription failed while entering to Learning IR/RF433 mode
Teach IR done
I was hoping they made it similar to the other IR device. But now not sure.
I tested the device with their HomeMate application on Android which works fine. But now would like to start automating things :).
Any way I could help you add support for this?
I have an orvibo allone pro working via their official app with livolo Rf switches.
Any chance to learn and emit rf signals with this library working in this setup?
Hi @cherezov !
Here's my issue: installed on MacOS device using Homebridge to control sockets following https://www.atpeaz.com/enabling-siri-and-homekit-to-work-with-orvibo-s20-smart-socket/
Repeating error causes Homebridge to be not responsive until it (I assumes) times out.
Tried offsetting polling to see if they are clashing being polled at the same time ...
Thanks in advance for your help.
Error (from Homebridge logs):
** Error repeats multiple times per hour
[9/24/2020, 10:57:55 AM] [homebridge-cmdswitch2] Failed to determine Blanket Switch state.
[9/24/2020, 10:57:55 AM] [homebridge-cmdswitch2] Traceback (most recent call last):
File "/Users/me/orvibo/orvibo/orvibo.py", line 715, in
d = Orvibo.discover(o.ip)
File "/Users/me/orvibo/orvibo/orvibo.py", line 330, in discover
with _orvibo_socket() as s:
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in enter
return self.gen.next()
File "/Users/me/orvibo/orvibo/orvibo.py", line 135, in _orvibo_socket
sock = _create_orvibo_socket() if external_socket is None else external_socket
File "/Users/me/orvibo/orvibo/orvibo.py", line 130, in _create_orvibo_socket
sock.bind((ip, PORT))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 48] Address already in use
Config:
{
"name": "homebridge-cmdswitch2",
"switches": [
{
"name": "Office Switch",
"on_cmd": "python /Users/me/orvibo/orvibo/orvibo.py -i 192.168.0.243 -s on",
"off_cmd": "python /Users/me/orvibo/orvibo/orvibo.py -i 192.168.0.243 -s off",
"state_cmd": "python /Users/me/orvibo/orvibo/orvibo.py -i 192.168.0.243 -x socket | grep -i 'Is enabled: True'",
"polling": true,
"interval": 120,
"timeout": 2000,
"manufacturer": "Orvibo",
"model": "S20",
"serial": "8675309a"
},
{
"name": "Blanket Switch",
"on_cmd": "python /Users/me/orvibo/orvibo/orvibo.py -i 192.168.0.69 -s on",
"off_cmd": "python /Users/me/orvibo/orvibo/orvibo.py -i 192.168.0.69 -s off",
"state_cmd": "python /Users/me/orvibo/orvibo/orvibo.py -i 192.168.0.69 -x socket | grep -i 'Is enabled: True'",
"polling": true,
"interval": 130,
"timeout": 2000,
"manufacturer": "Orvibo",
"model": "S20",
"serial": "8675309b"
}
],
"platform": "cmdSwitch2"
}
Hi,
First, thanks for you work. now... is it possible to learn RF codes from other brands or just orvibo products? I have a pair of Livolo switchs and a 4 button rf remote control, but the orvibo seems to ignore it.
The S31 does not respond (product link here). This seems to be because they have changed some of the response codes. Ive attached wireshark dumps to aid in any reverse engineering.
iPhone - 70:f0:87:7e:43:fc
S31 - 5c:cf:7f:9c:c7:d5
S31 2nd - 5c:cf:7f:9c:c4:ca
Nmap scan report for HomeMate_device (192.168.2.124)
Host is up (0.0051s latency).
Not shown: 65533 closed ports
PORT STATE SERVICE
5000/udp open|filtered upnp
49153/udp open|filtered unknown
MAC Address: 5C:CF:7F:9C:C7:D5 (Espressif)
Starting Nmap 7.40 ( https://nmap.org ) at 2017-03-12 12:52 EDT
Nmap scan report for 192.168.2.164
Host is up (0.16s latency).
PORT STATE SERVICE
5000/udp open|filtered upnp
49153/udp open|filtered unknown
MAC Address: 5C:CF:7F:9C:C4:CA (Espressif)
S31 discovery data load?
0000 68 64 00 5a 70 6b 5d 6c d6 1e 30 30 30 30 30 30
0010 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
0020 30 30 30 30 30 30 30 30 30 30 a0 a1 e7 b9 2c 23
0030 1f 23 96 e1 17 a8 d5 17 4d ab 51 f7 95 f0 3e e0
0040 fd 99 58 d1 67 7d 59 2e 7b 3b a6 b2 4e e5 ab 30
0050 e1 74 07 73 b1 72 68 ac b2 9e
Don't know if it is a bug but...
$ python orvibo.py
Orvibo[type=irda, ip=1xx.1xx.x.83, mac=xxxxx3565xxx]
Orvibo[type=None, ip=1xx.xx.x.3, mac=xxxxxx2e6xxx]
$ python3 orvibo.py
Orvibo[type=irda, ip=1xx.1xx.x.83, mac=Unknown]
Orvibo[type=None, ip=1xx.xx.x.3, mac=Unknown]
Hello,
I intermittently get the following error when using this to control my orvibo S20 socket when trying to turn the socket on or off.
Device ip=[ip address] not found in dict_keys
I am using Termux on my android (Android 9). Sometimes the on/off commands work fine whereas other times I get the error above (more often than not the error is returned).
I've tried searching the web for a fix but can't find any obvious reason for the error or fix.
Any particular reason(s) I am seeing this error and do you have any advice on how to fix this?
Hello,
First, thank you for writing this awesome script. It was working great for me but suddenly stopped and I can't figure out why. I assume it's something environmental but I'm an Android dev - not a python guy so I'm a bit lost. I was hoping you could maybe point me in a direction.
I had the script working fine on windows 10 with Python 3.5. It actually still works when I run it on my macbook. I also installed Python 2.7 and still no luck.
If I run python orvibo.py
it returns nothing. If I run the same thing from my macbook I get Orvibo[type=irda, ip=192.168.1.87, mac=accfblahblahblah]
I've tried variations of the command with all the parameters set and not set. I can even successfully ping the IP address from the windows machine.
Any ideas? I'm out of em and about to figure out how to debug python.
Thanks!
Zach
Hi,
Thank you for your great job! I use your script and an AlloneR1 together with Domoticz and Homebridge to control all my IR devices now in my house by Siri voice commands. However, I can't control my Blinds which run on RF433Mhz. It seems the AlloneR1 does not understand RF433 at all when I put it in learn mode and try to teach it with my Blind RF433 remote. The Orvibo red light (indicating learn mode) would never turn blue and I got timeout after 15 seconds. It would work well with a IR remote. I am sure my blinds runs on RF433Mhz. I also tried the RF433 learning successfully with a Broadlink RM Pro (similar device as Orvibo AlloneR1 but control must be via the RM bridge which runs only on Android). Please help!
Hi,
Sorry, but I'm not sure if this is a orvibo library issue or not. But I just notice that if you use a orvibo "platform" switch inside homeassistant to control a socket, and also want to control another irda orvibo (using the shell, for example), one of then will fail complaining that there's already a socket open. Is there a way to have two instances of orvibo tools running?
Hi,
I found that if I call IR emitter then call RF emitter, when it emits RF, at the same time, the last IR will be emitted as well.
Can you help to check?
Commands & Results below.
Thanks.
pi@raspberrypi:~ $ python3 /home/pi/orvibo/orvibo/orvibo.py -i MYIP -m MYMAC -x irda -e /home/pi/orvibo/orvibo/Toggle_Box.ir
Orvibo[type=irda, ip=MYIP, mac=MYMAC]
Emit IR done.
pi@raspberrypi:~ $ python3 /home/pi/orvibo/orvibo/orvibo.py -i MYIP -m MYMAC -x irda -e /home/pi/orvibo/orvibo/Light.rf -r -s on
Orvibo[type=irda, ip=MYIP, mac=MYMAC]
Emit RF done.
Hi
As there is no more EU S20 on aliexpress, do you plan to support the successor B25 soon? Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.