Add node firmware to ozw device registry (#38330)

This commit is contained in:
DelusionalAI 2020-08-06 09:50:51 -05:00 committed by GitHub
parent 39e6bca682
commit 988d3e9373
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 4 deletions

View File

@ -114,7 +114,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
# Filter out CommandClasses we're definitely not interested in. # Filter out CommandClasses we're definitely not interested in.
if value.command_class in [ if value.command_class in [
CommandClass.VERSION,
CommandClass.MANUFACTURER_SPECIFIC, CommandClass.MANUFACTURER_SPECIFIC,
]: ]:
return return

View File

@ -7,6 +7,8 @@ from openzwavemqtt.const import (
EVENT_INSTANCE_STATUS_CHANGED, EVENT_INSTANCE_STATUS_CHANGED,
EVENT_VALUE_CHANGED, EVENT_VALUE_CHANGED,
OZW_READY_STATES, OZW_READY_STATES,
CommandClass,
ValueIndex,
) )
from openzwavemqtt.models.node import OZWNode from openzwavemqtt.models.node import OZWNode
from openzwavemqtt.models.value import OZWValue from openzwavemqtt.models.value import OZWValue
@ -182,12 +184,18 @@ class ZWaveDeviceEntity(Entity):
node = self.values.primary.node node = self.values.primary.node
node_instance = self.values.primary.instance node_instance = self.values.primary.instance
dev_id = create_device_id(node, self.values.primary.instance) dev_id = create_device_id(node, self.values.primary.instance)
node_firmware = node.get_value(
CommandClass.VERSION, ValueIndex.VERSION_APPLICATION
)
device_info = { device_info = {
"identifiers": {(DOMAIN, dev_id)}, "identifiers": {(DOMAIN, dev_id)},
"name": create_device_name(node), "name": create_device_name(node),
"manufacturer": node.node_manufacturer_name, "manufacturer": node.node_manufacturer_name,
"model": node.node_product_name, "model": node.node_product_name,
} }
if node_firmware is not None:
device_info["sw_version"] = node_firmware.value
# device with multiple instances is split up into virtual devices for each instance # device with multiple instances is split up into virtual devices for each instance
if node_instance > 1: if node_instance > 1:
parent_dev_id = create_device_id(node) parent_dev_id = create_device_id(node)

View File

@ -4,7 +4,7 @@
"config_flow": true, "config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/ozw", "documentation": "https://www.home-assistant.io/integrations/ozw",
"requirements": [ "requirements": [
"python-openzwave-mqtt==1.0.2" "python-openzwave-mqtt==1.0.4"
], ],
"after_dependencies": [ "after_dependencies": [
"mqtt" "mqtt"

View File

@ -1734,7 +1734,7 @@ python-nest==4.1.0
python-nmap==0.6.1 python-nmap==0.6.1
# homeassistant.components.ozw # homeassistant.components.ozw
python-openzwave-mqtt==1.0.2 python-openzwave-mqtt==1.0.4
# homeassistant.components.qbittorrent # homeassistant.components.qbittorrent
python-qbittorrent==0.4.1 python-qbittorrent==0.4.1

View File

@ -791,7 +791,7 @@ python-miio==0.5.3
python-nest==4.1.0 python-nest==4.1.0
# homeassistant.components.ozw # homeassistant.components.ozw
python-openzwave-mqtt==1.0.2 python-openzwave-mqtt==1.0.4
# homeassistant.components.songpal # homeassistant.components.songpal
python-songpal==0.12 python-songpal==0.12