make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.28k stars 505 forks source link

All my switch entity names have None appended to name. #1856

Open RenierM26 opened 5 months ago

RenierM26 commented 5 months ago

Describe the bug All my switch entities have None Appended to their names.

Example: Combo bedroom outlet 1 None

To Reproduce All switch entities have None appended to their names.

Expected behavior Switch entities should not have none appened to their name. I'm guessing the None is set a string somewhere by accident.

Additional context Started about 2 - 3 releases back.

If the bug involves a device, then please include device diagnostics from Settings / Devices & Services / Tuya Local (your device) / "1 device":

"integration_manifest": { "domain": "tuya_local", "name": "Tuya Local", "codeowners": [ "@make-all" ], "config_flow": true, "dependencies": [], "documentation": "https://github.com/make-all/tuya-local", "integration_type": "device", "iot_class": "local_push", "issue_tracker": "https://github.com/make-all/tuya-local/issues", "requirements": [ "tinytuya==1.13.2" ], "version": "2024.4.0", "is_built_in": false }, "data": { "name": "Combo bedroom outlet 1", "type": "cbi_astute_outdoor_smartswitch", "device_id": "REDACTED", "device_cid": "", "local_key": "REDACTED", "host": "REDACTED", "protocol_version": 3.3, "tinytuya_version": "1.13.2", "api_version_set": 3.3, "api_version_used": 3.3, "api_working": true, "status": {}, "cached_state": { "updated_at": 1714368864.6771305, "1": true, "7": 0, "14": "on", "20": 6, "21": 109, "22": 2386, "23": 139 }, "pending_state": {}, "connected": true, "force_dps": [ 20, 21, 23, 22 ], "home_assistant": { "name": "Combo bedroom outlet 1", "name_by_user": null, "disabled": false, "disabled_by": null, "entities": [ { "disabled": false, "disabled_by": null, "entity_category": null, "device_class": "outlet", "original_device_class": "switch", "icon": null, "unit_of_measurement": null, "state": { "entity_id": "switch.combo_bedroom_outlet_1", "state": "on", "attributes": { "device_class": "outlet", "friendly_name": "Combo bedroom outlet 1 None" }, "last_changed": "2024-04-28T16:58:28.192370+00:00", "last_reported": "2024-04-28T16:58:28.224705+00:00", "last_updated": "2024-04-28T16:58:28.192370+00:00" } }, { "disabled": false, "disabled_by": null, "entity_category": "diagnostic", "device_class": null, "original_device_class": "energy", "icon": null, "unit_of_measurement": "Wh", "state": { "entity_id": "sensor.combo_bedroom_outlet_1_energy", "state": "6", "attributes": { "state_class": "total_increasing", "unit_of_measurement": "Wh", "device_class": "energy", "friendly_name": "Combo bedroom outlet 1 Energy" }, "last_changed": "2024-04-29T04:11:36.328307+00:00", "last_reported": "2024-04-29T04:11:36.328307+00:00", "last_updated": "2024-04-29T04:11:36.328307+00:00" } }, { "disabled": false, "disabled_by": null, "entity_category": "diagnostic", "device_class": null, "original_device_class": "current", "icon": null, "unit_of_measurement": "A", "state": { "entity_id": "sensor.combo_bedroom_outlet_1_current", "state": "0.109", "attributes": { "state_class": "measurement", "unit_of_measurement": "A", "device_class": "current", "friendly_name": "Combo bedroom outlet 1 Current" }, "last_changed": "2024-04-29T05:34:24.677764+00:00", "last_reported": "2024-04-29T05:34:24.677764+00:00", "last_updated": "2024-04-29T05:34:24.677764+00:00" } }, { "disabled": false, "disabled_by": null, "entity_category": "diagnostic", "device_class": null, "original_device_class": "power", "icon": null, "unit_of_measurement": "W", "state": { "entity_id": "sensor.combo_bedroom_outlet_1_power", "state": "13.9", "attributes": { "state_class": "measurement", "unit_of_measurement": "W", "device_class": "power", "friendly_name": "Combo bedroom outlet 1 Power" }, "last_changed": "2024-04-29T05:34:24.678066+00:00", "last_reported": "2024-04-29T05:34:24.678066+00:00", "last_updated": "2024-04-29T05:34:24.678066+00:00" } }, { "disabled": false, "disabled_by": null, "entity_category": "diagnostic", "device_class": null, "original_device_class": "voltage", "icon": null, "unit_of_measurement": "V", "state": { "entity_id": "sensor.combo_bedroom_outlet_1_voltage", "state": "238.6", "attributes": { "state_class": "measurement", "unit_of_measurement": "V", "device_class": "voltage", "friendly_name": "Combo bedroom outlet 1 Voltage" }, "last_changed": "2024-04-29T05:34:24.678271+00:00", "last_reported": "2024-04-29T05:34:24.678271+00:00", "last_updated": "2024-04-29T05:34:24.678271+00:00" } }, { "disabled": false, "disabled_by": null, "entity_category": "config", "device_class": null, "original_device_class": null, "icon": null, "unit_of_measurement": null, "state": { "entity_id": "select.combo_bedroom_outlet_1_initial_state", "state": "On", "attributes": { "options": [ "On", "Off", "Last State" ], "icon": "mdi:toggle-switch", "friendly_name": "Combo bedroom outlet 1 Initial state" }, "last_changed": "2024-04-28T16:58:28.192537+00:00", "last_reported": "2024-04-28T16:58:28.192537+00:00", "last_updated": "2024-04-28T16:58:28.192537+00:00" } }, { "disabled": false, "disabled_by": null, "entity_category": "config", "device_class": null, "original_device_class": null, "icon": null, "unit_of_measurement": "min", "state": { "entity_id": "number.combo_bedroom_outlet_1_timer", "state": "0.0", "attributes": { "min": 0.0, "max": 1440.0, "step": 1.0, "mode": "auto", "unit_of_measurement": "min", "friendly_name": "Combo bedroom outlet 1 Timer" }, "last_changed": "2024-04-28T16:58:28.193367+00:00", "last_reported": "2024-04-28T16:58:28.193367+00:00", "last_updated": "2024-04-28T16:58:28.193367+00:00" } }, { "disabled": false, "disabled_by": null, "entity_category": null, "device_class": null, "original_device_class": "energy", "icon": null, "unit_of_measurement": null, "state": { "entity_id": "sensor.combo_bedroom_outlet_1_energy_2", "state": "24.96", "attributes": { "state_class": "total", "source": "sensor.combo_bedroom_outlet_1_power", "unit_of_measurement": "kWh", "device_class": "energy", "friendly_name": "Combo bedroom outlet 1 energy" }, "last_changed": "2024-04-29T05:24:11.671474+00:00", "last_reported": "2024-04-29T05:24:11.671474+00:00", "last_updated": "2024-04-29T05:24:11.671474+00:00" } } ] } } }

make-all commented 4 months ago

For some reason switches with class defined are not using the translated names defined in https://github.com/home-assistant/core/blob/dev/homeassistant/components/switch/strings.json and are instead outputting None. This is working for other entity types.

I see this is not happening in Dashboards (the device name appears without the "None", but still without the translated name "Outlet" or "Switch"), but only in the Developer tools and Settings.

make-all commented 2 months ago

Reverted this fix, as it has a side effect of translated sensor names according to their class not appearing. The original bug only appears to affect switches, while sensors, binary_sensors and numbers all have standard classes that correctly display as translated names, not "None"