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

[HASS] cover device 'value_template' deprecated? #1327

Closed
bushvin opened this issue Jun 10, 2021 · 5 comments · Fixed by #1331
Closed

[HASS] cover device 'value_template' deprecated? #1327

bushvin opened this issue Jun 10, 2021 · 5 comments · Fixed by #1331
Assignees

Comments

@bushvin
Copy link
Contributor

bushvin commented Jun 10, 2021

Version

HA 2021.6.3

Run method: Docker

zwavejs2mqtt: 5.0.0
zwave-js: 7.7.3

Describe the bug

Fibaro fgr222 cover 'disappeared' after upgrading HA to 2021.6.3
Resulting in the following error in home assistant:

2021-06-11 00:25:48 ERROR (MainThread) [homeassistant.util.logging] Exception in async_discover when dispatching 'mqtt_discovery_new_cover_mqtt': ({'command_topic': 'zwave/fibaro_fgr222_00/38/0/targetValue/set', 'position_topic': 'zwave/fibaro_fgr222_00/38/0/currentValue', 'set_position_topic': 'zwave/fibaro_fgr222_00/38/0/targetValue/set', 'value_template': '{{ (value_json.value / 99 * 100) | round(0) }}', 'position_open': 99, 'position_closed': 0, 'payload_open': '99', 'payload_close': '0', 'device': {'identifiers': ['zwavejs2mqtt_0xc883eb3e_node18'], 'manufacturer': 'Fibargroup', 'model': 'Roller Shutter 2 (FGR222)', 'name': 'fibaro_fgr222_00', 'sw_version': '25.25'}, 'name': 'fibaro_fgr222_00_position', 'unique_id': 'zwavejs2mqtt_0xc883eb3e_Node18_position', 'platform': 'mqtt'},)

Traceback (most recent call last):                                                                            
File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)                                                                           
File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
    return schema(data)                                                                                       
File "/usr/src/homeassistant/homeassistant/components/mqtt/cover.py", line 118, in validate_options
    raise vol.Invalid(
voluptuous.error.Invalid: 'value_template' must be set together with 'state_topic'.                                                                                                                                     

During handling of the above exception, another exception occurred:
                                                                                                            
Traceback (most recent call last):                                                                            
File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 160, in async_discover
    config = schema(discovery_payload)                                                                        
File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 218, in __call__
    return self._exec((Schema(val) for val in self.validators), v)                                            
File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 341, in _exec
    raise e if self.msg is None else AllInvalid(self.msg, path=path)
File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 337, in _exec
    v = func(v)                                                                                               
File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 276, in __call__
    raise er.MultipleInvalid([e])                                                                           
voluptuous.error.MultipleInvalid: 'value_template' must be set together with 'state_topic'.

Apparently 2021.6.3 breaks mqtt in certain cases:

Using value_template to use for extracting position is no longer allowed an error will be raised if this configuration is used, Instead of using value_template, position_template should be used.

Source

Based on an issue for zigbee2mqtt, is this something that needs fixing in zwavejs2mqtt?

@robertsLando
Copy link
Member

Yep, seems that the fix needed is:

Using value_template to use for extracting position is no longer allowed an error will be raised if this configuration is used, Instead of using value_template, position_template should be used.

@bushvin
Copy link
Contributor Author

bushvin commented Jun 11, 2021

Thank you very much for the swift response!

@bushvin
Copy link
Contributor Author

bushvin commented Jun 11, 2021

Do I need to clear something to get this working?
I updated the docker image to 5.0.1, removed my mosquitto db and cleaned the device and related entities, yet the same error persists.

When rediscovering the node, this is the result:

{
  "type": "cover",
  "object_id": "position",
  "values": [
    "38-0-currentValue",
    "38-0-targetValue"
  ],
  "discovery_payload": {
    "command_topic": "zwave/fibaro_fgr222_00/38/0/targetValue/set",
    "position_topic": "zwave/fibaro_fgr222_00/38/0/currentValue",
    "set_position_topic": "zwave/fibaro_fgr222_00/38/0/targetValue/set",
    "value_template": "{{ (value_json.value / 99 * 100) | round(0) }}",
    "position_open": 99,
    "position_closed": 0,
    "payload_open": "99",
    "payload_close": "0",
    "device": {
      "identifiers": [
        "zwavejs2mqtt_0xc883eb3e_node18"
      ],
      "manufacturer": "Fibargroup",
      "model": "Roller Shutter 2 (FGR222)",
      "name": "fibaro_fgr222_00",
      "sw_version": "25.25"
    },
    "name": "fibaro_fgr222_00_position",
    "unique_id": "zwavejs2mqtt_0xc883eb3e_Node18_position"
  },
  "discoveryTopic": "cover/fibaro_fgr222_00/position/config",
  "persistent": false,
  "ignoreDiscovery": false,
  "id": "cover_position"
}

As you can see value_template is still there...
I've manually updated the value_template to position_template, to see what happens...

@bushvin
Copy link
Contributor Author

bushvin commented Jun 12, 2021

I believe there was one entry you may have omitted.
I updated it and submnitted a PR #1336

@robertsLando
Copy link
Member

Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants