Skip to content

Commit acefb57

Browse files
committed
Openzwave, forcing getting product id/type when not set on new value update
1 parent 9ac0c0a commit acefb57

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

hardware/OpenZWave.cpp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ void COpenZWave::OnZWaveNotification(OpenZWave::Notification const* _notificatio
547547
{
548548
// Add the new value to our list
549549

550-
if (nodeInfo->Manufacturer_id.empty())
550+
if (nodeInfo->Manufacturer_name.empty())
551551
{
552552
nodeInfo->Manufacturer_id = pManager->GetNodeManufacturerId(_homeID, _nodeID);
553553
nodeInfo->Manufacturer_name = pManager->GetNodeManufacturerName(_homeID, _nodeID);
@@ -2579,6 +2579,34 @@ void COpenZWave::UpdateValue(const OpenZWave::ValueID &vID)
25792579
pDevice->orgInstanceID = vOrgInstance;
25802580
pDevice->orgIndexID = vOrgIndex;
25812581

2582+
if (
2583+
(pDevice->Manufacturer_id == 0) &&
2584+
(pDevice->Product_id == 0) &&
2585+
(pDevice->Product_type == 0)
2586+
)
2587+
{
2588+
COpenZWave::NodeInfo *pNode = GetNodeInfo(HomeID, NodeID);
2589+
if (pNode)
2590+
{
2591+
if (!pNode->Manufacturer_name.empty())
2592+
{
2593+
int xID;
2594+
std::stringstream ss;
2595+
ss << std::hex << pNode->Manufacturer_id;
2596+
ss >> xID;
2597+
pDevice->Manufacturer_id = xID;
2598+
std::stringstream ss2;
2599+
ss2 << std::hex << pNode->Product_id;
2600+
ss2 >> xID;
2601+
pDevice->Product_id = xID;
2602+
std::stringstream ss3;
2603+
ss3 << std::hex << pNode->Product_type;
2604+
ss3 >> xID;
2605+
pDevice->Product_type = xID;
2606+
}
2607+
}
2608+
}
2609+
25822610
switch (pDevice->devType)
25832611
{
25842612
case ZDTYPE_SWITCH_NORMAL:

main/WebServer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7248,7 +7248,7 @@ namespace http {
72487248
" A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description"
72497249
" FROM Scenes as A"
72507250
" LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1)"
7251-
" ORDER BY %s",
7251+
" ORDER BY %q",
72527252
szOrderBy);
72537253

72547254
if (result.size() > 0)
@@ -7429,7 +7429,7 @@ namespace http {
74297429
" A.Options "
74307430
"FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B "
74317431
"ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) "
7432-
"ORDER BY %s",
7432+
"ORDER BY %q",
74337433
szOrderBy);
74347434
}
74357435
}
@@ -7530,7 +7530,7 @@ namespace http {
75307530
"FROM DeviceStatus as A, SharedDevices as B "
75317531
"LEFT OUTER JOIN DeviceToPlansMap as C ON (C.DeviceRowID==A.ID)"
75327532
"WHERE (B.DeviceRowID==A.ID)"
7533-
" AND (B.SharedUserID==%lu) ORDER BY %s",
7533+
" AND (B.SharedUserID==%lu) ORDER BY %q",
75347534
m_users[iUser].ID, szOrderBy);
75357535
}
75367536
}

0 commit comments

Comments
 (0)