-
Notifications
You must be signed in to change notification settings - Fork 847
Changing WebUI to support end-user setting display BLE advertised device name vs current model_id #2218
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
base: development
Are you sure you want to change the base?
Changing WebUI to support end-user setting display BLE advertised device name vs current model_id #2218
Conversation
…t drop down rather than checkbox
…eviceName and ForceDeviceName
…t drop down rather than checkbox
…teway using via_device as it should be the gateway mac address not name
I'll leave the final review to @1technophile, and I only skimmed over this as I'm getting ready for some travels tomorrow ;) but just a few comments.
I think this should definitely stay Metric and Imperial (Metric false). While temperature with Celsius and Fahrenheit is definitely the most common occurrence of this distinction, there are also other units like length in millimetres or inches for the Mopeka sensors for example, for which a temperature setting wouldn't make sense at all. Also for consistency, as the runtime MQTT command to change this setting is aptly called Any published JAON should always still keep both Metric and Imperial properties, and this setting is only really applicable to BLE and RTL_433 devices being displayed in the WebUI display and the LilyGo OLED display it mimics. I hope this makes sense. |
I agree with @DigiH we should keep the setting as Metric/Imperial with Metric being the default. |
Hi @1technophile and @DigiH I have cleaned up this PR to just be the Display Name drop down option in the WebUI. Hopefully the screenshots clarify the reasoning behind making the change. |
Something I have noticed @1technophile with the I think I have narrowed it down to
I think it's because when the I am using a Wemos D1 ESP32.
Commenting out the |
To shorten my ramblings above ;) • This setting will only reliably work for devices which are defined as requiring active scanning to be recognised by Decoder. That is roughly 1/3 of decoders. • It might also work for devices which are recognised through passive scanning by Decoder, only if and when • Devices which never broadcast any name will always be discovered by their model_id. |
Hi @1technophile and @DigiH I think this PR is ready to go. It now supports |
@plambrechtsen How did you address the concerns above about this possibly only reliably working with 30% of devices? Do you have other BLE devices which allow for passive scanning you can test this with? I'm also a bit confused about the new discovery addition. Individual device discoveries should only really exist for devices which have additional connection only properties, but not for an rssi discovery of just one single device (group). AFAIK it was a deliberate decision not to discover rssi, but if this changed it should be properly implemented for all devices. Currently, adding an rssi discovery, or any non-decoder included property of other devices, can easily be achieved by manually publishing such discovery messages. @1technophile will be better suited to fully comment on this though |
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoWebUI/config -m {"displayMetric":false}` | ||
|
||
### Display name as advetised Bluetooth name or `model_id` | ||
There is a build property of ForceDeviceName which forces devices when they are added in Home Assistant auto-discovery to be created with their Bluetooth advertised name isntead of their `model_id`. The default naming is `model_id` with `{"displayDeviceName":true}`. If you have enabled auto-discovery then a restart is required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo instead
main/gatewayBT.cpp
Outdated
BTConfig.scanDuration = MinScanDuration; | ||
Log.notice(F("Active and continuous scanning required, parameters adapted" CR)); | ||
stateBTMeasures(false); | ||
// stateBTMeasures(false); // Disabling as it casues a segfault |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to increase the stack size of the task:
OpenMQTTGateway/main/gatewayBT.cpp
Line 873 in ddb9cc6
9500, /* Stack size in bytes */ |
and see if you still get the issue
main/gatewayBT.cpp
Outdated
} | ||
Log.notice(F("Passive continuous scanning required, parameters adapted" CR)); | ||
stateBTMeasures(false); | ||
// stateBTMeasures(false); // Disabling as it casues a segfault |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same a s above
} | ||
} else if (BLEdata.containsKey("cont") && BTConfig.BLEinterval != MinTimeBtwScan) { | ||
if (BLEdata["cont"]) { | ||
} else if (BLEdata.containsKey("acts") && BTConfig.BLEinterval != MinTimeBtwScan) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DigiH Are you okay with this ?
Just an afterthought? Has this been tested against the common occurrence of users having lots of devices already discovered with the previous model_id entity names , placed on dashboards and used in automations. Now with the change to broadcast name, would the new discovery-entries now not create new entity names, for applicable devices, breaking all the previous ones because of the new Just some theoretical scenario thinking again from me :) |
Changing WebUI to include display device name as a parameter.
Description:
When a device is created in Home Assistant using automatic discovery it is named by the model_id. This can be changed using the build parameter ForceDeviceName but this change introduces this as a setting in WebUI. So now devices can be named by their BLE advertised device name rather than the model_id.
Also added a xxWSD0xMMCDiscovery DiscoveryFromList including the RSSI so that all values are named nicely by default when the displayDeviceName flag is true.
When the flag is false the existing behavior is unchanged.
In Home Assistant the devices will be named as well as the entities by either their model_id or nevice name
Checklist: