better sensor names, add via_device

pull/106/head
Jeff Culverhouse 11 months ago
parent 74c5142714
commit 564fb1812a

@ -1 +1 @@
0.99.6 0.99.7

@ -256,13 +256,13 @@ def config_home_assistant(device):
"availability_topic": device["topics"]["status"], "availability_topic": device["topics"]["status"],
"qos": config['mqtt']['qos'], "qos": config['mqtt']['qos'],
"device": { "device": {
"name": f"{vendor} {device_type}", "name": f"{vendor} {device_type} - {device_name}",
"manufacturer": vendor, "manufacturer": vendor,
"model": device_type, "model": device_type,
"identifiers": serial_number, "identifiers": serial_number,
"sw_version": amcrest_version, "sw_version": amcrest_version,
"hw_version": hw_version, "hw_version": hw_version,
"via_device": "amcrest2mqtt", "via_device": f"amcrest2mqtt v{version}",
}, },
} }
@ -294,7 +294,7 @@ def config_home_assistant(device):
"payload_on": "on", "payload_on": "on",
"payload_off": "off", "payload_off": "off",
"device_class": "motion", "device_class": "motion",
"name": f"{device_name} Human", "name": "Human",
"unique_id": f"{serial_number}.human", "unique_id": f"{serial_number}.human",
}, },
json=True, json=True,
@ -309,7 +309,7 @@ def config_home_assistant(device):
"payload_on": "on", "payload_on": "on",
"payload_off": "off", "payload_off": "off",
"device_class": "motion", "device_class": "motion",
"name": f"{device_name} Motion", "name": "Motion",
"unique_id": f"{serial_number}.motion", "unique_id": f"{serial_number}.motion",
}, },
json=True, json=True,
@ -323,7 +323,7 @@ def config_home_assistant(device):
"state_topic": device["topics"]["config"], "state_topic": device["topics"]["config"],
"value_template": "{{ value_json.sw_version }}", "value_template": "{{ value_json.sw_version }}",
"icon": "mdi:package-up", "icon": "mdi:package-up",
"name": f"{device_name} Version", "name": "Version",
"unique_id": f"{serial_number}.version", "unique_id": f"{serial_number}.version",
"entity_category": "diagnostic", "entity_category": "diagnostic",
"enabled_by_default": False "enabled_by_default": False
@ -339,7 +339,7 @@ def config_home_assistant(device):
"state_topic": device["topics"]["config"], "state_topic": device["topics"]["config"],
"value_template": "{{ value_json.serial_number }}", "value_template": "{{ value_json.serial_number }}",
"icon": "mdi:alphabetical-variant", "icon": "mdi:alphabetical-variant",
"name": f"{device_name} Serial Number", "name": "Serial Number",
"unique_id": f"{serial_number}.serial_number", "unique_id": f"{serial_number}.serial_number",
"entity_category": "diagnostic", "entity_category": "diagnostic",
"enabled_by_default": False "enabled_by_default": False
@ -355,7 +355,7 @@ def config_home_assistant(device):
"state_topic": device["topics"]["config"], "state_topic": device["topics"]["config"],
"value_template": "{{ value_json.host }}", "value_template": "{{ value_json.host }}",
"icon": "mdi:ip-network", "icon": "mdi:ip-network",
"name": f"{device_name} Host", "name": "Host",
"unique_id": f"{serial_number}.host", "unique_id": f"{serial_number}.host",
"entity_category": "diagnostic", "entity_category": "diagnostic",
"enabled_by_default": False "enabled_by_default": False
@ -372,7 +372,7 @@ def config_home_assistant(device):
"state_topic": device["topics"]["storage_used_percent"], "state_topic": device["topics"]["storage_used_percent"],
"unit_of_measurement": "%", "unit_of_measurement": "%",
"icon": "mdi:micro-sd", "icon": "mdi:micro-sd",
"name": f"{device_name} Storage Used %", "name": f"Storage Used %",
"object_id": f"{device_slug}_storage_used_percent", "object_id": f"{device_slug}_storage_used_percent",
"unique_id": f"{serial_number}.storage_used_percent", "unique_id": f"{serial_number}.storage_used_percent",
"entity_category": "diagnostic", "entity_category": "diagnostic",
@ -388,7 +388,7 @@ def config_home_assistant(device):
"state_topic": device["topics"]["storage_used"], "state_topic": device["topics"]["storage_used"],
"unit_of_measurement": "GB", "unit_of_measurement": "GB",
"icon": "mdi:micro-sd", "icon": "mdi:micro-sd",
"name": f"{device_name} Storage Used", "name": "Storage Used",
"unique_id": f"{serial_number}.storage_used", "unique_id": f"{serial_number}.storage_used",
"entity_category": "diagnostic", "entity_category": "diagnostic",
}, },
@ -403,7 +403,7 @@ def config_home_assistant(device):
"state_topic": device["topics"]["storage_total"], "state_topic": device["topics"]["storage_total"],
"unit_of_measurement": "GB", "unit_of_measurement": "GB",
"icon": "mdi:micro-sd", "icon": "mdi:micro-sd",
"name": f"{device_name} Storage Total", "name": "Storage Total",
"unique_id": f"{serial_number}.storage_total", "unique_id": f"{serial_number}.storage_total",
"entity_category": "diagnostic", "entity_category": "diagnostic",
}, },

Loading…
Cancel
Save