Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
I'm trying to read when a step is started in CWC, I'm reading when a tag of a smart tool is written and then sending trough MQTT to a subscriber client. The values that I'm writing in the smart tool are 1, 2, 3 sequentially on the same step.
I've done a subscription datachange into the MQTT thing to the smart tool property and added the code:
me.TesteProp = events["ST_StepCheckTool_DataChange_StepStart"].eventData.newValue.value;
then publishing by the MQTT thing, I'm receiving (the increment can happen to the value 1 and 2 but not always):
b'1.0'
b'2.0'
b'3.0'
b'30.0'
b'300.0'
b'3000.0'
b'30000.0'
Then it's stops for a moment, prevents the sequence to go further and then continues the execution normally.
The workaround was writing more information to the value, I did this:
me.TesteProp = "" + events["ST_StepCheckTool_DataChange_StepStart"].eventData.newValue.value;
then it works fine, I only get 1, 2, 3 and there's no delay.
The problem seems to be in the smart tool, because the "wrong" (I don't know if it's supposed to be like that) value is also written in the smart tool property, but how I could fix it on the MQTT thing? The wrong value stays in the Smart tool property.
Is that extra information supposed happen?
Also there's any other way to check step start (or any status) without using a smart tool?
I checked the station thing but didn't find a value that change at each step of a work instruction.
Solved! Go to Solution.
I've found the problem.
I made a MQTT template (to not mess with the original) for the MQTT thing and in there the property that receives the data from smart tool was bound to the property that I was reading on the subscription and somehow messing the value. The workaround was only fixing the value of the MQQT thing and leaving the smart tool value wrong.
If someone have any ideas on another way to check step status on CWC, I'm all ears.
I've found the problem.
I made a MQTT template (to not mess with the original) for the MQTT thing and in there the property that receives the data from smart tool was bound to the property that I was reading on the subscription and somehow messing the value. The workaround was only fixing the value of the MQQT thing and leaving the smart tool value wrong.
If someone have any ideas on another way to check step status on CWC, I'm all ears.