Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial support for MoesHouse / Livolo Roller Blinds #4223

Merged
merged 6 commits into from
Feb 15, 2021

Conversation

Smanar
Copy link
Collaborator

@Smanar Smanar commented Jan 18, 2021

Ok no not sure for model name but probably "Zemismart Chain Roller Shades Driver (Model M515EGB)".
Battery powered device, using tuya cluster for covering, see > #4071

Have added too a new generic tuya covering too (_TZE200_nogaemzt), no more information #4288 (Not tested)

@Smanar Smanar linked an issue Jan 18, 2021 that may be closed by this pull request
@Smanar Smanar linked an issue Jan 28, 2021 that may be closed by this pull request
@Smanar Smanar mentioned this pull request Jan 28, 2021
@Smanar Smanar linked an issue Jan 30, 2021 that may be closed by this pull request
de_web_plugin.cpp Outdated Show resolved Hide resolved
@manup manup added this to the v2.10.0-beta milestone Feb 15, 2021
@manup manup merged commit 52962ef into dresden-elektronik:master Feb 15, 2021
@michamies
Copy link

Added the AM43 to Phoscon today (v2.10.0-beta)
But the node only shows up in Phoscon Map.
Nothing in Phoscon and no device in Fhem deconz.
Did I do something wrong?

image

@Smanar
Copy link
Collaborator Author

Smanar commented Feb 20, 2021

But the node only shows up in Phoscon Map.
Nothing in Phoscon and no device in Fhem deconz.

Phoscon or deconz ?
Try to make 2 inclusions without deleting any device between both.

Check the manufacture name, it need to be "_TZE200_zah67ekd".

@michamies
Copy link

michamies commented Feb 20, 2021

I think its {"_TZE200_zah67ekd", "TS0601", "MoesHouse / Livolo", "Tuya_COVD AM43-0.45-40"},

Sorry it show up in deCONZ-gui map but no device in my deCONZ fhem connector and no "light device" in phoscon
Also no cluster info in deconz only node Info

image

image

Sorry I`m a total newbie...

@Smanar
Copy link
Collaborator Author

Smanar commented Feb 20, 2021

This device is probably invisible in phoscon.
In deconz, in the GUI, can you select the cluster "basic" 0x0000, and read the basic attribute (the button "read", to check the manufacture name ?
Tuya is special you can have 2 identic model, but with different manufacture name.

If the manufacture name is correct, just do the ame thing, but with phoscon in permit join (add new light)

@michamies
Copy link

..thanks for yor help.
I ve tried this.

image
image

I have another TS601 _TZE200_ckud7u2l. This device shows up in hue essentials / fhem huebridge/deCONZ

phoscon permit join (add new light) does not help. The _TZE200_zah67ekd only is in deCONZ map

@Smanar
Copy link
Collaborator Author

Smanar commented Feb 21, 2021

I have checked the code again, all seem fine with the version v2.10.0-beta.
From the code if it don't work you need to see it as plug.

Can you share some log during the inclusion ? on deconz/help/log with "info" and "info_l2" ?
Have you a linux machine to make some tests ?

@michamies
Copy link

michamies commented Feb 21, 2021

Node Info 0x847127fffe17bd6a
deConz is running on a Raspi 3B

-> Add light in phoscon ("info" and "info_l2") Starting Paring onm Roller for 3 times

...

@Smanar
Copy link
Collaborator Author

Smanar commented Feb 21, 2021

Ok so it seem the sensor part is working but not the light part. And I don't see why.

@jscheurwater or @michamies can you make a try with this branch, it will display more log to trace the problem.

sudo apt install deconz-dev
git clone --branch cov_debug https://github.com/Smanar/deconz-rest-plugin.git
cd deconz-rest-plugin
qmake && make -j2
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

All logs will start by "COV debug"

@Smanar Smanar mentioned this pull request Feb 21, 2021
@jscheurwater
Copy link

@Smanar Of course! Can you please tell me how to test this code?
I have a virtual machine with Linux on it.

@michamies
Copy link

@Smanar
I've tried this branch, but I`m not really familar with this.

after starting deCONZ-GUI
root@pi3:~/deconz-rest-plugin# sudo systemctl start deconz-gui
I`m
again on
V2.10.00 / 23.12.2020
Fw26660700

Sorry but could you please describe how to get Logs with "COV debug"
The last time I generated the LOGS via deCONZ help debug view.
sorry again I'm a real newbie.

@jscheurwater
Copy link

jscheurwater commented Feb 22, 2021

I saw that it's merged into the dresden-elektronik:master. Does this mean that this device will be supported in the next main update of Phoscon on +- 10 march?

@Smanar
Copy link
Collaborator Author

Smanar commented Feb 22, 2021

IDK, the code will be in the version, but it seem it s not working.

@jscheurwater You have the procedure here > https://github.com/dresden-elektronik/deconz-rest-plugin#install-deconz-development-package-optional-linux-only

So it will be

  • Install deconz, if you haven't it on the machine
  • Make a backup of the file /usr/share/deCONZ/plugins/libde_rest_plugin.so in another folder (if you are on your production machine)
  • recompile the lib
sudo apt install deconz-dev
git clone --branch cov_debug https://github.com/Smanar/deconz-rest-plugin.git
cd deconz-rest-plugin
qmake && make -j2
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins
  • Try re add the device with looking logs

To find log, just use deconz (the GUI) in help / log with "info" and "info_2"
You will have some line in log starting by "COV debug"

@michamies
Copy link

michamies commented Feb 22, 2021

here we are...

node 0x847127fffe17bd6a

...

@Smanar
Copy link
Collaborator Author

Smanar commented Feb 22, 2021

Nice perfect ^^, thx a lot.

You can delete this log. Can you make a second try with the new code ?
Will be faster (not all code will be recompiled)

cd deconz-rest-plugin
git pull
qmake && make -j2
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

@michamies
Copy link

@Smanar
great, thx so much....

The Roller Blinds show up as a light stripe in phoscon.
So far the good news.

But I'm not able to do anything with it.
the only thing that works when I set the brightness to 100% and switch it on, the motor starts up, but stops again immediately.

@Mimiix
Copy link
Collaborator

Mimiix commented Feb 23, 2021

@michamies That's because Phoscon is a different package and should add support themselves. You need to use the RestAPI to control it and make sure it works ;)

@michamies
Copy link

michamies commented Feb 23, 2021

@Mimiix
Thanks for your help.

I've tried also with fhem / HueBridge deCONZ connector

I can setup some things like

on [<ramp-time>] off [<ramp-time>] toggle [<ramp-time>] statusRequest Request device status update. pct <value> [<ramp-time>] dim to <value> Note: the FS20 compatible dimXX% commands are also accepted. color <value> set colortemperature to <value> kelvin. bri <value> [<ramp-time>] set brighness to <value>; range is 0-254. dimUp [delta] dimDown [delta] ct <value> [<ramp-time>] set colortemperature to <value> in mireds (range is 154-500) or kelvin (range is 2000-6493). ctUp [delta] ctDown [delta] hue <value> [<ramp-time>] set hue to <value>; range is 0-65535. hueUp [delta] hueDown [delta] sat <value> [<ramp-time>] set saturation to <value>; range is 0-254. satUp [delta] satDown [delta] xy <x>,<y> [<ramp-time>] set the xy color coordinates to <x>,<y> alert [none|select|lselect] effect [none|colorloop] transitiontime <time> set the transitiontime to <time> 1/10s rgb <rrggbb> set the color to (the nearest equivalent of) <rrggbb>

But only on/off starts the Motor for a very short time
off clockwise for 1s
on counterclockwise for 1s

Sorry again I 'm learning a lot at the moment... ;)

@michamies
Copy link

michamies commented Feb 23, 2021

@Mimiix @Smanar
ok, switching from tilt mode to lift mode and the Motor runs after one command.
Stopping at the limit settings.
That works so far! Great :) I'm happy :) 👍

@Smanar
Copy link
Collaborator Author

Smanar commented Feb 23, 2021

Lol
I don't understand, so there is no issue in deconz ? Because I m still searching, I have changed nothing yet ?

@michamies
Copy link

@Smanar
everythings works fine after setting the Device from tilt to "lift mode"
so one command on/off is enough to start the motor running cloclwise/counterclockwise
I'm missing a stop command in fhem deCONZ/RESTAPI.
But thats not a real problem. I can setup a upper and bottom limit in the Device, so it stops automatically by reaching this point.

another question -> you know I'm a Newbie :)
Is there something I should do with my deCONZ installation because of the dev-version
It's my prod System and it's not funny with my wife if some Bulbs, sensors and switches not working.... ;)

@jscheurwater
Copy link

@michamies Can you please tell me the steps to connect and use the deCONZ/RESTAPI with the Conbee 2 stick and Home Assistant to connect this Zemismart M515EGBZTN?

I'm a real newby as well and want to connect this device.

@Mimiix
Copy link
Collaborator

Mimiix commented Feb 23, 2021

@michamies @jscheurwater A PR is not to ask questions like this as a personal helpdesk/education station. There's plenty of documentation around. https://dresden-elektronik.github.io/deconz-rest-doc/getting_started/ is a guide for the rest api and the wiki https://github.com/dresden-elektronik/deconz-rest-plugin/wiki for other.

If you have specific questions, open a Seperate issue or ask on discord.

@michamies
Copy link

@Mimiix
thx for information

@Smanar
fyi
I added another _TZE200_zah67ekd (last one) and that was really hard.
I had to delete it in deCONZ for several times it shows up without name an no plug in phoscon.
Last try and a new "SMART plug" appears.
Is there somethin I'm doing wrong?

@Smanar
Copy link
Collaborator Author

Smanar commented Feb 23, 2021

I added another _TZE200_zah67ekd (last one) and that was really hard.
I had to delete it in deCONZ for several times it shows up without name an no plug in phoscon.
Last try and a new "SMART plug" appears.
Is there somethin I'm doing wrong?

Yep, don't delete it, for the reason I have explained above.
You need to make 2 inclusions but without deleting the device.

@jscheurwater
Copy link

jscheurwater commented Mar 11, 2021

Thanks for all the progress everyone! Does somebody know if it's already possible to connect this Zemismart M515EGBZTN device to Phoscon (since the last update has rolled out)?

@Smanar
Copy link
Collaborator Author

Smanar commented Mar 12, 2021

@jscheurwater a model name mean nothing for tuya, to be sure we need the zigbee manufacture name, but covering are generaly fast added to code.

@jscheurwater
Copy link

@Smanar I tried to add the device using the Conbee II stick via Phoscon. This did not work yet.

I don't know how to get the Zigbee manufacturer name. There is a handler available on the website of the manufacturer. I attached the code below:

/**

  • Tuya Window Shade (v.0.1.0)
  • Copyright 2020 iquix
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.
    This DTH is coded based on iquix's tuya-window-shade DTH.
    https://github.com/iquix/Smartthings/blob/master/devicetypes/iquix/tuya-window-shade.src/tuya-window-shade.groovy
    */

import groovy.json.JsonOutput
import physicalgraph.zigbee.zcl.DataType

metadata {
definition(name: "ZemiSmart Vertical Blind", namespace: "ShinJjang", author: "ShinJjang-iquix", ocfDeviceType: "oic.d.blind", vid: "generic-shade") {
capability "Actuator"
capability "Configuration"
capability "Window Shade"
capability "Window Shade Preset"
capability "Switch Level"
capability "Sensor"

	command "pause"
	command "levelOpenClose"
    
    attribute "Direction", "enum", ["Reverse","Forward"]
    attribute "OCcommand", "enum", ["Replace","Original"]
    attribute "stapp", "enum", ["Reverse","Forward"]
    attribute "remote", "enum", ["Reverse","Forward"]

	fingerprint endpointId: "0x01", profileId: "0104", inClusters: "0000 0004 0005 EF00", outClusters: "0019, 000A", manufacturer: "_TZE200_xuzcvlku", model: "TS0601", deviceJoinName: "Zemismart Vertical Blind"        
}

preferences {
	input "preset", "number", title: "Preset position", description: "Set the window shade preset position", defaultValue: 50, range: "0..100", required: false, displayDuringSetup: false
    input name: "Direction", type: "enum", title: "Direction Set", options:["01": "Reverse", "00": "Forward"], required: true, displayDuringSetup: true
    input name: "OCcommand", type: "enum", title: "Replace Open and Close commands", options:["2": "Replace", "0": "Original"], required: true, displayDuringSetup: true
    input name: "stapp", type: "enum", title: "app opening,closing Change", options:["2": "Reverse", "0": "Forward"], required: true, displayDuringSetup: true
    input name: "remote", type: "enum", title: "RC opening,closing Change", options:["1": "Reverse", "0": "Forward"], required: true, displayDuringSetup: true
}

tiles(scale: 2) {
	multiAttributeTile(name:"windowShade", type: "generic", width: 6, height: 4) {
		tileAttribute("device.windowShade", key: "PRIMARY_CONTROL") {
			attributeState "open", label: 'Open', action: "close", icon: "http://www.ezex.co.kr/img/st/window_open.png", backgroundColor: "#00A0DC", nextState: "closing"
			attributeState "closed", label: 'Closed', action: "open", icon: "http://www.ezex.co.kr/img/st/window_close.png", backgroundColor: "#ffffff", nextState: "opening"
			attributeState "partially open", label: 'Partially open', action: "close", icon: "http://www.ezex.co.kr/img/st/window_open.png", backgroundColor: "#d45614", nextState: "closing"
			attributeState "opening", label: 'Opening', action: "close", icon: "http://www.ezex.co.kr/img/st/window_open.png", backgroundColor: "#00A0DC", nextState: "closing"
			attributeState "closing", label: 'Closing', action: "open", icon: "http://www.ezex.co.kr/img/st/window_close.png", backgroundColor: "#ffffff", nextState: "opening"
		}
	}
	standardTile("contPause", "device.switch", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
		state "pause", label:"", icon:'st.sonos.pause-btn', action:'pause', backgroundColor:"#cccccc"
	}
	standardTile("presetPosition", "device.presetPosition", width: 2, height: 2, decoration: "flat") {
		state "default", label: "Preset", action:"presetPosition", icon:"st.Home.home2"
	}
	standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 1) {
		state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
	}
	valueTile("shadeLevel", "device.level", width: 4, height: 1) {
		state "level", label: 'Shade is ${currentValue}% up', defaultState: true
	}
	controlTile("levelSliderControl", "device.level", "slider", width:2, height: 1, inactiveLabel: false) {
		state "level", action:"switch level.setLevel"
	}

	main "windowShade"
	details(["windowShade", "contPause", "presetPosition", "shadeLevel", "levelSliderControl", "refresh"])
}

}

private getCLUSTER_TUYA() { 0xEF00 }
private getSETDATA() { 0x00 }

// Parse incoming device messages to generate events
def parse(String description) {
log.debug description
if (description?.startsWith('catchall:') || description?.startsWith('read attr -')) {
Map descMap = zigbee.parseDescriptionAsMap(description)
if (descMap?.clusterInt==CLUSTER_TUYA) {
if ( descMap?.command == "01" || descMap?.command == "02" ) {
def dp = zigbee.convertHexToInt(descMap?.data[3]+descMap?.data[2])
log.debug "dp = " + dp
switch (dp) {
case 1025:
def parData = descMap.data[6] as int
if(parData != 1){
def stappVal = (stapp ?:"0") as int
def data = Math.abs(parData - stappVal)
sendEvent([name:"windowShade", value: (data == 0 ? "opening":"closing"), displayed: true])
log.debug "App control=" + (data == 0 ? "opening":"closing")
}
break
case 1031: // 0x04 0x07: Confirm opening/closing/stopping (triggered from remote)
def parData = descMap.data[6] as int
def remoteVal = remote as int
def data = Math.abs(parData - remoteVal)
sendEvent([name:"windowShade", value: (data == 0 ? "opening":"closing"), displayed: true])
log.debug "Remote control=" + (data == 0 ? "opening":"closing")
break
case 514: // 0x02 0x02: Started moving to position (triggered from Zigbee)
def setLevel = zigbee.convertHexToInt(descMap.data[9])
def lastLevel = device.currentValue("level")
//sendEvent([name:"windowShade", value: (setLevel >= lastLevel ? "opening":"closing"), displayed: true])
log.debug "Remote control=" + (setLevel >= lastLevel ? "opening":"closing")
log.debug "setLevel : $setLevel"
log.debug "lastLevel : $lastLevel"
if (setLevel > 0 && setLevel <100)
{
sendEvent(name: "windowShade", value: "partially open")
}
else
{
if (setLevel == 0)
sendEvent([name:"windowShade", value: "open", displayed: true])
if (setLevel == 100)
sendEvent([name:"windowShade", value: "closed", displayed: true])
}
//log.debug "arrived at position :"+pos

                    sendEvent(name: "level", value: (setLevel))
                    break
				case 515: // 0x02 0x03: Arrived at position
                	def pos = zigbee.convertHexToInt(descMap.data[9])
                	log.debug "arrived at position :"+pos
                	if (pos > 0 && pos <100) {
                    	sendEvent(name: "windowShade", value: "partially open")
                    } else {
                    	sendEvent([name:"windowShade", value: (pos == 100 ? "open":"closed"), displayed: true])
                    }
                    sendEvent(name: "level", value: (pos))
                    break
                default: log.debug "abnormal case : $dp" 
                    break
			}
		}
	}
}

}

def close() {
log.info "close()"
def cm = (OCcommand ?:"0") as int
log.debug "cm=${cm}"
def val = Math.abs(2 - cm)
sendTuyaCommand("0104", "00", "010" + val)
}

def open() {
log.info "open()"
def cm = (OCcommand ?:"0") as int
def val = Math.abs(0 - cm)
sendTuyaCommand("0104", "00", "010" + val)
}

def pause() {
log.info "pause()"
sendTuyaCommand("0104", "00", "0101")
}

def setLevel(data, rate = null) {
log.info "setLevel("+data+")"
def currentLevel = device.currentValue("level")
if (currentLevel == data) {
sendEvent(name: "level", value: currentLevel, displayed: true)
return
}
sendTuyaCommand("0202", "00", "04000000"+zigbee.convertToHexString(data, 2))
}

def refresh() {
zigbee.readAttribute(CLUSTER_TUYA, 0x00, )
}

def presetPosition() {
setLevel(preset ?: 50)
}

def installed() {
sendEvent(name: "supportedWindowShadeCommands", value: JsonOutput.toJson(["open", "close", "pause"]), displayed: false)
}

def updated() {
log.debug "val(${Direction}),valC(${OCcommand}),valR(${remote})"
DirectionSet(Direction ?:"00")
}

def DirectionSet(Dval) {
log.info "Dset(${Dval})"
sendHubCommand(zigbee.command(CLUSTER_TUYA, SETDATA, "00" + zigbee.convertToHexString(rand(256), 2) + "05040001" + Dval))
}

def configure() {
log.info "configure()"
}

private sendTuyaCommand(dp, fn, data) {
log.info "${zigbee.convertToHexString(rand(256), 2)}=${dp},${fn},${data}"
zigbee.command(CLUSTER_TUYA, SETDATA, "00" + zigbee.convertToHexString(rand(256), 2) + dp + fn + data)
}

private rand(n) {
return (new Random().nextInt(n))
}

@Smanar
Copy link
Collaborator Author

Smanar commented Mar 15, 2021

It s probably the code we are using ATM, but still the same problem, I need the manufacture name.

@Smanar I tried to add the device using the Conbee II stick via Phoscon. This did not work yet.

If you haven't it as covering, you probably have it as plug.

@jscheurwater
Copy link

jscheurwater commented Mar 15, 2021

@Smanar In the handler I sended before, I found this:

...manufacturer: "_TZE200_xuzcvlku", model: "TS0601", deviceJoinName: "Zemismart Vertical Blind"

So i guess the Zigbee manufacturer is: _TZE200_xuzcvlku.

@Smanar
Copy link
Collaborator Author

Smanar commented Mar 15, 2021

Oups sorry haven't see it.
So you are not alone for this device #4573

On the other issue, I create the battery sensor, trying to help for discovery, but I havent return from the user yet.

I realy don't have idea why it can't be included for some users.

@jscheurwater
Copy link

@Smanar Thanks, I'll keep following the other topic.

@Smanar
Copy link
Collaborator Author

Smanar commented Mar 15, 2021

And if you have a linux machine you can test the code too.

@Smanar
Copy link
Collaborator Author

Smanar commented Mar 19, 2021

I need someone with the issue (device not pairing) and able to compile a modification to make a test ?

@jscheurwater
Copy link

I'll try tomorrow to set up a test environment in Linux.

@Smanar Smanar deleted the moehouse_rollerblind branch April 21, 2021 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants