Closed jacek12345 closed 1 year ago
@jacek12345 it is not allowed to add one parameter into multiple devices. We will add checks internally so that the esp_rmaker_device_add_param()
API will throw an error if the given param is already part of another device.
In your case, please create a new param and then add it to the light.
There is in docummentation, that Parameter name should be unique in a given device.
Ok, I understand, parameter name is not the same as parameter handle. We can't add the same parameter (using the same handle) to different devices.
But I'm not sure if it shouldn't be possible with RainMaker. Especially if it generally works if we use one common parameter. It looks rather that there is problem in esp_rmaker_device_add_param()
@jacek12345 Yes, the name can repeat in other devices, but the param object itself needs to be unique. So, you will have to create a 3rd custom param (with the same name "MY PARAM 1" if you wish) and then add it to your light device.
@jacek12345 , the parameter object itself has quite some metadata associated with it, including its value, bounds, UI type, etc. Even if bounds, UI type, etc. could be same, the value itself would typically not be the same and will have to be individually modifiable and hence, require different objects.
OK, thank You. Closing, but rethink it please, as it would be very convenient to have some main multidevice parameters viewable (and modifiable or not) from different device tabs. Especially, that it works if we use only one 'common' parameter (when modified in one device, it is reported also to other devices that have this parameter registered). Is it fortuitously?
I replicated issue on multidevice example. Scenario is as follows:
Adding both params to switch_device:
adding only one (first) param to light_device
I (4892) esp_rmaker_param: Reporting params (init): {"Switch":{"Name":"Switch","Power":true,"MY PARAM 1":false,"MY PARAM 2":false},"Light":{"Name":"Light","Power":true,"Brightness":25,"MY PARAM 1":false,"MY PARAM 2":false},"Fan":{"Name":"Fan","Power":false,"Speed":3},"Temperature Sensor":{"Name":"Temperature Sensor","Temperature":25.00000},"Time":{"TZ":"Europe/Warsaw","TZ-POSIX":"CET-1CEST,M3.5.0,M10.5.0/3"},"Schedule":{"Schedules":[]},"Scenes":{"Scenes":[]},"Local Control":{"POP":"62735eb3","Type":1}}
Additional informations: