Issue of the topic: Blocks in blockly rules have disappeared
Was running M4 and happened to look into a rule that didn’t run and the blocks in the script were gone. The generated code still exists, and it seems like most rules are running. Looking through all my rules, all but one have the same issues. No blocks, but generated code exists. When I try to add blocks to an existing script, the blocks (on the left) are effectively disabled. Cannot move them.
I upgraded to 4.2 as I was planning a reboot/restart anyway, and the problem persists.
Been looking through the rules where the blocks have disappeared. Most run, but notably rules with a sendMail action look incomplete.
Here is a rule (blockly generated code) letting me know my wife is getting low on fuel. Some pieces missing in the sendMail (address, subject, etc). So maybe the rule runs, but the parameters are gone.
var Range2;
var Things = Java.type('org.openhab.core.model.script.actions.Things');
if (items.getItem('BMWX3RemainingFuel').numericState < 2) {
Range2 = items.getItem('BMWX3FuelRange').numericState;
Range2 = (Range2).toFixed(0);
if (items.getItem('BMWX3FuelNotificationSent').state != 'ON') {
Things.getActions('mail', ).sendMail(, , );
}
} else if (false) {
}
'mail:smtp:6029257d23';
'MyThing';
There was actually more to this rule in the blocks. It checks if a proxy switch (BMWX3FuelNotificationSent) is on, if not it sends the email, then turns on the proxy. When fuel is greater than 2, it checks if proxy is ON, then turns off the proxy if true. All this avoids duplicate emails of course. All that code is missing it seems.
I restored a backup from about a month ago, but the result was the same. I am now back on a current backup from today. Next step will be to rebuild the rule(s). Probably have 30-40 in this condition.
Might have to do with Mail Action Library. I cannot recreate the rules because the library is empty. Tried removing and adding the library back, but no change.
@florian-h05 / @stefan.hoehn if this was caused by missing blocks / extensions, perhaps we could detect this and pop up a warning? Also somehow prevent the blocks from being wiped out accidentally, yet still allowing people to clear it out and start over if they wanted to.
I have the bad feeling that it might be caused by Blocks from the LIbrary which are not under our control. Finding the root cause is probably becoming complicated.
Rules are not shown when blocks are broken.
I would recommend opening the code of the rule which contains the XML of the blocks. Try to find the blocks in the XML that are coming from a library and remove them and see if the rule works now. I know this is tedious but probably the only way to find out.
@JimT Until now I have not yet found out how this could be prevented as this is rendered internally by Blockly (I had these problems myself when I debugged breaking changes or errors in my code).
Yes, that looks complete. I don’t find anything wrong, but as Stefan commented it might be hard to find.
I pasted the code into a fresh rule but it didn’t get rendered.
I never experienced a problem like that during upgrades although I stepped through all the milestones till the 4.2 release.
Sorry: I’m out of ideas.
I have done the same. Not really sure which Milestone things changed, since all the rules seem to run except for ones using sendMail. I still don’t understand why the Mail Actions Library on a fresh system doesn’t work. If someone else is having a similar issue, I would be grateful for some insights.
Been a good run of upgrades for me since 2.4, but I guess it was my time to get bit…
In would ask the author of the mail blockly library to look into it. It might have to do with the blockly upgrade that was done by Jim that required changes on our internal implementation of all blocks. If that was the case here it could affect many more libraries as well
I can also vouch for this, it’s broken all our Blockly mail notifications due to Mail Actions not showing anything, if you switch to code and switch back it shows a portion of the original blocks, but mail actions just shows thing which is unselectable