@@ -164,6 +164,16 @@ extern std::string szUserDataFolder;
164
164
165
165
#define round (a ) ( int ) ( a + .5 )
166
166
167
+ // Should be obsolete when OZW 2.0 comes out
168
+ uint16_t GetUInt16FromString (const std::string& inStr)
169
+ {
170
+ uint16_t xID;
171
+ std::stringstream ss;
172
+ ss << std::hex << inStr;
173
+ ss >> xID;
174
+ return xID;
175
+ }
176
+
167
177
#ifdef _DEBUG
168
178
#define DEBUG_ZWAVE_INT
169
179
#endif
@@ -559,10 +569,10 @@ void COpenZWave::OnZWaveNotification(OpenZWave::Notification const* _notificatio
559
569
nodeInfo.Application_version = 0 ;
560
570
nodeInfo.szType = m_pManager->GetNodeType (_homeID, _nodeID);
561
571
nodeInfo.iVersion = m_pManager->GetNodeVersion (_homeID, _nodeID);
562
- nodeInfo.Manufacturer_id = m_pManager->GetNodeManufacturerId (_homeID, _nodeID);
563
572
nodeInfo.Manufacturer_name = m_pManager->GetNodeManufacturerName (_homeID, _nodeID);
564
- nodeInfo.Product_type = m_pManager->GetNodeProductType (_homeID, _nodeID);
565
- nodeInfo.Product_id = m_pManager->GetNodeProductId (_homeID, _nodeID);
573
+ nodeInfo.Manufacturer_id = GetUInt16FromString (m_pManager->GetNodeManufacturerId (_homeID, _nodeID));
574
+ nodeInfo.Product_type = GetUInt16FromString (m_pManager->GetNodeProductType (_homeID, _nodeID));
575
+ nodeInfo.Product_id = GetUInt16FromString (m_pManager->GetNodeProductId (_homeID, _nodeID));
566
576
nodeInfo.Product_name = m_pManager->GetNodeProductName (_homeID, _nodeID);
567
577
nodeInfo.tClockDay = -1 ;
568
578
nodeInfo.tClockHour = -1 ;
@@ -624,10 +634,10 @@ void COpenZWave::OnZWaveNotification(OpenZWave::Notification const* _notificatio
624
634
if (nodeInfo->Manufacturer_name .empty ())
625
635
{
626
636
nodeInfo->IsPlus = m_pManager->IsNodeZWavePlus (_homeID, _nodeID);
627
- nodeInfo->Manufacturer_id = m_pManager->GetNodeManufacturerId (_homeID, _nodeID);
628
637
nodeInfo->Manufacturer_name = m_pManager->GetNodeManufacturerName (_homeID, _nodeID);
629
- nodeInfo->Product_type = m_pManager->GetNodeProductType (_homeID, _nodeID);
630
- nodeInfo->Product_id = m_pManager->GetNodeProductId (_homeID, _nodeID);
638
+ nodeInfo->Manufacturer_id = GetUInt16FromString (m_pManager->GetNodeManufacturerId (_homeID, _nodeID));
639
+ nodeInfo->Product_type = GetUInt16FromString (m_pManager->GetNodeProductType (_homeID, _nodeID));
640
+ nodeInfo->Product_id = GetUInt16FromString (m_pManager->GetNodeProductId (_homeID, _nodeID));
631
641
}
632
642
633
643
nodeInfo->Instances [instance][commandClass].Values .push_back (vID);
@@ -850,10 +860,10 @@ void COpenZWave::OnZWaveNotification(OpenZWave::Notification const* _notificatio
850
860
if (nodeInfo->Product_name != product_name)
851
861
{
852
862
nodeInfo->IsPlus = m_pManager->IsNodeZWavePlus (_homeID, _nodeID);
853
- nodeInfo->Manufacturer_id = m_pManager->GetNodeManufacturerId (_homeID, _nodeID);
854
863
nodeInfo->Manufacturer_name = m_pManager->GetNodeManufacturerName (_homeID, _nodeID);
855
- nodeInfo->Product_type = m_pManager->GetNodeProductType (_homeID, _nodeID);
856
- nodeInfo->Product_id = m_pManager->GetNodeProductId (_homeID, _nodeID);
864
+ nodeInfo->Manufacturer_id = GetUInt16FromString (m_pManager->GetNodeManufacturerId (_homeID, _nodeID));
865
+ nodeInfo->Product_type = GetUInt16FromString (m_pManager->GetNodeProductType (_homeID, _nodeID));
866
+ nodeInfo->Product_id = GetUInt16FromString (m_pManager->GetNodeProductId (_homeID, _nodeID));
857
867
nodeInfo->Product_name = product_name;
858
868
AddNode (_homeID, _nodeID, nodeInfo);
859
869
m_bHaveLastIncludedNodeInfo = !product_name.empty ();
@@ -1430,18 +1440,14 @@ bool COpenZWave::SwitchColor(const int nodeID, const int instanceID, const int c
1430
1440
_log.Log (LOG_ERROR, " OpenZWave: Node has failed (or is not alive), Switch command not sent! (NodeID: %d, 0x%02x)" , nodeID, nodeID);
1431
1441
return false ;
1432
1442
}
1433
- // TODO: remove this print once Ziapto Bulb 2 workaround has been verified
1434
- // Gizmocuz: This has been in for quite some while, is it verified ?
1435
- // _log.Debug(DEBUG_NORM, "OpenZWave::SwitchColor Manufacturer_id: '%s', Product_type: '%s', Product_id: '%s', Application_version: %u",
1436
- // pNode->Manufacturer_id.c_str(), pNode->Product_type.c_str(), pNode->Product_id.c_str(), pNode->Application_version);
1437
1443
1438
1444
OpenZWave::ValueID vID (0 , 0 , OpenZWave::ValueID::ValueGenre_Basic, 0 , 0 , 0 , OpenZWave::ValueID::ValueType_Bool);
1439
1445
if (GetValueByCommandClassLabel (nodeID, instanceID, COMMAND_CLASS_COLOR_CONTROL, " Color" , vID) == true )
1440
1446
{
1441
1447
std::string OutColorStr = ColorStr;
1442
- if (pNode->Manufacturer_id == " 0131 " )
1448
+ if (pNode->Manufacturer_id == 0x0131 )
1443
1449
{
1444
- if ((pNode->Product_type == " 0002 " ) && (pNode->Product_id == " 0002 " ))
1450
+ if ((pNode->Product_type == 0x0002 ) && (pNode->Product_id == 0x0002 ))
1445
1451
{
1446
1452
if (pNode->Application_version < 106 )
1447
1453
{
@@ -1452,7 +1458,7 @@ bool COpenZWave::SwitchColor(const int nodeID, const int instanceID, const int c
1452
1458
}
1453
1459
}
1454
1460
}
1455
- if ((pNode->Product_type == " 0002 " ) && (pNode->Product_id == " 0003 " ))
1461
+ if ((pNode->Product_type == 0x0002 ) && (pNode->Product_id == 0x0003 ))
1456
1462
{
1457
1463
if (pNode->Application_version < 106 )
1458
1464
{
@@ -1649,19 +1655,9 @@ void COpenZWave::AddValue(const OpenZWave::ValueID& vID, const NodeInfo* pNodeIn
1649
1655
_device.hasWakeup = m_pManager->IsNodeAwake (HomeID, NodeID);
1650
1656
_device.isListening = m_pManager->IsNodeListeningDevice (HomeID, NodeID);
1651
1657
1652
- int xID;
1653
- std::stringstream ss;
1654
- ss << std::hex << pNodeInfo->Manufacturer_id ;
1655
- ss >> xID;
1656
- _device.Manufacturer_id = xID;
1657
- std::stringstream ss2;
1658
- ss2 << std::hex << pNodeInfo->Product_id ;
1659
- ss2 >> xID;
1660
- _device.Product_id = xID;
1661
- std::stringstream ss3;
1662
- ss3 << std::hex << pNodeInfo->Product_type ;
1663
- ss3 >> xID;
1664
- _device.Product_type = xID;
1658
+ _device.Manufacturer_id = pNodeInfo->Manufacturer_id ;
1659
+ _device.Product_id = pNodeInfo->Product_id ;
1660
+ _device.Product_type = pNodeInfo->Product_type ;
1665
1661
1666
1662
if (!vLabel.empty ())
1667
1663
_device.label = vLabel;
@@ -1718,7 +1714,7 @@ void COpenZWave::AddValue(const OpenZWave::ValueID& vID, const NodeInfo* pNodeIn
1718
1714
{
1719
1715
if (IsNodeRGBW (HomeID, NodeID))
1720
1716
{
1721
- _device.label = " Fibaro RGBW" ;
1717
+ _device.label = " RGBW" ;
1722
1718
_device.devType = ZDTYPE_SWITCH_RGBW;
1723
1719
_device.instanceID = 100 ;
1724
1720
InsertDevice (_device);
@@ -3157,19 +3153,9 @@ void COpenZWave::UpdateValue(const OpenZWave::ValueID& vID)
3157
3153
{
3158
3154
if (!pNode->Manufacturer_name .empty ())
3159
3155
{
3160
- int xID;
3161
- std::stringstream ss;
3162
- ss << std::hex << pNode->Manufacturer_id ;
3163
- ss >> xID;
3164
- pDevice->Manufacturer_id = xID;
3165
- std::stringstream ss2;
3166
- ss2 << std::hex << pNode->Product_id ;
3167
- ss2 >> xID;
3168
- pDevice->Product_id = xID;
3169
- std::stringstream ss3;
3170
- ss3 << std::hex << pNode->Product_type ;
3171
- ss3 >> xID;
3172
- pDevice->Product_type = xID;
3156
+ pDevice->Manufacturer_id = pNode->Manufacturer_id ;
3157
+ pDevice->Product_id = pNode->Product_id ;
3158
+ pDevice->Product_type = pNode->Product_type ;
3173
3159
}
3174
3160
}
3175
3161
}
@@ -4848,21 +4834,9 @@ void COpenZWave::GetNodeValuesJson(const unsigned int homeID, const int nodeID,
4848
4834
ivalue++;
4849
4835
4850
4836
// Aeotec Blinking state
4851
- uint32_t Manufacturer_id;
4852
- uint32_t Product_type;
4853
- uint32_t Product_id;
4854
-
4855
- std::stringstream ss;
4856
- ss << std::hex << m_pManager->GetNodeManufacturerId (m_controllerID, m_controllerNodeId);
4857
- ss >> Manufacturer_id;
4858
-
4859
- std::stringstream ss2;
4860
- ss2 << std::hex << m_pManager->GetNodeProductId (m_controllerID, m_controllerNodeId);
4861
- ss2 >> Product_id;
4862
-
4863
- std::stringstream ss3;
4864
- ss3 << std::hex << m_pManager->GetNodeProductType (m_controllerID, m_controllerNodeId);
4865
- ss3 >> Product_type;
4837
+ uint16_t Manufacturer_id = GetUInt16FromString (m_pManager->GetNodeManufacturerId (m_controllerID, m_controllerNodeId));
4838
+ uint16_t Product_type = GetUInt16FromString (m_pManager->GetNodeProductType (m_controllerID, m_controllerNodeId));
4839
+ uint16_t Product_id = GetUInt16FromString (m_pManager->GetNodeProductId (m_controllerID, m_controllerNodeId));
4866
4840
4867
4841
if (Manufacturer_id == 0x0086 )
4868
4842
{
@@ -5147,21 +5121,9 @@ bool COpenZWave::ApplyNodeConfig(const unsigned int homeID, const int nodeID, co
5147
5121
}
5148
5122
else if (rvIndex == 8 )
5149
5123
{
5150
- uint32_t Manufacturer_id;
5151
- uint32_t Product_type;
5152
- uint32_t Product_id;
5153
-
5154
- std::stringstream ss;
5155
- ss << std::hex << m_pManager->GetNodeManufacturerId (m_controllerID, m_controllerNodeId);
5156
- ss >> Manufacturer_id;
5157
-
5158
- std::stringstream ss2;
5159
- ss2 << std::hex << m_pManager->GetNodeProductId (m_controllerID, m_controllerNodeId);
5160
- ss2 >> Product_id;
5161
-
5162
- std::stringstream ss3;
5163
- ss3 << std::hex << m_pManager->GetNodeProductType (m_controllerID, m_controllerNodeId);
5164
- ss3 >> Product_type;
5124
+ uint16_t Manufacturer_id = GetUInt16FromString (m_pManager->GetNodeManufacturerId (m_controllerID, m_controllerNodeId));
5125
+ uint16_t Product_type = GetUInt16FromString (m_pManager->GetNodeProductType (m_controllerID, m_controllerNodeId));
5126
+ uint16_t Product_id = GetUInt16FromString (m_pManager->GetNodeProductId (m_controllerID, m_controllerNodeId));
5165
5127
5166
5128
if (Manufacturer_id == 0x0086 )
5167
5129
{
@@ -5466,10 +5428,11 @@ namespace http {
5466
5428
root[" result" ][ii][" Description" ] = sd[4 ];
5467
5429
root[" result" ][ii][" PollEnabled" ] = (atoi (sd[5 ].c_str ()) == 1 ) ? " true" : " false" ;
5468
5430
root[" result" ][ii][" Version" ] = pNode->iVersion ;
5469
- root[" result" ][ii][" Manufacturer_id" ] = pNode->Manufacturer_id ;
5470
5431
root[" result" ][ii][" Manufacturer_name" ] = pNode->Manufacturer_name ;
5471
- root[" result" ][ii][" Product_type" ] = pNode->Product_type ;
5472
- root[" result" ][ii][" Product_id" ] = pNode->Product_id ;
5432
+
5433
+ root[" result" ][ii][" Manufacturer_id" ] = int_to_hex (pNode->Manufacturer_id );
5434
+ root[" result" ][ii][" Product_type" ] = int_to_hex (pNode->Product_type );
5435
+ root[" result" ][ii][" Product_id" ] = int_to_hex (pNode->Product_id );
5473
5436
root[" result" ][ii][" Product_name" ] = pNode->Product_name ;
5474
5437
root[" result" ][ii][" State" ] = pOZWHardware->GetNodeStateString (homeID, nodeID);
5475
5438
root[" result" ][ii][" HaveUserCodes" ] = pNode->HaveUserCodes ;
0 commit comments