Page 9 of 34

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Friday 21 June 2019 16:03
by Thorgal789
salopette wrote: Friday 21 June 2019 4:54 2019-06-20 22:31:21.674 Error: (deconz) Incomplete Json keep it for later : b'\x81W{"e":"changed","id":"5","r":"groups","state":{"all_on":true,"any_on"'

Only ?
Not followed by "Malformed JSON response, can't repair", just after ?
If you have this message alone, it mean it works.

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Friday 21 June 2019 16:22
by salopette
Yes, I only have this message. I do not know with which hardware that hangs together.
Can I fix them?
It's always the same id about being bitched.

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Friday 21 June 2019 17:39
by Thorgal789
Its already fixed ^^.
It's just for test, I m waiting for return from you, to put this line in "log" instead of "error".

It just mean, the JSON is incomplete, so it keep it in memory for the next request. On the next request, the plugin put the incomplete JSON at the start of the new request. I was not sure before your test if it will work because I have never see the next request.

Correct request > ABCDEFGH
Incomplete Request > ABCDE > the plugin print "Incomplete Json keep it for later: ABCDE"
Next Request > FGH > the plugin manage ABCDEFGH.

If I was wrong you will had an other error message because FGH will be too an incomplete JSON. So no error mean it work.

You have the bug on group id 5 ,Groupe > 5 Name:Treppe. I think it's the bug you have previously with desynschronisation beetween group and devices. Every time you change a group, you have in websocket, a notification for group + All devices, too much for domoticz framework on your system. I can't explain that, I have domoticz and deconz on same computer, so you can't make request faster than me, but no problem on my side ...

In any cases, thx for your patience, impossible for me to solve this problem without yours bugs ^^.

I will changes the file, but you don't need to update it, it will be just esthetic. your version works fine. Now the only bug you can have is an error message with "malformed JSON", if you haven't this one, it's good.

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Saturday 22 June 2019 7:57
by salopette
Good morning, I have a question: in Deconz I have a scene (3 lights to 30%). In Domoticz the plug-in shows the group, but if I want to turn it on, there will always be an error.

2019-06-22 07:57:34.365 (deconz) onCommand called for Unit 67: Parameter 'On', Level: 0, Hue:
2019-06-22 07:57:34.361 Status: User: Admin initiated a switch command (2435/deconz - WC-30%/On)
2019-06-22 07:57:34.395 Error: (deconz) Connexion problem (1) with Gateway : 404

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Saturday 22 June 2019 11:32
by Thorgal789
Good morning too, (yeah I know , I wake up realy late), was a bug , again, corrected on master.
I m good to make a new master, too much bugs.

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Saturday 22 June 2019 11:56
by Minglarn
Question.
How to use a zigbee dimmer switch with domoticz. I've a ikea and a philips hue dimmer switch. But domoticz make them as selectors and as soon as I release the dimmer switch it reverts to off state and therefore my assigned lamp turns off (using blocky).

Any ideas on how to make it work?

Skickat från min SM-N950F via Tapatalk


Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Saturday 22 June 2019 12:22
by Thorgal789
I haven't one to check if it works on Domoticz.
Can you send me the JSON info with your dimmer device pls ? something like htt p://192.168.1.1:80/api/36E138295E/sensors/7

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Saturday 22 June 2019 21:44
by Minglarn
Sure... Here is the switch (Philips Hue Dimmer switch)

Return:

Code: Select all

{"config":{"battery":100,"group":"23668","on":true,"reachable":true},"ep":2,"etag":"f07e6977718e74ae12260a59972ef20f","manufacturername":"Philips","mode":1,"modelid":"RWL021","name":"Switch Badrum Övre","state":{"buttonevent":4002,"lastupdated":"2019-06-21T03:31:26"},"swversion":"5.45.1.17846","type":"ZHASwitch","uniqueid":"00:17:88:01:04:f7:52:9e-02-fc00"}

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Sunday 23 June 2019 10:44
by Thorgal789
Ha, this one, for me this one have just 4 buttons, not a real dimmer. This one is easy to manage.
The one I haven't tested is this one that work like the Xiaomi cube, with rotation.

Edit:
I have removed my code, mine works for ikea remote with 1 button, and you have 2
So your code will be smething like that (not tested)

B0 = Never used, it's off switch not off bulb.
B1 = on
B2 = off
B3 = more
B4 = less

Code: Select all

commandArray = {}

-- Philips  Switch
if (devicechanged['deCONZ - Philips Switch']) then
    print("deCONZ - Philips Switch")
    local b = devicechanged[deCONZ - Philips Switch']
    if b == 'B1' then
		commandArray['deCONZ - Cordidor'] = 'Off'
    end
    if b == 'B2' then
		commandArray['deCONZ - Coridor'] = 'On'
    end
    if b == 'B3' then
        v = tonumber(otherdevices_svalues['deCONZ - Cordidor']) + 10
        if v > 255 then
            v = 255
        end
        commandArray['deCONZ - Cordidor'']='Set Level '..tostring(v)
    end
    if b == 'B4' then
        v = tonumber(otherdevices_svalues['deCONZ - Cordidor']) - 10
        if v < 0 then
            v = 0
        end
        commandArray['deCONZ - Cordidor'']='Set Level '..tostring(v)
    end
end

return commandArray
But if you have time to give me some information, I can transform your switch with "b1" 'b2" in this one with "on" "less" "more", like tradfri one.
adresse.jpg
adresse.jpg (23.97 KiB) Viewed 2640 times
I just need confirmation for button assignement, visible on websocket in log when you press a button (these one are for ikea).
1002 = on/off
2002 = more
3002 = less
4002 = right
5002 = left

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Thursday 27 June 2019 18:09
by Minglarn
Hi thanks for the script, but it behaves exaclty same as my blocky.

Code: Select all

2019-06-26 20:44:43.913 Status: LUA: ConBee USB - Dimmer Switch KÖK Underskåp
2019-06-26 20:45:30.575 Status: LUA: ConBee USB - Dimmer Switch KÖK Underskåp
2019-06-26 20:45:30.575 Status: LUA: ConBee USB - Dimmer Switch KÖK Underskåp OFF
As soon I release the button on the PHILIPS HUE switch it goes back to "off" state
This only happens when I press the "On" button.

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Thursday 27 June 2019 18:25
by Thorgal789
Normally it happen for all button. If you press B1 or B2 or B3, after 2/3s, it return to off just after (off position is not displayed, so it mean all button are disabled on the domoticz device)
But as you don't use the off position, it can't change your bulb state.

The "button off" of the remote is not the "switch off position", but I don't know wich one it's, you can press it and look wich one button is hightlighted in domoticz.

If you give me all "buttonevent value" for your remote, I can make you a special device for this remote. You can see all buttonevent value in websocket everytime you press a button. The device will have off state/on/off/more/less

Code: Select all

2019-06-27 18:24:23.081 (deCONZ) ### WebSocket Data : {'uniqueid': '00:15:8d:00:02:7c:f6:bf-02-0012', 'e': 'changed', 'id': '8', 'state': {'buttonevent': 7000, 'lastupdated': '2019-06-27T16:24:23'}, 't': 'event', 'r': 'sensors'}

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Thursday 25 July 2019 10:52
by salopette
Hi, is it possible to implement the control of Colorloop, Speed into your plugin?
That would be cool!!

I have found in Domoticz no suitable solution for me, the z.b. the light always changes the colors in the rainbow after switching on, indefinitely.

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Thursday 25 July 2019 18:34
by Thorgal789
I think more or less.
Only some bulb support this features and ikea one not. Wich one bulb have you ?

If you have bulb that support that (and I think yes, with your screenshoot), there is lot of way to do that.
1 - with command line (like this one https://github.com/Smanar/Domoticz-deCO ... on-the-fly. ) I can make the command if you want to test.
2 - with scene editor in phoscon with a real switch
3 - with scene editor in phoscon with a fake switch
Image

Idk yet what to do with that, but if you have the good bulbs, I can explain you how to make a switch in domoticz to launch a color cycle with some settings, using the solution 1.

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Thursday 25 July 2019 18:38
by CherAlban
Hi,

I installed your plugin today on Windows 7 with a ConBee II Stick, and so far it works really well, thanks!!

I have one question: Is there any way to have the Xiaomi Multisensors (Temperature, Humidity, Pressure) generated as a single device in Domoticz? (or at least Temp and Hum?)

CherAlban

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Thursday 25 July 2019 18:46
by Thorgal789
CherAlban wrote: Thursday 25 July 2019 18:38
I have one question: Is there any way to have the Xiaomi Multisensors (Temperature, Humidity, Pressure) generated as a single device in Domoticz? (or at least Temp and Hum?)
Lol, I think 50% of users want this feature, it's a long story but to resume the plugin works with separating devices, so to group them there is 2 ways, take a look here https://github.com/Smanar/Domoticz-deCO ... ame-sensor . You will find a bad one with LUA and at the bottom a better one with dzevent with all automatic, you can hide the 3 first device to have only 1 working and mixing the 3 firsts.

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Friday 26 July 2019 9:11
by salopette
Thorgal789 wrote: Thursday 25 July 2019 18:34 I think more or less.
Only some bulb support this features and ikea one not. Wich one bulb have you ?

If you have bulb that support that (and I think yes, with your screenshoot), there is lot of way to do that.
1 - with command line (like this one https://github.com/Smanar/Domoticz-deCO ... on-the-fly. ) I can make the command if you want to test.
2 - with scene editor in phoscon with a real switch
3 - with scene editor in phoscon with a fake switch
Image

Idk yet what to do with that, but if you have the good bulbs, I can explain you how to make a switch in domoticz to launch a color cycle with some settings, using the solution 1.
I have Oram lamps and Ikea lamps, at osram this does not work at ikea.

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Friday 26 July 2019 20:12
by Thorgal789
salopette wrote: Friday 26 July 2019 9:11 I have Oram lamps and Ikea lamps, at osram this does not work at ikea.

For ikea, it's sure, it s not working.
But for osram, it can work, at least for some of them.
Try this command line (if you have raspberry).

Code: Select all

curl -H 'Content-Type: application/json' -X PUT -d '{"effect" : "colorloop", "on" : true}' http://192.168.1.1:80/api/36E138295E/lights/16/state
Chnage the "16" value bu your deconz id osram bulb.

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Friday 26 July 2019 20:37
by salopette
pi@phoscon:~ $ curl -H 'Content-Type: application/json' -X PUT -d '{"effect" : "colorloop", "on" : true}' http://192.168.178.93:80/api/D279EE0F45/lights/50/state
[{"success":{"/lights/16/state/on":true}},{"success":{"/lights/16/state/effect":"colorloop"}}]pi@phoscon:~ $


It Start effect!

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Friday 26 July 2019 22:38
by Thorgal789
Ha nice ^^, I can't try it on my side.
I don't see how to implement it on the plugin, but It's easy to make a switch to do that.

- Make a virtual sensor type switch on/off called 'colorloop'
- Use this script

Code: Select all

-- Color loop test

commandArray = {}

function SendJson(url,json)
	local curl = "/usr/bin/curl"
	local cmd = curl .. ' -X PUT -d '..json..' '..url
	local vac = os.execute(cmd)
	if vac ~= true then
		print('Send JSON Error')
	end
end

--color loop switch
if devicechanged['colorloop'] then
    if devicechanged['colorloop'] == 'On' then
        print('Start colorloop')
        SendJson('http://192.168.178.93/api/D279EE0F45/lights/50/state','\'{"effect":"colorloop","on":true}\'')
    else
        print('Stop colorloop')
        SendJson('http://192.168.178.93/api/D279EE0F45/lights/50/state','\'{"effect":"none","on":true}\'')
    end
end

return commandArray
I can't test it but I think I m not so far from the reality. For information you can add in json "colorloopspeed":255

"Specifies the speed of a colorloop. 1 = very fast, 255 = very slow (default: 15). This parameter only has an effect when it is called together with effect colorloop."

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Posted: Saturday 27 July 2019 13:39
by salopette
2019-07-27 13:29:00.616 Error: EventSystem: in Script #test: [string "--..."]:37: attempt to index global 'devicechanged' (a nil value)
2019-07-27 13:30:01.623 Error: EventSystem: in Script #test: [string "--..."]:37: attempt to index global 'devicechanged' (a nil value)
2019-07-27 13:31:00.656 Error: EventSystem: in Script #test: [string "--..."]:37: attempt to index global 'devicechanged' (a nil value)
2019-07-27 13:32:00.139 Error: EventSystem: in Script #test: [string "--..."]:37: attempt to index global 'devicechanged' (a nil value)
2019-07-27 13:33:00.165 Error: EventSystem: in Script #test: [string "--..."]:37: attempt to index global 'devicechanged' (a nil value)
2019-07-27 13:34:00.172 Error: EventSystem: in Script #test: [string "--..."]:37: attempt to index global 'devicechanged' (a nil value)
2019-07-27 13:35:00.135 Error: EventSystem: in Script #test: [string "--..."]:37: attempt to index global 'devicechanged' (a nil value)
2019-07-27 13:36:00.217 Error: EventSystem: in Script #test: [string "--..."]:37: attempt to index global 'devicechanged' (a nil value)
2019-07-27 13:37:00.240 Error: EventSystem: in Script #test: [string "--..."]:37: attempt to index global 'devicechanged' (a nil value)
2019-07-27 13:38:00.226 Error: EventSystem: in Script #test: [string "--..."]:37: attempt to index global 'devicechanged' (a nil value)
2019-07-27 13:39:00.245 Error: EventSystem: in Script #test: [string "--..."]:37: attempt to index global 'devicechanged' (a nil value)