Page 12 of 16

Re: Python Plugin: Broadlink RM2 V3

Posted: Thursday 07 December 2017 17:14
by zak45
@hrushchov
may reason should be wrong IP address or not reachable.

@vchecco
I actually decided to use this one :
http://jarvishome.fr/index.html
Can ask for question like Room Temp / outside temp / Should it rain in next hour etc ...

Able to manage in the way I want and all stay local.

Re: Python Plugin: Broadlink RM2 V3

Posted: Saturday 09 December 2017 19:36
by MikeNg
TigroEHOT wrote: Monday 14 August 2017 6:00 If i delete the hardware and create new with 127.0.0.1 I get the discover device. If i turn it on i get this in the log:

Code: Select all

2017-08-14 13:56:05.018 User: Admin initiated a switch command (228/Broadlink RM2 - Discover/On)
2017-08-14 13:56:05.051 (Broadlink RM2) Calling message handler 'onCommand'.
2017-08-14 13:56:05.051 (Broadlink RM2) onCommand called for Unit 1: Parameter 'On', Level: 0 , Connected : False
2017-08-14 13:56:05.051 (Broadlink RM2) All plugin system is on pause for 5s...
2017-08-14 13:56:10.058 (Broadlink RM2) Found 1 broadlink devices
2017-08-14 13:56:10.071 Error: (Broadlink RM2) 'onCommand' failed 'TypeError':'sequence item 0: expected str instance, bytes found'.
2017-08-14 13:56:10.071 Error: (Broadlink RM2) ----> Line 210 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function onCommand
2017-08-14 13:56:10.071 Error: (Broadlink RM2) ----> Line 397 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function Discover
2017-08-14 13:56:10.072 Error: (Broadlink RM2) ----> Line 203 in /usr/lib/python3.5/broadlink/__init__.py, function auth
2017-08-14 13:56:10.072 Error: (Broadlink RM2) ----> Line 258 in /usr/lib/python3.5/broadlink/__init__.py, function send_packet
2017-08-14 13:56:10.072 Error: (Broadlink RM2) ----> Line 162 in /usr/lib/python3.5/broadlink/__init__.py, function encrypt_pyaes
2017-08-14 13:56:29.005 (Broadlink RM2) Calling message handler 'onHeartbeat'.
2017-08-14 13:56:29.019 Error: (Broadlink RM2) Error Connecting to Broadlink device....
I'm running domoticz 3.8288 on raspberri pi 3, python 3.5.2, broadlink 0.5

P.S. On the latest stable i get the same error.

I got the same issue and successfully fixed it. So this is what i did.
when i installed broadlink again and also crypo and copied both to the /usr/lib/python3.5 i noticed that the one in the 3.5 has no capitol C for Crypto
i tried to rename it but that did not work.
Then i looked in the folder /usr/lib/python3/dist-packages/ and there is saw Crypto with a lot more files then in the 3.5 one.
So i copied that one "sudo cp -r /usr/lib/python3/dist-packages/Crypto/ /usr/lib/python3.5/" restarted Domoticz and everything works.

Re: Python Plugin: Broadlink RM2 V3

Posted: Sunday 17 December 2017 12:35
by SzymonZy
Can we use Broadlink SP1 with this plugin already? I found protocol hack on net (https://blog.ipsumdomus.com/broadlink-s ... 0b4b397af1) but will it be implemented into Domoticz?

Re: Python Plugin: Broadlink RM2 V3

Posted: Sunday 17 December 2017 12:40
by zak45
SzymonZy wrote: Sunday 17 December 2017 12:35 Can we use Broadlink SP1 with this plugin already? I found protocol hack on net (https://blog.ipsumdomus.com/broadlink-s ... 0b4b397af1) but will it be implemented into Domoticz?
yes, the V4 is finished : could use Sp1 , sp2/sp3/sp3s, mp1, a1
publish soon.

Re: Python Plugin: Broadlink RM2 V3

Posted: Sunday 17 December 2017 12:56
by SzymonZy
Does git repository at this moment include support for this sockets?

Re: Python Plugin: Broadlink RM2 V3

Posted: Tuesday 19 December 2017 16:02
by omnisxin
hi ,zark45:
I use domoticz 3.8791, python 3.4 in raspberry pi, for attached json files ,jsonSubIr.rar is backup seven months ago,jsonSubIr.zip is backup today,all from same phone e-control app,
jsonSubIr.rar can be generated correctly, but jsonSubIr.zip informs error "Error with json files to import "

trace the error ,maybe caused by these lines in plugin.py:
try:
with open(path+"jsonIrCode") as code_name:
data_code = json.load(code_name)
except ValueError: # includes simplejson.decoder.JSONDecodeError
return False

Re: Python Plugin: Broadlink RM2 V3

Posted: Tuesday 19 December 2017 19:21
by zak45
hi omnisxin

to be able to test, I need all ini files.

Re: Python Plugin: Broadlink RM2 V3

Posted: Wednesday 20 December 2017 2:01
by omnisxin
As described ,jsonSubIr.rar can generate ini files, I'll upload later,but jsonSubIr.zip inform error, didn't generate any files.

Re: Python Plugin: Broadlink RM2 V3

Posted: Thursday 28 December 2017 12:25
by SzymonZy
@zak45 do you plan to support SC1 in V4 release?

Re: Python Plugin: Broadlink RM2 V3

Posted: Tuesday 02 January 2018 0:21
by zak45
SzymonZy wrote: Thursday 28 December 2017 12:25 @zak45 do you plan to support SC1 in V4 release?
Not yet part of the broadlink module.

Re: Python Plugin: Broadlink RM2 V3

Posted: Tuesday 02 January 2018 11:16
by SzymonZy
Are there any special circumstances that prevent adding this device in future?

Re: Python Plugin: Broadlink RM2 V3

Posted: Tuesday 02 January 2018 13:52
by zak45
SzymonZy wrote: Tuesday 02 January 2018 11:16 Are there any special circumstances that prevent adding this device in future?
don't think so... maybe you can made a request to broadlink module devloper:
https://github.com/mjg59/python-broadlink
if this become be part of it, I can try to include into the plugin.

Re: Python Plugin: Broadlink RM2 V3

Posted: Tuesday 16 January 2018 21:54
by domoticzag
Hi All,
Quick question.
I have the Broadlink RM2 plugin working for the mini RM 3.
Works fine!

One thing I wanted to do, was use my TV remote controller to set devices in domoticz, so i could use the colors on the remote to set all the lights in the house to the same color :D.

But the device doesnt update if I press the teached button on the remote controller. The RM does imitate the teached code, but not update the device in domoticz.

Is this currently possible with this plugin?

Thanks

Re: Python Plugin: Broadlink RM2 V3

Posted: Tuesday 16 January 2018 23:00
by zak45
domoticzag wrote: Tuesday 16 January 2018 21:54 Hi All,
Quick question.
I have the Broadlink RM2 plugin working for the mini RM 3.
Works fine!

One thing I wanted to do, was use my TV remote controller to set devices in domoticz, so i could use the colors on the remote to set all the lights in the house to the same color :D.

But the device doesnt update if I press the teached button on the remote controller. The RM does imitate the teached code, but not update the device in domoticz.

Is this currently possible with this plugin?

Thanks
What I had understood, you need some IR receiver connected to Domoticz ( made one myself using ESP8266 + IR receiver ). The RM2 device is just like your TV remote controller, only able to send some IR codes.

Re: Python Plugin: Broadlink RM2 V3

Posted: Wednesday 17 January 2018 11:44
by domoticzag
Hmm oke thanks, already thought so :o.

Did you use your own code for the ESP8266 if so could you share the code?
Or did you use the Easy ESP Firmware?

I have an ESP and IR receiver lying around somewhere :)

Re: Python Plugin: Broadlink RM2 V3

Posted: Wednesday 17 January 2018 13:03
by zak45
domoticzag wrote: Wednesday 17 January 2018 11:44 Or did you use the Easy ESP Firmware?
Yep, ESPEasy is the way to go ;-)
I created a dummy switch and a LUA script :

Code: Select all

commandArray = {}

if devicechanged['IR'] == '16595143' then
    commandArray['433-VoletCuisine'] = 'On REPEAT 2'
    commandArray['433-VoletSAM'] = 'On REPEAT 2'  
elseif devicechanged['IR'] == '16586983' then 
    commandArray['433-VoletCuisine'] = 'Off REPEAT 2'
    commandArray['433-VoletSAM'] = 'Off REPEAT 2'  
elseif devicechanged['IR'] == '16631863' then 
    commandArray['433-VoletSAM'] = 'On REPEAT 2'
elseif devicechanged['IR'] == '16642063' then 
    commandArray['433-VoletSAM'] = 'Off REPEAT 2'  
elseif devicechanged['IR'] == '16582903' then 
    commandArray['433-VoletCuisine'] = 'On REPEAT 2'
elseif devicechanged['IR'] == '16593103' then 
    commandArray['433-VoletCuisine'] = 'Off REPEAT 2'
elseif devicechanged['IR'] == '16589023' then 
    commandArray['Portail'] = 'On'
elseif devicechanged['IR'] == '16635943' then
    if otherdevices['Garage - Porte'] == 'Closed' then
        commandArray['Garage - open'] = 'On'
    else
        commandArray['Garage - close'] = 'Off'
    end
end

return commandArray

So, in this way I can use my Logitech Harmony as Domoticz remote control

Re: Python Plugin: Broadlink RM2 V3

Posted: Friday 19 January 2018 10:52
by domoticzag
@Zak45 Thanks!

Re: Python Plugin: Broadlink RM2 V3

Posted: Monday 22 January 2018 22:41
by SzymonZy
zak45 wrote: Sunday 17 December 2017 12:40
SzymonZy wrote: Sunday 17 December 2017 12:35 Can we use Broadlink SP1 with this plugin already? I found protocol hack on net (https://blog.ipsumdomus.com/broadlink-s ... 0b4b397af1) but will it be implemented into Domoticz?
yes, the V4 is finished : could use Sp1 , sp2/sp3/sp3s, mp1, a1
publish soon.
Any release date scheduled?

Re: Python Plugin: Broadlink RM2 V3

Posted: Wednesday 24 January 2018 20:44
by ChopCZ
Hi,

I am having a strange issue.
It took me long time to locate the problem but I have found that when I comment out the line

Code: Select all

import broadlink
in the plugin.py file

then plugin starts and creates two new devices for discover and remote.
Of course in the log there is an error

Code: Select all

2018-01-24 20:30:41.931 (Xiaomi Gateway) Temp (Xiaomi Temperature)
2018-01-24 20:30:42.000 Python EventSystem: Initalizing event module.
2018-01-24 20:30:42.000 EventSystem: Started
2018-01-24 20:30:42.000 EventSystem: Queue thread started...
2018-01-24 20:30:42.094 PluginSystem: Entering work loop.
2018-01-24 20:30:42.370 (Broadlink) Entering work loop.
2018-01-24 20:30:42.370 (Broadlink) Initialized version 3.0.0, author 'zak45'
2018-01-24 20:30:42.373 (Broadlink) Debug log level set to: 'true'.
2018-01-24 20:30:42.373 (Broadlink) 'Version':'3.0.0'
2018-01-24 20:30:42.373 (Broadlink) 'Author':'zak45'
2018-01-24 20:30:42.373 (Broadlink) 'DomoticzVersion':'3.8841'
2018-01-24 20:30:42.373 (Broadlink) 'DomoticzHash':'b86cc8ab'
2018-01-24 20:30:42.373 (Broadlink) 'Address':'127.0.0.1'
2018-01-24 20:30:42.373 (Broadlink) 'Key':'BroadlinkRM2'
2018-01-24 20:30:42.373 (Broadlink) 'Mode3':'no'
2018-01-24 20:30:42.373 (Broadlink) 'Mode5':'9000'
2018-01-24 20:30:42.373 (Broadlink) 'Mode6':'Debug'
2018-01-24 20:30:42.373 (Broadlink) 'Port':'0'
2018-01-24 20:30:42.373 (Broadlink) 'Mode1':'000000000000'
2018-01-24 20:30:42.373 (Broadlink) 'HardwareID':'6'
2018-01-24 20:30:42.373 (Broadlink) 'HomeFolder':'/home/pi/domoticz/plugins/Broadlink/'
2018-01-24 20:30:42.373 (Broadlink) 'Name':'Broadlink'
2018-01-24 20:30:42.373 (Broadlink) 'Mode4':'no'
2018-01-24 20:30:42.373 (Broadlink) 'DomoticzBuildTime':'2018-01-24 15:06:19'
2018-01-24 20:30:42.373 (Broadlink) 'Mode2':'/home/pi/domoticz/broadlink_ini'
2018-01-24 20:30:42.373 (Broadlink) Device count: 2
2018-01-24 20:30:42.373 (Broadlink) Device: 1 - ID: 52, Name: 'Broadlink - Discover', nValue: 0, sValue: 'Off'
2018-01-24 20:30:42.373 (Broadlink) Device ID: '52'
2018-01-24 20:30:42.373 (Broadlink) Device Name: 'Broadlink - Discover'
2018-01-24 20:30:42.373 (Broadlink) Device nValue: 0
2018-01-24 20:30:42.373 (Broadlink) Device sValue: 'Off'
2018-01-24 20:30:42.373 (Broadlink) Device LastLevel: 0
2018-01-24 20:30:42.373 (Broadlink) Device: 254 - ID: 53, Name: 'Broadlink - Remote', nValue: 0, sValue: ''
2018-01-24 20:30:42.373 (Broadlink) Device ID: '53'
2018-01-24 20:30:42.373 (Broadlink) Device Name: 'Broadlink - Remote'
2018-01-24 20:30:42.373 (Broadlink) Device nValue: 0
2018-01-24 20:30:42.373 (Broadlink) Device sValue: ''
2018-01-24 20:30:42.374 (Broadlink) Device LastLevel: 0
2018-01-24 20:30:42.374 (Broadlink) Connecting to: 127.0.0.1:000000000000
2018-01-24 20:30:42.374 Error: (Broadlink) Error Connecting to Broadlink device....
But when I uncomment the import line and restart my Domoticz then it freezes everytime and it is not responding.
I have tried to use broadlink module directly and my test script

Code: Select all

import broadlink

devices = broadlink.discover(timeout=5)
print(devices)
is working fine when I run it from the console.

Any advices?

Re: Python Plugin: Broadlink RM2 V3

Posted: Wednesday 24 January 2018 22:49
by zak45
ChopCZ wrote: Wednesday 24 January 2018 20:44

Code: Select all

import broadlink

devices = broadlink.discover(timeout=5)
print(devices)
is working fine when I run it from the console.

Any advices?
can you do in console :

pip show broadlink

pip3 show broadlink