I'm trying to find out what's happening, but I don't know enough about the code. In below log I set the blind to 70% using the slider in domoticz. You clearly see the messages are received by domoticz, but there's only a select query to get the device type and subtype. There's no update happening when an mqtt message witht the level is received, only when the button was pushed in domoticz.
Code: Select all
2022-09-19 10:30:58.999 Debug: MAIN SwitchLight idx:68 cmd:Set Level lvl:70
2022-09-19 10:30:58.999 Debug: Query:SELECT HardwareID,DeviceID,Unit,Type,SubType,SwitchType,AddjValue2,nValue,sValue,Name,Options FROM DeviceStatus WHERE (ID == 68)
2022-09-19 10:30:58.999 Debug: MAIN SwitchLightInt : switchcmd:Set Level level:70 HWid:6 sd:6 0x0c4314fffe3fc90a_cover_zigbee2mqtt 1 244 73 21
2022-09-19 10:30:58.999 Debug: Query:SELECT SwitchType FROM DeviceStatus WHERE (HardwareID==6) AND (DeviceID=='0x0c4314fffe3fc90a_cover_zigbee2mqtt')
2022-09-19 10:30:59.000 Debug: Query:SELECT ID,Name,nValue,sValue,Color,SubType FROM DeviceStatus WHERE (HardwareID==6) AND (DeviceID=='0x0c4314fffe3fc90a_cover_zigbee2mqtt')
2022-09-19 10:30:59.000 Debug: Query:UPDATE DeviceStatus SET nValue=1, LastLevel=70, LastUpdate='2022-09-19 10:30:59' WHERE (ID = 68)
2022-09-19 10:30:59.479 Debug: zigbee: Topic: zigbee2mqtt/Gordijn, Message: {"battery":49,"linkquality":23,"position":70,"state":"OPEN","update":{"state":"idle"},"update_available":false}
2022-09-19 10:30:59.480 Debug: Query:SELECT ID, Name, nValue, sValue, Color, SubType, SwitchType FROM DeviceStatus WHERE (HardwareID==6) AND (DeviceID=='0x0c4314fffe3fc90a_cover_zigbee2mqtt') AND (Unit==1)
2022-09-19 10:31:00.502 Debug: zigbee: Topic: zigbee2mqtt/Gordijn, Message: {"battery":49,"linkquality":26,"position":91,"state":"OPEN","update":{"state":"idle"},"update_available":false}
2022-09-19 10:31:00.503 Debug: Query:SELECT ID, Name, nValue, sValue, Color, SubType, SwitchType FROM DeviceStatus WHERE (HardwareID==6) AND (DeviceID=='0x0c4314fffe3fc90a_cover_zigbee2mqtt') AND (Unit==1)
2022-09-19 10:31:01.533 Debug: zigbee: Topic: zigbee2mqtt/Gordijn, Message: {"battery":49,"linkquality":28,"position":88,"state":"OPEN","update":{"state":"idle"},"update_available":false}
2022-09-19 10:31:01.534 Debug: Query:SELECT ID, Name, nValue, sValue, Color, SubType, SwitchType FROM DeviceStatus WHERE (HardwareID==6) AND (DeviceID=='0x0c4314fffe3fc90a_cover_zigbee2mqtt') AND (Unit==1)
2022-09-19 10:31:02.593 Debug: zigbee: Topic: zigbee2mqtt/Gordijn, Message: {"battery":49,"linkquality":26,"position":84,"state":"OPEN","update":{"state":"idle"},"update_available":false}
2022-09-19 10:31:02.594 Debug: Query:SELECT ID, Name, nValue, sValue, Color, SubType, SwitchType FROM DeviceStatus WHERE (HardwareID==6) AND (DeviceID=='0x0c4314fffe3fc90a_cover_zigbee2mqtt') AND (Unit==1)
2022-09-19 10:31:03.596 Debug: zigbee: Topic: zigbee2mqtt/Gordijn, Message: {"battery":49,"linkquality":26,"position":80,"state":"OPEN","update":{"state":"idle"},"update_available":false}
2022-09-19 10:31:03.597 Debug: Query:SELECT ID, Name, nValue, sValue, Color, SubType, SwitchType FROM DeviceStatus WHERE (HardwareID==6) AND (DeviceID=='0x0c4314fffe3fc90a_cover_zigbee2mqtt') AND (Unit==1)
2022-09-19 10:31:04.628 Debug: zigbee: Topic: zigbee2mqtt/Gordijn, Message: {"battery":49,"linkquality":26,"position":76,"state":"OPEN","update":{"state":"idle"},"update_available":false}
2022-09-19 10:31:04.628 Debug: Query:SELECT ID, Name, nValue, sValue, Color, SubType, SwitchType FROM DeviceStatus WHERE (HardwareID==6) AND (DeviceID=='0x0c4314fffe3fc90a_cover_zigbee2mqtt') AND (Unit==1)
2022-09-19 10:31:05.665 Debug: zigbee: Topic: zigbee2mqtt/Gordijn, Message: {"battery":49,"linkquality":26,"position":72,"state":"OPEN","update":{"state":"idle"},"update_available":false}
2022-09-19 10:31:05.665 Debug: Query:SELECT ID, Name, nValue, sValue, Color, SubType, SwitchType FROM DeviceStatus WHERE (HardwareID==6) AND (DeviceID=='0x0c4314fffe3fc90a_cover_zigbee2mqtt') AND (Unit==1)
2022-09-19 10:31:06.702 Debug: zigbee: Topic: zigbee2mqtt/Gordijn, Message: {"battery":49,"linkquality":26,"position":70,"state":"OPEN","update":{"state":"idle"},"update_available":false}
2022-09-19 10:31:06.702 Debug: Query:SELECT ID, Name, nValue, sValue, Color, SubType, SwitchType FROM DeviceStatus WHERE (HardwareID==6) AND (DeviceID=='0x0c4314fffe3fc90a_cover_zigbee2mqtt') AND (Unit==1)
When I click on open or close, these commands are sent (so level 0 with command open or close):
Code: Select all
http://192.168.0.116:8080/json.htm?type=command¶m=switchlight&idx=68&switchcmd=Open&level=0&passcode=
http://192.168.0.116:8080/json.htm?type=command¶m=switchlight&idx=68&switchcmd=Close&level=0&passcode=
But I always see that the level that is set is -1
Code: Select all
2022-09-19 11:08:21.732 Debug: MAIN SwitchLight idx:68 cmd:Open lvl:-1
2022-09-19 11:11:56.406 Debug: MAIN SwitchLight idx:68 cmd:Close lvl:-1
According to MQTTAutoDiscover.cpp, level -1 is used for stop:
Code: Select all
else if (command == "Stop")
{
level = -1;
szValue = pSensor->payload_stop;
}
Only if the value is not equal to -1, the SQL update clause is executed:
Code: Select all
if (level != -1)
{
std::vector<std::vector<std::string>> result;
result = m_sql.safe_query("SELECT ID,Name,nValue,sValue,Color,SubType FROM DeviceStatus WHERE (HardwareID==%d) AND (DeviceID=='%q')", m_HwdID, pSensor->unique_id.c_str());
if (!result.empty())
{
if (command == "On")
level = 100;
else if (command == "Off")
level = 0;
if (pSensor->component_type == "cover" && pSensor->unique_id.find("zwavejs2mqtt_") == 0 && level == 99) //GizMoCuz: Is this still needed? (who can debug this?)
level = 100;
int nValue = (level > 0) ? 1 : 0;
m_sql.safe_query(
"UPDATE DeviceStatus SET nValue=%d, LastLevel=%d, LastUpdate='%s' WHERE (ID = %s)",
nValue, level, TimeToString(nullptr, TF_DateTime).c_str(), result[0][0].c_str());
}
}
return true;
I'm probably looking in the wrong place, so I'll wait for someone with more knowledge to check this
.