-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Safe adding device #2174
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
Safe adding device #2174
Conversation
…to development
…to domoticz-development
…to domoticz-development
…to development
|
Reference to #2146 |
|
Thanks for the patch ! Would it not be better if all those hardware classes where using the 'general' way of adding/sending sensors in domoticz by using the functions There is on hardware class that is changing the switch type, with this patch the new function is always returning the new ID which causes all calls to be slower... and 'UpdateValueInt' is used quite a lot.. |
|
SendSwitch etc works only for switch. New method is working for all types of device. Method returns ID, because one (only eHouseTCP) of call using it :( This method don't calls UpdateValueInt. It is universal. Now nobody will call "INSERT INTO DEVICESTATUS..." without permision etc The next good change is that you do not have to call "UPDATE DEVICE STATUS" for change switchtype etc. after insert. And this method is better that UpdateValueInt or SendSwitch etc, because it only add device. Not calls Events, notifications etc. Because for new device, this 'things' not exists yet. |
|
UpdateValueInt is called by 'CSQLHelper::UpdateValue' which is called a lot But again, It would be good if all classes used the basic/standard way of adding/updating sensors, SendSwitch is just an example, SendTempSensor is another |
|
But my method dont call UpdateValue or UpdateValueInt. Is faster then SendSwitch etc. |
|
Thanks for the explanation. |
|
I also think that those classes should use the default methods to insert new hardware in domoticz, and that is to call the functions from CDomoticzHardwareBase class. |
|
Ok. I will try change it tomorrow. |
…to development
|
Sorry, got a merge problem again, is it possible to review it again ? |
|
Thanks for the changes, but do we need those type castings ? int(pTypeLighting2) If possible, please remove them also, makes the code clearer too ;) (I know they are not your castings) |
|
castings removed |
|
Those classes as mentioned in the issue, should use the default methods to update sensors (with the functions in DomoticzHardware.cpp) |
|
Another possibility was to use m_mainworker.PushAndWaitRxMessage(this, (const unsigned char *)&gswitch, pDevice->label.c_str(), BatLevel); See for example the ZWaveBase.cpp Also when you directly insert/updata data, you are also bypassing all pushers (client/server/mqtt/...) and possible other notification systems |
|
Thanks for the patch ! But most classes should be rewritten to use the internal functions |
|
All hardware classes should use the SendXXXX functions from the basehardware class |
No description provided.