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

ZWaveJS UI : Should still display Z-Wave devices without names #2083

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion front/src/config/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@
},
"discover": {
"title": "Auf Ihrer Z-Wave JS UI Instanz erkannte Geräte",
"description": "Z-Wave JS UI Geräte werden automatisch erkannt. Achtung, hier werden nur Geräte mit einem Namen und einem \"Standort\" angezeigt. Wenn Sie diese Einstellungen bearbeiten, müssen Sie das Gerät in Gladys erneut verbinden.",
"description": "Z-Wave JS UI-Geräte werden automatisch erkannt.",
"error": "Fehler beim Erkennen von Z-Wave JS UI Geräten. Ist Ihr MQTT-Broker gut erreichbar und verfügbar?",
"noDeviceFound": "Kein Z-Wave JS UI Gerät wurde erkannt.",
"errorWhileScanning": "Fehler bei der Erkennung aufgetreten.",
Expand Down
2 changes: 1 addition & 1 deletion front/src/config/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@
},
"discover": {
"title": "Devices detected on your Z-Wave JS UI instance",
"description": "Z-Wave JS UI devices are automatically discovered. Note that only devices with a name are displayed here.",
"description": "Z-Wave JS UI devices are automatically discovered.",
"error": "Error discovering Z-Wave JS UI devices. Is your MQTT broker available and accessible?",
"noDeviceFound": "No Z-Wave JS UI devices were discovered.",
"errorWhileScanning": "An error occurred during discovery.",
Expand Down
2 changes: 1 addition & 1 deletion front/src/config/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@
},
"discover": {
"title": "Appareils détectés sur votre instance Z-Wave JS UI",
"description": "Les appareils Z-Wave JS UI sont automatiquement découverts. Attention, seuls les appareils avec un nom sont affichés ici.",
"description": "Les appareils Z-Wave JS UI sont automatiquement découverts.",
"error": "Erreur de découverte des appareils Z-Wave JS UI. Est-ce que votre broker MQTT est bien disponible et accessible ?",
"noDeviceFound": "Aucun appareil Z-Wave JS UI n'a été découvert.",
"errorWhileScanning": "Une erreur est survenue lors de la découverte.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ async function onNewDeviceDiscover(data) {
const devices = [];
const zwaveDevices = [];
data.result.forEach((zwaveJSDevice) => {
if (zwaveJSDevice.name && zwaveJSDevice.name.length > 0) {
zwaveDevices.push(zwaveJSDevice);
devices.push(convertToGladysDevice(this.serviceId, zwaveJSDevice));
}
zwaveDevices.push(zwaveJSDevice);
devices.push(convertToGladysDevice(this.serviceId, zwaveJSDevice));
});
this.devices = devices;
this.zwaveJSDevices = zwaveDevices;
Expand Down
2 changes: 1 addition & 1 deletion server/services/zwavejs-ui/utils/convertToGladysDevice.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const convertToGladysDevice = (serviceId, zwaveJsDevice) => {
});

return {
name: zwaveJsDevice.name,
name: zwaveJsDevice.name || '',
external_id: `zwavejs-ui:${zwaveJsDevice.id}`,
selector: `zwavejs-ui:${zwaveJsDevice.id}`,
service_id: serviceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ describe('zwaveJSUIHandler.onNewDeviceDiscover.js', () => {
const zwaveJSUIHandler = new ZwaveJSUIHandler(gladys, {}, serviceId);
await zwaveJSUIHandler.onNewDeviceDiscover(exampleData);
expect(zwaveJSUIHandler.devices).to.deep.equal([
{
name: '',
external_id: 'zwavejs-ui:1',
selector: 'zwavejs-ui:1',
service_id: 'ffa13430-df93-488a-9733-5c540e9558e0',
should_poll: false,
features: [],
params: [{ name: 'location', value: '' }],
},
{
name: 'capteur-ouverture',
external_id: 'zwavejs-ui:2',
Expand Down