-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Improve ZNCLBL01LM support #5104
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
Conversation
ef5a09b
to
f3187ad
Compare
- Refactor converters - Clearing limits calibration - Opening/closing hooks - Enabling/disabling "pull to open/close"
f3187ad
to
66018ba
Compare
66018ba
to
e272344
Compare
3b69f6b
to
32d6ee5
Compare
devices/xiaomi.js
Outdated
.withDescription('Hooks state'), | ||
exposes.enum('motor_state', ea.STATE, ['stopped', 'opening', 'closing', 'pause']).withDescription('Motor state'), | ||
exposes.binary('running', ea.STATE, true, false).withDescription('Whether the motor is moving or not'), | ||
exposes.enum('hooks_action', ea.SET, ['unlock', 'lock']).withDescription('Hooks action'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to change this to action
and rename the unlock
/lock
to hooks_unlock
/hooks_lock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, since action
is not a state (something that has to be persisted).
1c2a64b
to
93a5ed0
Compare
converters/toZigbee.js
Outdated
convertGet: async (entity, key, meta) => { | ||
await entity.read('aqaraOpple', [0x040B], manufacturerOptions.xiaomi); | ||
ZNCLBL01LM_action: { | ||
key: ['action'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just see now that this a settable thing, then action
should not be used, my apologies.
Can we rename this to hooks_lock
and then accept the values LOCK
and UNLOCK
?
We can then use the following expose:
exposes.binary('hooks_lock', ea.STATE_SET, 'LOCK', 'UNLOCK').withDescription('Lock the curtain hooks'),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, I added one more improvement to also have the hooks_lock
present in the state. It also changes based on the hooks_action
now. Can you check if it works correctly? If yes then this can be merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will check!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Koenkk Works great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you get motor_state even when it isn't running?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this when its not running:
Nah, still the same issue in MQTT log:
2023-01-02 10:20:00.421 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on zigbee2mqtt/Bedroom Curtain Left: b'{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}'
2023-01-02 10:20:00.424 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'switch.bedroom_curtain_left_hand_open', 'name': 'Bedroom Curtain Left hand_open', 'this': <template TemplateStateFromEntityId(switch.bedroom_curtain_left_hand_open)>} and Template("{% if value_json.hand_open %} true {% else %} false {% endif %}")
2023-01-02 10:20:00.425 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'sensor.bedroom_curtain_left_battery', 'name': 'Bedroom Curtain Left battery', 'this': <template TemplateStateFromEntityId(sensor.bedroom_curtain_left_battery)>} with default value 'default' and Template("{{ value_json.battery }}")
2023-01-02 10:20:00.427 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'sensor.bedroom_curtain_left_device_temperature', 'name': 'Bedroom Curtain Left device temperature', 'this': <template TemplateStateFromEntityId(sensor.bedroom_curtain_left_device_temperature)>} with default value 'default' and Template("{{ value_json.device_temperature }}")
2023-01-02 10:20:00.428 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'sensor.bedroom_curtain_left_action', 'name': 'Bedroom Curtain Left action', 'this': <template TemplateStateFromEntityId(sensor.bedroom_curtain_left_action)>} with default value 'default' and Template("{{ value_json.action }}")
2023-01-02 10:20:00.430 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'sensor.bedroom_curtain_left_motor_state', 'name': 'Bedroom Curtain Left motor state', 'this': <template TemplateStateFromEntityId(sensor.bedroom_curtain_left_motor_state)>} with default value 'default' and Template("{{ value_json.motor_state }}")
2023-01-02 10:20:00.430 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'motor_state' when rendering '{{ value_json.motor_state }}'
2023-01-02 10:20:00.435 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'sensor.bedroom_curtain_left_hooks_state', 'name': 'Bedroom Curtain Left hooks state', 'this': <template TemplateStateFromEntityId(sensor.bedroom_curtain_left_hooks_state)>} with default value 'default' and Template("{{ value_json.hooks_state }}")
2023-01-02 10:20:00.435 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'sensor.bedroom_curtain_left_target_position', 'name': 'Bedroom Curtain Left target position', 'this': <template TemplateStateFromEntityId(sensor.bedroom_curtain_left_target_position)>} with default value 'default' and Template("{{ value_json.target_position }}")
2023-01-02 10:20:00.436 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'sensor.bedroom_curtain_left_power_source', 'name': 'Bedroom Curtain Left power source', 'this': <template TemplateStateFromEntityId(sensor.bedroom_curtain_left_power_source)>} with default value 'default' and Template("{{ value_json.power_source }}")
2023-01-02 10:20:00.436 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'select.bedroom_curtain_left_hooks_lock', 'name': 'Bedroom Curtain Left hooks lock', 'this': <template TemplateStateFromEntityId(select.bedroom_curtain_left_hooks_lock)>} and Template("{{ value_json.hooks_lock }}")
2023-01-02 10:20:00.436 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'binary_sensor.bedroom_curtain_left_running', 'name': 'Bedroom Curtain Left running', 'this': <template TemplateStateFromEntityId(binary_sensor.bedroom_curtain_left_running)>} and Template("{{ value_json.running }}")
2023-01-02 10:20:00.436 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'binary_sensor.bedroom_curtain_left_charging', 'name': 'Bedroom Curtain Left charging', 'this': <template TemplateStateFromEntityId(binary_sensor.bedroom_curtain_left_charging)>} and Template("{{ value_json.charging }}")
2023-01-02 10:20:00.437 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'binary_sensor.bedroom_curtain_left_update_available', 'name': 'Bedroom Curtain Left update available', 'this': <template TemplateStateFromEntityId(binary_sensor.bedroom_curtain_left_update_available)>} and Template("{{ value_json['update']['state'] == "available" }}")
2023-01-02 10:20:00.437 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'position_open': 100, 'position_closed': 0, 'tilt_min': 0, 'tilt_max': 100, 'entity_id': 'cover.bedroom_curtain_left', 'name': 'Bedroom Curtain Left', 'this': <template TemplateStateFromEntityId(cover.bedroom_curtain_left)>} and Template("{{ value_json.position }}")
2023-01-02 10:20:00.437 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'update.bedroom_curtain_left', 'name': 'Bedroom Curtain Left', 'this': <template TemplateStateFromEntityId(update.bedroom_curtain_left)>} and Template("{{ value_json['update']['installed_version'] }}")
2023-01-02 10:20:00.437 DEBUG (MainThread) [homeassistant.components.mqtt.update] Non-dictionary JSON payload detected after processing payload '6168' on topic zigbee2mqtt/Bedroom Curtain Left
2023-01-02 10:20:00.438 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"action":null,"battery":100,"charging":false,"device_temperature":19,"hand_open":null,"hooks_lock":"UNLOCK","hooks_state":"unlocked","last_seen":"2023-01-02T09:20:00.397Z","linkquality":255,"position":83,"power_outage_count":7,"power_source":"battery","running":false,"state":"OPEN","target_position":83,"update":{"installed_version":6168,"latest_version":6168,"state":"idle"},"update_available":false,"voltage":3000}' with variables {'entity_id': 'cover.bedroom_curtain_left', 'name': 'Bedroom Curtain Left', 'this': <template TemplateStateFromEntityId(cover.bedroom_curtain_left)>} and Template("{{ value_json.motor_state if value_json.motor_state and value_json.motor_state != 'stopped' else value_json.state }}")
93a5ed0
to
6be390d
Compare
Thanks! |
New features: