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

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

Open
RenierM26 opened this issue Apr 29, 2024 · 2 comments
Open

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

RenierM26 opened this issue Apr 29, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@RenierM26
Copy link

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"
}
}
]
}
}
}

@RenierM26 RenierM26 added the bug Something isn't working label Apr 29, 2024
@make-all
Copy link
Owner

make-all commented May 15, 2024

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 added a commit that referenced this issue May 29, 2024
translation_key uses device class as a fallback (to allow overriding
names/icons based on classes in the translation files).  But this means
we falsely detect unnamed switches with a device class as having a name.
Check if the translation_key is the same as device_class before telling
HA not to use the default name.

Issue #1856
@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release labels May 29, 2024
@make-all make-all removed bug Something isn't working awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release labels Jun 9, 2024
@make-all make-all closed this as completed Jun 9, 2024
@make-all make-all reopened this Jul 12, 2024
@make-all make-all added the bug Something isn't working label Jul 12, 2024
@make-all
Copy link
Owner

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"

make-all added a commit that referenced this issue Jul 15, 2024
…lass"

This reverts commit 065ece9.
Issue #1856

This change interferes with sensor naming.

I'm not sure why the sensor naming based on class translations is
working, but switches are not in #1856
timlaing pushed a commit to timlaing/tuya-local that referenced this issue Aug 8, 2024
translation_key uses device class as a fallback (to allow overriding
names/icons based on classes in the translation files).  But this means
we falsely detect unnamed switches with a device class as having a name.
Check if the translation_key is the same as device_class before telling
HA not to use the default name.

Issue make-all#1856
timlaing pushed a commit to timlaing/tuya-local that referenced this issue Aug 8, 2024
…lass"

This reverts commit 065ece9.
Issue make-all#1856

This change interferes with sensor naming.

I'm not sure why the sensor naming based on class translations is
working, but switches are not in make-all#1856
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants