hassio-zigbee2mqtt
hassio-zigbee2mqtt copied to clipboard
Current Products Hybrid ewand Gen 2 - State in HA showing unknown
Description of the issue
Supported device: https://www.zigbee2mqtt.io/devices/CP180335E-01.html
In dev tools in HA, the blind is showing the state as below:

Entity: Blinds - Back Lounge 1
State: unknown
State attributes (YAML, optional): current_tilt_position: 100 battery: 51 linkquality: 255 tilt: 100 friendly_name: Blinds - Back Lounge 1 supported_features: 240
This means it is not possible to use an open or close command in automations (instead you have to use "set blinds tilt position").
It also means when sharing to Homekit, Google Home or Alexa, the tap to open close, and tap-hold to slide to tilt position is not made available, nor are you shown current open or closed state.
Need to translate the current_tilt_position to open / close states in HA, ie 100 = OPEN, 0 = CLOSED, increasing from 0-99 = OPENING and decreasing from 100-1 = CLOSING.
Thanks.
Addon version
1.26.0-1
Platform
Core: core-2022.7.2 Supervisor: supervisor-2022.07.0 Operating System: Home Assistant OS 8.2
Logs of the issue (if applicable)
No response
Do I understand correctly that this device only supports tilt and not position like normal covers do?
I can’t say I’m an expert on this.
I know that the Hubitat support for this allows open close commands as well as tilt position. Not sure how they do this.
What happens when you set the state to open/close via the z2m frontend -> click on your device -> exposes tab?
What happens when you set the
stateto open/close via the z2m frontend -> click on your device -> exposes tab?
My apologies for the delay. The OPEN/CLOSE buttons in the expose tab of Z2M for it work as expected and open or close upon press.
Could you check if the issue is fixed with the following external converter:
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const utils = require('zigbee-herdsman-converters/lib/utils');
const e = exposes.presets;
const ea = exposes.access;
const fzLocal = {
cover_position_tilt: {
cluster: 'closuresWindowCovering',
type: ['attributeReport', 'readResponse'],
options: [exposes.options.invert_cover()],
convert: (model, msg, publish, options, meta) => {
const result = {};
// Zigbee officially expects 'open' to be 0 and 'closed' to be 100 whereas
// HomeAssistant etc. work the other way round.
// For zigbee-herdsman-converters: open = 100, close = 0
// ubisys J1 will report 255 if lift or tilt positions are not known, so skip that.
const invert = model.meta && model.meta.coverInverted ? !options.invert_cover : options.invert_cover;
if (msg.data.hasOwnProperty('currentPositionTiltPercentage') && msg.data['currentPositionTiltPercentage'] <= 100) {
const value = msg.data['currentPositionTiltPercentage'];
result.tilt = invert ? value : 100 - value;
result.state = result.tilt === 0 ? 'closed' : 'open';
}
return result;
},
}
}
const definition = {
zigbeeModel: ['E-Wand'],
model: 'CP180335E-01',
vendor: 'Current Products Corp',
description: 'Gen. 2 hybrid E-Wand CUSTOM',
fromZigbee: [fzLocal.cover_position_tilt, fz.battery],
toZigbee: [tz.cover_state, tz.cover_position_tilt],
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'closuresWindowCovering']);
await reporting.batteryPercentageRemaining(endpoint);
await reporting.currentPositionTiltPercentage(endpoint);
},
exposes: [e.battery(), e.cover_tilt()],
};
module.exports = definition;
- save this as file next to
configuration.yamlasext_converter.js - add it to
configuration.yaml:
external_converters:
- ext_converter.js
- start z2m, check if issue is fixed
Could you check if the issue is fixed with the following external converter:
No change - but my steps just in case I've done something wrong:
- Used Home Assistant addon "File Editor"
- Created a file in the config/zigbee2mqtt/ folder next to configuration.yaml called ext_converter.js
- Added the text exactly as above into this file, starting with "const fz = require" and finishing at "module.exports = definition;"
- Saved that file
- Edited the configuration,yaml file in the config/zigbee2mqtt/ folder
- Added the external_converters section exactly as above.
- Stopped Z2M. Started it again.
- Hit the reconfigure button in Z2M for each blind
- Hit OPEN then CLOSE on each blind
- Checked the Entity State in Dev Tools - still shows unknown
Thanks.
I'm also seeing this in the logs:
2022-07-31T06:05:15.609Z zigbee-herdsman:deconz:adapter could not parse zclFrame: Error: Cluster '64528' has no command response '128'
2022-07-31T06:05:15.610Z zigbee-herdsman:controller:log Received 'raw' data '{"clusterID":64528,"data":{"type":"Buffer","data":[13,99,18,108,128,97,0,0,0,0,2,0,0,192,39,18,66,0,0,185,65,1,255,0,0,0,0]},"address":48529,"endpoint":1,"linkquality":255,"groupID":null,"wasBroadcast":false,"destinationEndpoint":1}'
Zigbee2MQTT:debug 2022-07-31 16:05:15: Received Zigbee message from 'Blinds - Back Lounge 3', type 'raw', cluster '64528', data '{"data":[13,99,18,108,128,97,0,0,0,0,2,0,0,192,39,18,66,0,0,185,65,1,255,0,0,0,0],"type":"Buffer"}' from endpoint 1 with groupID null
Zigbee2MQTT:debug 2022-07-31 16:05:15: No converter available for 'CP180335E-01' with cluster '64528' and type 'raw' and data '{"data":[13,99,18,108,128,97,0,0,0,0,2,0,0,192,39,18,66,0,0,185,65,1,255,0,0,0,0],"type":"Buffer"}'
To make sure the converter is loaded, I've added CUSTOM at the end of the description (https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/issues/359#issuecomment-1200117159). Can you load this external converter and see if CUSTOM appears at the end of the description when clicking on the device in the z2m frontend?
To make sure the converter is loaded, I've added
CUSTOMat the end of the description (#359 (comment)). Can you load this external converter and see ifCUSTOMappears at the end of the description when clicking on the device in the z2m frontend?
Yes it is loading it:
Friendly name
Blinds - Back Lounge 1
Description
Last seen
N/A
Availability
Disabled
Device type
EndDevice
Zigbee Model
E-Wand
Zigbee Manufacturer
Current Products Corp
Description
Gen. 2 hybrid E-Wand CUSTOM
Support status
Supported
IEEE Address
0x847127----------
Network address
0x08DF
Manufacturer
Current Products Corp
Model
CP180335E-01
Power
Battery 47.5%
Interview completed
True
Still no change and showing "unknown"
Also seeing this in the main Home Assistant logs:
2022-08-01 11:00:15 WARNING (MainThread) [homeassistant.components.mqtt.cover] Payload is not supported (e.g. open, closed, opening, closing, stopped): {"battery":47.5,"linkquality":255,"state":"OPEN","tilt":100}
So to test how ZHA does it I installed a seperate Zigbee stick and paired one of my ewand's to it. Here is the diagnostics output for it. With this the ZHA integration provides an On/Off Switch as well as tilt controls. Tilt shows state open, opening, closing, closed. On Off shows state on or off.
{
"home_assistant": {
"installation_type": "Home Assistant OS",
"version": "2022.7.7",
"dev": false,
"hassio": true,
"virtualenv": false,
"python_version": "3.10.5",
"docker": true,
"arch": "aarch64",
"timezone": "Australia/Sydney",
"os_name": "Linux",
"os_version": "5.15.32-v8",
"supervisor": "2022.07.0",
"host_os": "Home Assistant OS 8.4",
"docker_version": "20.10.14",
"chassis": "embedded",
"run_as_root": true
},
"custom_components": {
"smartthinq_sensors": {
"version": "0.23.6",
"requirements": [
"pycountry>=20.7.3",
"xmltodict>=0.12.0",
"chardet>=4.0.0"
]
},
"watchman": {
"version": "0.5.1",
"requirements": [
"prettytable==3.0.0"
]
},
"bureau_of_meteorology": {
"version": "1.1.13",
"requirements": [
"iso8601"
]
},
"powercalc": {
"version": "v0.24.5",
"requirements": [
"numpy>=1.21.1"
]
},
"tesla_custom": {
"version": "2.3.1",
"requirements": [
"teslajsonpy==2.3.0"
]
},
"nest_protect": {
"version": "0.3.8",
"requirements": []
},
"hacs": {
"version": "1.26.2",
"requirements": [
"aiogithubapi>=22.2.4"
]
},
"dwains_dashboard": {
"version": "3.2.0",
"requirements": []
},
"waste_collection_schedule": {
"version": "1.24.0",
"requirements": [
"icalendar",
"recurring_ical_events",
"icalevents",
"bs4"
]
},
"mila": {
"version": "0.4.1",
"requirements": [
"milasdk==0.4.1",
"python-benedict==0.24.3",
"geopy==2.2.0",
"python-aqi==0.6.1"
]
}
},
"integration_manifest": {
"domain": "zha",
"name": "Zigbee Home Automation",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/zha",
"requirements": [
"bellows==0.31.1",
"pyserial==3.5",
"pyserial-asyncio==0.6",
"zha-quirks==0.0.77",
"zigpy-deconz==0.18.0",
"zigpy==0.47.3",
"zigpy-xbee==0.15.0",
"zigpy-zigate==0.9.0",
"zigpy-znp==0.8.1"
],
"usb": [
{
"vid": "10C4",
"pid": "EA60",
"description": "*2652*",
"known_devices": [
"slae.sh cc2652rb stick"
]
},
{
"vid": "10C4",
"pid": "EA60",
"description": "*sonoff*plus*",
"known_devices": [
"sonoff zigbee dongle plus"
]
},
{
"vid": "10C4",
"pid": "EA60",
"description": "*tubeszb*",
"known_devices": [
"TubesZB Coordinator"
]
},
{
"vid": "1A86",
"pid": "7523",
"description": "*tubeszb*",
"known_devices": [
"TubesZB Coordinator"
]
},
{
"vid": "1A86",
"pid": "7523",
"description": "*zigstar*",
"known_devices": [
"ZigStar Coordinators"
]
},
{
"vid": "1CF1",
"pid": "0030",
"description": "*conbee*",
"known_devices": [
"Conbee II"
]
},
{
"vid": "10C4",
"pid": "8A2A",
"description": "*zigbee*",
"known_devices": [
"Nortek HUSBZB-1"
]
},
{
"vid": "0403",
"pid": "6015",
"description": "*zigate*",
"known_devices": [
"ZiGate+"
]
},
{
"vid": "10C4",
"pid": "EA60",
"description": "*zigate*",
"known_devices": [
"ZiGate"
]
},
{
"vid": "10C4",
"pid": "8B34",
"description": "*bv 2010/10*",
"known_devices": [
"Bitron Video AV2010/10"
]
}
],
"codeowners": [
"@dmulcahey",
"@adminiuga"
],
"zeroconf": [
{
"type": "_esphomelib._tcp.local.",
"name": "tube*"
},
{
"type": "_zigate-zigbee-gateway._tcp.local.",
"name": "*zigate*"
}
],
"after_dependencies": [
"onboarding",
"usb",
"zeroconf"
],
"iot_class": "local_polling",
"loggers": [
"aiosqlite",
"bellows",
"crccheck",
"pure_pcapy3",
"zhaquirks",
"zigpy",
"zigpy_deconz",
"zigpy_xbee",
"zigpy_zigate",
"zigpy_znp"
],
"is_built_in": true
},
"data": {
"ieee": "**REDACTED**",
"nwk": 29203,
"manufacturer": "Current Products Corp",
"model": "E-Wand",
"name": "Current Products Corp E-Wand",
"quirk_applied": false,
"quirk_class": "zigpy.device.Device",
"manufacturer_code": 4707,
"power_source": "Battery or Unknown",
"lqi": 255,
"rssi": -65,
"last_seen": "2022-08-01T23:45:08",
"available": true,
"device_type": "EndDevice",
"signature": {
"node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4707, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
"endpoints": {
"1": {
"profile_id": 260,
"device_type": "0x0202",
"in_clusters": [
"0x0000",
"0x0001",
"0x0003",
"0x0004",
"0x0005",
"0x0006",
"0x0008",
"0x0020",
"0x0102",
"0x0b05",
"0xfc10"
],
"out_clusters": [
"0x0003",
"0x0019"
]
}
}
},
"entities": [
{
"entity_id": "button.current_products_corp_e_wand_02fa4cfe_identify",
"name": "Current Products Corp E-Wand"
},
{
"entity_id": "cover.current_products_corp_e_wand_02fa4cfe_window_covering",
"name": "Current Products Corp E-Wand"
},
{
"entity_id": "sensor.current_products_corp_e_wand_02fa4cfe_power",
"name": "Current Products Corp E-Wand"
},
{
"entity_id": "switch.current_products_corp_e_wand_02fa4cfe_on_off",
"name": "Current Products Corp E-Wand"
}
],
"neighbors": [],
"endpoint_names": [
{
"name": "WINDOW_COVERING_DEVICE"
}
],
"user_given_name": "Blinds - Back Lounge 1",
"device_reg_id": "c6d0809a8bd67cebe772dfe7d13c8f1c",
"area_id": "back_lounge",
"cluster_details": {
"1": {
"device_type": {
"name": "WINDOW_COVERING_DEVICE",
"id": 514
},
"profile_id": 260,
"in_clusters": {
"0x0000": {
"endpoint_attribute": "basic",
"attributes": {
"0x0004": {
"attribute_name": "manufacturer",
"value": "Current Products Corp"
},
"0x0005": {
"attribute_name": "model",
"value": "E-Wand"
}
},
"unsupported_attributes": {}
},
"0x0001": {
"endpoint_attribute": "power",
"attributes": {
"0x0020": {
"attribute_name": "battery_voltage",
"value": 80
},
"0x0021": {
"attribute_name": "battery_percentage_remaining",
"value": 95
}
},
"unsupported_attributes": {
"0x0031": {
"attribute_name": "battery_size"
},
"0x0033": {
"attribute_name": "battery_quantity"
}
}
},
"0x0003": {
"endpoint_attribute": "identify",
"attributes": {},
"unsupported_attributes": {}
},
"0x0004": {
"endpoint_attribute": "groups",
"attributes": {},
"unsupported_attributes": {}
},
"0x0005": {
"endpoint_attribute": "scenes",
"attributes": {},
"unsupported_attributes": {}
},
"0x0006": {
"endpoint_attribute": "on_off",
"attributes": {
"0x0000": {
"attribute_name": "on_off",
"value": 0
}
},
"unsupported_attributes": {
"0x4003": {
"attribute_name": "start_up_on_off"
}
}
},
"0x0008": {
"endpoint_attribute": "level",
"attributes": {
"0x0000": {
"attribute_name": "current_level",
"value": 255
}
},
"unsupported_attributes": {
"0x4000": {
"attribute_name": "start_up_current_level"
},
"0x0011": {
"attribute_name": "on_level"
},
"0x0010": {
"attribute_name": "on_off_transition_time"
},
"0x0012": {
"attribute_name": "on_transition_time"
},
"0x0013": {
"attribute_name": "off_transition_time"
},
"0x0014": {
"attribute_name": "default_move_rate"
}
}
},
"0x0020": {
"endpoint_attribute": "poll_control",
"attributes": {
"0x0000": {
"attribute_name": "checkin_interval",
"value": 13200
}
},
"unsupported_attributes": {}
},
"0x0102": {
"endpoint_attribute": "window_covering",
"attributes": {
"0x0009": {
"attribute_name": "current_position_tilt_percentage",
"value": 100
}
},
"unsupported_attributes": {
"0x0008": {
"attribute_name": "current_position_lift_percentage"
}
}
},
"0x0b05": {
"endpoint_attribute": "diagnostic",
"attributes": {},
"unsupported_attributes": {}
},
"0xfc10": {
"endpoint_attribute": "manufacturer_specific",
"attributes": {},
"unsupported_attributes": {}
}
},
"out_clusters": {
"0x0003": {
"endpoint_attribute": "identify",
"attributes": {},
"unsupported_attributes": {}
},
"0x0019": {
"endpoint_attribute": "ota",
"attributes": {},
"unsupported_attributes": {}
}
}
}
}
}
}
Looking at your logs {"battery":47.5,"linkquality":255,"state":"OPEN","tilt":100} looks correct to me. (state is now OPEN). Isn't this reflected in HA?
Looking at your logs
{"battery":47.5,"linkquality":255,"state":"OPEN","tilt":100}looks correct to me. (stateis nowOPEN). Isn't this reflected in HA?
No this is not populating the Home Assistant state. I've looked at this but not sure if/how it could help: https://www.home-assistant.io/integrations/cover.mqtt/
It could be because states in Home Assistant are case sensitive - maybe it doesn't see "OPEN" as "open" or "CLOSED" as "closed" ??
@shanelord01 I've updated https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/issues/359#issuecomment-1200117159 to use open/closed
@shanelord01 I've updated #359 (comment) to use
open/closed
No change. Also no guarantees this is the issue :/ Trial and error.
In the Z2M "State" submenu for the blind it still shows:
{ "battery": 47.5, "linkquality": 255, "state": "OPEN", "tilt": 100 }
Even with the updated code. Seems something in Z2M is capitalising it.
Update: Just used MQTT Explorer to change the state from OPEN to open - no change in Home Assistant. Grrr. Must be something else causing the state in HA to not reflect the state of the blind.
MQTT Explorer logs:
Was closed (HA state unknown) {"battery":48,"linkquality":255,"state":"CLOSE","tilt":0}
Clicked open in Z2M (HA state unknown) {"battery":48,"linkquality":255,"state":"CLOSE","tilt":100}
Completed opening (HA state unknown) {"battery":48,"linkquality":255,"state":"OPEN","tilt":100}
What happens if you manually publish to zigbee2mqtt/YOUR_DEVICE_FRIENDLY_NAME payload {"battery":48,"linkquality":255,"state":"open","tilt":100}? If this doesn't give the correct state this looks a HA issue to me.
Nothing changes. But if I look at the device in HA only attributes for battery, link quality and tilt are shown. State is either not being passed to or not being received by HA.
OK.
I just took this advice to test it and put this in my HA configuration.yaml
This test blind is presenting HA with a state. Is there any way to make Z2M present the same to HA?
mqtt:
cover:
- name: "Test Blinds"
unique_id: xxx-xxx-xxx
json_attributes_topic: "zigbee2mqtt/Blinds - Back Lounge 1"
position_topic: "zigbee2mqtt/Blinds - Back Lounge 1"
position_template: "{{ value_json.tilt }}"
set_position_topic: "zigbee2mqtt/Blinds - Back Lounge 1/set/tilt"
command_topic: "zigbee2mqtt/Blinds - Back Lounge 1/set/tilt"
position_open: 100
position_closed: 0
payload_open: "100"
payload_close: "0"
payload_stop: "STOP"
@shanelord01 this looks a bit of a hack for me since we map position to tilt, nevertheless, does it full work now without any external converters?
It’s definitely a hack. It is working but I’ve actually disabled the entities provided by Z2M in HA and I’m using my created one which is not ideal at all as it doesn’t fix the problem (ie ideally whatever I’m doing should be done in Z2M or other people with the blind will have the same issue).
Without this HomeKit and Google Home etc don’t work when using Home Assistant to bridge to them.
I think we should first try to solve this at the HA side because I feel this workaround should be implemented there (since it is exposing to HomeKit/Google Home). Can you make an issue in the HA issue tracker?
With all due respect, I don’t believe it’s a Home Assistant issue.
The fact I can access the raw mqtt info (from the device presented into mqtt by Z2M with my manual mqtt cover in HA) shows the data is available - just the way Z2M is presenting it into HA auto discovery is incorrect.
I don’t know how the Z2M to HA auto discovery works behind the scenes - but that is where I believe the issue is.
Note: HomeKit/Google home is only impacted because of the underlying issue that the state is not correctly updated by Z2M in HA.
just the way Z2M is presenting it into HA auto discovery is incorrect.
In my opinion the way it exposes is correct, tilt is exposed as tilt, position as position. With https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/issues/359#issuecomment-1205953872 tilt is exposed as position which does not seem correct to me.
My reason that this is a Home Assistant issue; Home Assistant is responsible for exposing the cover to Google Home/HomeKit. It seems it doesn't do this correct when the cover only supports tilt (in this case it should apply a workaround to expose the tilt as position) since Google Home/HomeKit don't support tilt.
just the way Z2M is presenting it into HA auto discovery is incorrect.
In my opinion the way it exposes is correct, tilt is exposed as tilt, position as position. With #359 (comment) tilt is exposed as position which does not seem correct to me.
My reason that this is a Home Assistant issue; Home Assistant is responsible for exposing the cover to Google Home/HomeKit. It seems it doesn't do this correct when the cover only supports tilt (in this case it should apply a workaround to expose the tilt as position) since Google Home/HomeKit don't support tilt.
Take Google Home and HomeKit out of it - they are a symptom of the issue.
The issue is Z2M is not updating HA state. That is the issue. Everything else stems from that.
With state you mean the state attribute right? Does it work with the following external converter and manual HA entry?
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const utils = require('zigbee-herdsman-converters/lib/utils');
const e = exposes.presets;
const ea = exposes.access;
const fzLocal = {
cover_position_tilt: {
cluster: 'closuresWindowCovering',
type: ['attributeReport', 'readResponse'],
options: [exposes.options.invert_cover()],
convert: (model, msg, publish, options, meta) => {
const result = {};
// Zigbee officially expects 'open' to be 0 and 'closed' to be 100 whereas
// HomeAssistant etc. work the other way round.
// For zigbee-herdsman-converters: open = 100, close = 0
// ubisys J1 will report 255 if lift or tilt positions are not known, so skip that.
const invert = model.meta && model.meta.coverInverted ? !options.invert_cover : options.invert_cover;
if (msg.data.hasOwnProperty('currentPositionTiltPercentage') && msg.data['currentPositionTiltPercentage'] <= 100) {
const value = msg.data['currentPositionTiltPercentage'];
result.tilt = invert ? value : 100 - value;
result.state = result.tilt === 0 ? 'CLOSE' : 'OPEN';
}
return result;
},
}
}
const tzLocal = {
cover_position_tilt: {
key: ['position', 'tilt'],
options: [exposes.options.invert_cover()],
convertSet: async (entity, key, value, meta) => {
const isPosition = (key === 'position');
const invert = !(utils.getMetaValue(entity, meta.mapped, 'coverInverted', 'allEqual', false) ?
!meta.options.invert_cover : meta.options.invert_cover);
const position = invert ? 100 - value : value;
// Zigbee officially expects 'open' to be 0 and 'closed' to be 100 whereas
// HomeAssistant etc. work the other way round.
// For zigbee-herdsman-converters: open = 100, close = 0
await entity.command(
'closuresWindowCovering',
isPosition ? 'goToLiftPercentage' : 'goToTiltPercentage',
isPosition ? {percentageliftvalue: position} : {percentagetiltvalue: position},
utils.getOptions(meta.mapped, entity),
);
return {state: {[isPosition ? 'position' : 'tilt']: value, state: value === 0 ? 'CLOSE' : 'OPEN'}};
},
convertGet: async (entity, key, meta) => {
const isPosition = (key === 'position');
await entity.read('closuresWindowCovering', [isPosition ? 'currentPositionLiftPercentage' : 'currentPositionTiltPercentage']);
},
}
}
const definition = {
zigbeeModel: ['E-Wand'],
model: 'CP180335E-01',
vendor: 'Current Products Corp',
description: 'Gen. 2 hybrid E-Wand CUSTOM',
fromZigbee: [fzLocal.cover_position_tilt, fz.battery],
toZigbee: [tz.cover_state, tzLocal.cover_position_tilt],
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'closuresWindowCovering']);
await reporting.batteryPercentageRemaining(endpoint);
await reporting.currentPositionTiltPercentage(endpoint);
},
exposes: [e.battery(), e.cover_tilt()],
};
module.exports = definition;
mqtt:
cover:
- name: "Test Blinds"
unique_id: xxx-xxx-xxx
json_attributes_topic: "zigbee2mqtt/Blinds - Back Lounge 1"
command_topic: "zigbee2mqtt/Blinds - Back Lounge 1/set/state"
state_topic: "zigbee2mqtt/Blinds - Back Lounge 1"
value_template: "{{ value_json.state }}"
state_open: "OPEN"
state_closed: "CLOSE"
tilt_command_topic: "zigbee2mqtt/Blinds - Back Lounge 1/set/tilt"
tilt_status_topic: "zigbee2mqtt/Blinds - Back Lounge 1"
tilt_status_template: `{{ value_json.tilt }}`
Yes with this the "Test Blinds" shows correct state in Home Assistant.
"Blinds - Back Lounge 1" (auto-discovered) still shows "unknown" state in Home Assistant.
Great, can you remove the external converter and try with:
mqtt:
cover:
- name: "Test Blinds"
unique_id: xxx-xxx-xxx
json_attributes_topic: "zigbee2mqtt/Blinds - Back Lounge 1"
command_topic: "zigbee2mqtt/Blinds - Back Lounge 1/set"
state_topic: "zigbee2mqtt/Blinds - Back Lounge 1"
value_template: "{% if value_json.tilt > 0 %} open {% else %} closed {% endif %}"
tilt_command_topic: "zigbee2mqtt/Blinds - Back Lounge 1/set/tilt"
tilt_status_topic: "zigbee2mqtt/Blinds - Back Lounge 1"
tilt_status_template: `{{ value_json.tilt }}`
That works and shows correct state in HA.
Just FYI - I forgot to mention before that {{ value_json.tilt }} needs to be "{{ value_json.tilt }}" to work.
Great, I've pushed the fix for the auto discovery. Can you check if everything works? (without any external converter or HA config).
Changes will be available in the dev branch in 30 mins from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)
Almost there!
Now when tilt is showing open/100 the open/close state is showing closed and the buttons in the HA interface show it closed. The physical blinds are open.
