OpenZWave / Zwave2Mqtt

Fully configurable Zwave to MQTT gateway and Control Panel using NodeJS and Vue
MIT License
355 stars 93 forks source link

[bug]Transition not working #411

Closed broyuken closed 4 years ago

broyuken commented 4 years ago

Version

Build/Run method

Zwave2Mqtt version: v3.0.2 Openzwave Version: 1.6 something

Describe the bug Transition does not appear to work with zwave2mqtt. I set a transition in the developer tools and/or an automation but the light just turns on instantly. Additionally, I see no transition in the mqtt message in the z2m debug console

To Reproduce Steps to reproduce the behavior: Go to Developer tools Turn on a light Add a transition to the call Light turns on without transition

Expected behavior Light turns on with transition

Additional context Add any other context about the problem here. Light configuration:

{
  "type": "light",
  "object_id": "dimmer",
  "discovery_payload": {
    "schema": "template",
    "brightness_template": "{{ (value_json.value / 99 * 255) | round(0) }}",
    "state_topic": "homeassistant/Office_Light/38/1/0",
    "state_template": "{{ \"off\" if value_json.value == 0 else \"on\" }}",
    "command_topic": "homeassistant/Office_Light/38/1/0/set",
    "command_on_template": "{{ ((brightness / 255 * 99) | round(0)) if brightness is defined else 255 }}",
    "command_off_template": "0",
    "device": {
      "identifiers": [
        "zwave2mqtt_0xc67d8b46_node6"
      ],
      "manufacturer": "Inovelli",
      "model": "LZW31 Dimmer (0x0001)",
      "name": "Office_Light",
      "sw_version": "1.35"
    },
    "name": "Office_Light_dimmer",
    "unique_id": "zwave2mqtt_0xc67d8b46_6-38-1-0"
  },
  "discoveryTopic": "light/Office_Light/dimmer/config",
  "values": [
    "38-1-0"
  ],
  "persistent": false,
  "id": "light_dimmer"

Logs from debug console

2020-04-28T15:14:51.157Z z2m:Mqtt Message received on homeassistant/Office_Light/38/1/0/set
OpenZWave Info, Node006, Value::Set - COMMAND_CLASS_SWITCH_MULTILEVEL - Level - 0 - 1 - 49
OpenZWave Info, Node006, SwitchMultilevel::Set - Setting to level 49
OpenZWave Detail, Node006, Setting Encryption Flag on Message For Command Class COMMAND_CLASS_SWITCH_MULTILEVEL
OpenZWave Detail, Node006, Queuing (Send) SwitchMultilevelCmd_Set (Node=6): 0x01, 0x0a, 0x00, 0x13, 0x06, 0x03, 0x26, 0x01, 0x31, 0x25, 0x6c, 0xbc
OpenZWave Detail, Node006, Setting Encryption Flag on Message For Command Class COMMAND_CLASS_SWITCH_MULTILEVEL
OpenZWave Detail, Node006, Queuing (Send) SwitchMultilevelCmd_Get (Node=6): 0x01, 0x09, 0x00, 0x13, 0x06, 0x02, 0x26, 0x02, 0x25, 0x6d, 0x8d
OpenZWave Detail,
OpenZWave Info, Node006, Processing (Send) Nonce Request message (Callback ID=0x6c, Expected Reply=0x13)
OpenZWave Info, Node006, Sending (Send) message (Callback ID=0x02, Expected Reply=0x13) - Nonce_Get(SwitchMultilevelCmd_Set) - 0x01, 0x09, 0x00, 0x13, 0x06, 0x02, 0x98, 0x40, 0x05, 0x02:
OpenZWave Detail, Node006, Received: 0x01, 0x04, 0x01, 0x13, 0x01, 0xe8
OpenZWave Detail, Node006, ZW_SEND_DATA delivered to Z-Wave stack
OpenZWave Detail, Node006, Received: 0x01, 0x05, 0x00, 0x13, 0x02, 0x00, 0xeb
OpenZWave Detail, Node006, ZW_SEND_DATA Request with callback ID 0x02 received (expected 0x02)
OpenZWave Info, Node006, Request RTT 23 Average Request RTT 55
OpenZWave Detail, Node006, Received: 0x01, 0x10, 0x00, 0x04, 0x00, 0x06, 0x0a, 0x98, 0x80, 0xeb, 0x98, 0xb3, 0xda, 0xbc, 0xe6, 0x57, 0xfe, 0x16
OpenZWave Info, Node006, Received SecurityCmd_NonceReport from node 6
OpenZWave Info, Node006, Encrypted Flag is 1
OpenZWave Info, Node006, Sending (Send) message (Callback ID=0x6e, Expected Reply=0x13) - SwitchMultilevelCmd_Set (Node=6): 0x01, 0x0a, 0x00, 0x13, 0x06, 0x03, 0x26, 0x01, 0x31, 0x25, 0x6e, 0xbe
OpenZWave Detail, Node006, Received: 0x01, 0x04, 0x01, 0x13, 0x01, 0xe8
OpenZWave Detail, Node006, ZW_SEND_DATA delivered to Z-Wave stack
OpenZWave Detail, Node006, Received: 0x01, 0x05, 0x00, 0x13, 0x6e, 0x00, 0x87
OpenZWave Detail, Node006, ZW_SEND_DATA Request with callback ID 0x6e received (expected 0x6e)
OpenZWave Info, Node006, Request RTT 70 Average Request RTT 62
OpenZWave Detail, Node006, Expected callbackId was received
OpenZWave Detail, Node006, Expected reply was received
OpenZWave Detail, Node006, Message transaction complete

Developer tools commands

service: light_turn_on
entity_id: light.office_light
transition: 10
brightness_pct: 50
robertsLando commented 4 years ago

@broyuken Unfortunally I can't help with this, I think it's more likely a bug with hass configuration not something strinctly related to z2m but I'm not an Hass user so I don't know.

@chilicheech Do you have any idea?

broyuken commented 4 years ago

Is there something in the mqtt object that needs to be created to send the transition flag?

robertsLando commented 4 years ago

@broyuken Transition doesn't exists on set values in OZW so I dunno what are you speaking about

I think you are confusing an hass feature with zwave feature

broyuken commented 4 years ago

I’m not sure which side it has to be done on, I just know that there is a feature where you can change a lights brightness from off to say 100% over 30 seconds. That is not working and I’m trying to figure out why. It works on my zigbee bulbs but isn’t working on my zwave light switches.

Transition is supported on mqtt lights in HA, in the Json and template schemas

https://www.home-assistant.io/integrations/light.mqtt#json-schema---configuration

robertsLando commented 4 years ago

@broyuken As I told you there is no transition on Openzwave side. If hass has I don't know and I also don't know how it works. If hass handles it by sending messages at specified intervals with values for transiction it should work, otherwise not, you should check what messages are sent from hass via mqtt

Fishwaldo commented 4 years ago

There should be a "Duration" value ID exposed. That needs to be set to the desired time before changing the "Level" value.

This is a device feature, OZW just transmits the transition (or duration) value to the device with the set message.

broyuken commented 4 years ago

That’s the issue, my light supports it, but the auto discovered mqtt device doesn’t seem to be sending it to ozw

broyuken commented 4 years ago

I checked in mqtt explorer and I see that it is being updated constantly, but the value is always 0, even after I push a transition from HA developer tools.

{"value_id":"5-43-1-1","node_id":5,"class_id":43,"type":"int","genre":"user","instance":1,"index":1,"label":"Duration","units":"","help":"","read_only":true,"write_only":false,"min":-2147483648,"max":2147483647,"is_polled":false,"value":0,"lastUpdate":1588258124893}
robertsLando commented 4 years ago

@broyuken The auto-discovered device will never send it. Based on what @Fishwaldo said that you should hace another valueId exposed called duration where you set the duration, when you send the set command OZW will check if there is a duration and if so will use that

broyuken commented 4 years ago

Can I modify the auto created device to include it? Would this be something added to the device in HA? I’m sorry, I don’t understand how or what to modify to get this working.

robertsLando commented 4 years ago

Just go to hass devices table. Check readme for more info

broyuken commented 4 years ago

I looked over the readme, but I'm still not understanding. Do I need to create a "duration_topic" and "duration_template"?

This is what I have currently.

{
  "type": "light",
  "object_id": "dimmer",
  "discovery_payload": {
    "schema": "template",
    "brightness_template": "{{ (value_json.value / 99 * 255) | round(0) }}",
    "state_topic": "homeassistant/Chandelier/38/1/0",
    "state_template": "{{ \"off\" if value_json.value == 0 else \"on\" }}",
    "command_topic": "homeassistant/Chandelier/38/1/0/set",
    "command_on_template": "{{ ((brightness / 255 * 99) | round(0)) if brightness is defined else 255 }}",
    "command_off_template": "0",
    "device": {
      "identifiers": [
        "zwave2mqtt_0xc67d8b46_node2"
      ],
      "manufacturer": "GE (Jasco Products)",
      "model": "14294 In-Wall Smart Dimmer (0x3038)",
      "name": "Chandelier",
      "sw_version": "5.29"
    },
    "name": "Chandelier_dimmer",
    "unique_id": "zwave2mqtt_0xc67d8b46_2-38-1-0"
  },
  "discoveryTopic": "light/Chandelier/dimmer/config",
  "values": [
    "38-1-0"
  ],
  "persistent": true,
  "id": "light_dimmer"
}
broyuken commented 4 years ago

I updated the values but that didn't seem to do it. I'm assuming I need to create a topic for it, but I'm not sure how to format it, or what name it's supposed to be. I don't understand what the value_json.value means. Would I set it to something like the following?

  "duration_template": "{{ (value_json.value / 99 * 255) | round(0) }}",
  "values": [
    "38-1-0",
    "38-1-5"
  ],
robertsLando commented 4 years ago

@broyuken you should try to use the topic of the duration valueid and add it to values array like you did

If in your settings you have set valueid topics it would be prefix/commandclass/instance/index/

broyuken commented 4 years ago

I set it to the following but it's not working. Is my naming wrong, I'm sorry I'm not a coder so I don't understand fully how exactly all these things have to be configured.

{
  "type": "light",
  "object_id": "dimmer",
  "discovery_payload": {
    "schema": "template",
    "brightness_template": "{{ (value_json.value / 99 * 255) | round(0) }}",
    "duration_template": "homeassistant/Chandelier/38/1/5",
    "state_topic": "homeassistant/Chandelier/38/1/0",
    "state_template": "{{ \"off\" if value_json.value == 0 else \"on\" }}",
    "command_topic": "homeassistant/Chandelier/38/1/0/set",
    "command_on_template": "{{ ((brightness / 255 * 99) | round(0)) if brightness is defined else 255 }}",
    "command_off_template": "0",
    "device": {
      "identifiers": [
        "zwave2mqtt_0xc67d8b46_node2"
      ],
      "manufacturer": "GE (Jasco Products)",
      "model": "14294 In-Wall Smart Dimmer (0x3038)",
      "name": "Chandelier",
      "sw_version": "5.29"
    },
    "name": "Chandelier_dimmer",
    "unique_id": "zwave2mqtt_0xc67d8b46_2-38-1-0"
  },
  "discoveryTopic": "light/Chandelier/dimmer/config",
  "values": [
    "38-1-0",
    "38-1-5"
  ],
  "persistent": true,
  "id": "light_dimmer"
}
robertsLando commented 4 years ago

@broyuken Sorry but by checking hass docs: https://www.home-assistant.io/integrations/light.mqtt/

Seems duration isn't supported by mqtt autodiscovery. The only option is to manually create that dimmer, check this tutorial: https://selfhostedhome.com/migrating-to-zwave2mqtt-for-home-assistant/

broyuken commented 4 years ago

I created in manually, but transition still isn't working.

platform: mqtt
name: "Chandelier"
schema: template
brightness_template: "{{ (value_json.value / 99 * 255) | round(0) }}"
state_topic: "homeassistant/Chandelier/38/1/0"
state_template: "{{ \"off\" if value_json.value == 0 else \"on\" }}"
command_topic: "homeassistant/Chandelier/38/1/0/set"
command_on_template: "{{ ((brightness / 255 * 99) | round(0)) if brightness is defined else 255 }}"
command_off_template: "0"
robertsLando commented 4 years ago

I cannot help here as I'm not an hass user. Try to check hass console to see if there is any error

broyuken commented 4 years ago

no error from what I can see. Does anyone who uses hass have a way to get this to work?

@robertsLando are you able to turn a light on over 30 seconds? or is it only instant on/off?

ve6rah commented 4 years ago

@broyuken I have the opposite problem, my lights won't do instant and insist on transitioning over several seconds, which is worse because the value reports back by MQTT instantly, before it's had a chance to change meaning that a light that is actually off still shows as on, and vice-versa because the values didn't wait for the transition before updating.

robertsLando commented 4 years ago

Transition is a configuration vaueid


Daniel

On 2 Jun 2020, at 04:51, ve6rah notifications@github.com wrote:

 @robertsLando are you able to turn a light on over 30 seconds? or is it only instant on/off? @broyuken I have the opposite problem, my lights won't do instant and insist on transitioning over several seconds, which is worse because the value reports back by MQTT instantly, before it's had a chance to change meaning that a light that is actually off still shows as on, and vice-versa because the values didn't wait for the transition before updating.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

broyuken commented 4 years ago

Transition is a configuration vaueid

That doesn’t help me in any way. What does that mean for my issue? Does it mean z2m can’t do it?

robertsLando commented 4 years ago

We already spoke about this, there is no transition in openzwave, it's a device feature and it usually is configured from a device parameter (in configuration section) if he has it. I don't know if and how you could do it with hass but this is not a bug with z2m