Preparing for Plugin Solar

Correct, a non Moodle related post..

I’ve purchased and am awaiting delivery of the Octopus two panel plugin solar kit

In preparation for the arrival of this I’ve been digging into the regulations and safety advice and what if anything do I need in my house to make sure all this is safe.

Only to find a slight issue with my Consumer unit, it has Type AC unidirectional RCDs and not the required Type A bi-directional ones 😦

When the UK updated its electrical regulations to fully support the plug-in solar market, it created a strict safety boundary. To see if my home was compliant, I took off the plastic cover of my consumer unit and looked closely at my RCDs (Residual Current Devices)β€”the safety switches that flip if there is an electrical fault. There, printed on the front of the switches, was the culprit: Type AC.

Apparently UK homes built or rewired over the last few decades, Type AC RCDs are the absolute norm. They are perfectly fine for normal household appliances that pull electricity one way out of the grid.

However, they are unidirectional and only look for alternating current (AC) faults. When you introduce a plug-in solar kit, you change the physics of your house. Power is now flowing backward from your socket into the consumer unit. This presents two serious…

Hidden dangers

1. RCD “Blinding” (The Invisible Fire/Shock Hazard)

Solar inverters take the Direct Current (DC) from the sun and turn it into AC for your home. During normal operation, they naturally bleed tiny amounts of smooth DC leakage into the wiring.

Because Type AC RCDs are purely designed for AC, this DC leakage saturates their magnetic core. In the industry, this is called RCD blinding.

  • The Danger: Once “blinded,” the RCD is effectively paralyzed. If an unrelated appliance on that same ring main (like your washing machine or toaster) develops a dangerous fault later on, the RCD will fail to trip. You lose your shock and fire protection completely without ever knowing it.

2. Device Burnout (The Backwards-Flow Hazard)

Standard RCDs are designed for one-way traffic. When solar sends power backward, it feeds the load side of the RCD instead of the line side.

If the RCD trips or you press the “Test” button while the sun is shining, the internal electronics inside a unidirectional RCD stay live. Testing by electrical safety bodies has shown that this can cause the internal components to overheat, smoke, or catastrophically burn out.

What to do next

I’ve contacted an electrician, hopefully he’ll tell me what I’ve found that my Hager consumer unit is backward compatible and I can get one or two (if recommended) Type A RCDs to replace these Type AC ones, it seems to me the untrained AI electrian that I need to replace both of them for Hager CDA263U 2 Pole 63A 30mA Type A RCD’s which in effect mean time to gain back my outgoing spend on the panels increases.. but the eventually free electricity is a greater draw..

You might be asking why not buy full roof solar … reason one which I havent got passed, my roof is roughly 55 years old, built in 1971, meaning an extra expensive is probably required first on a new roof before I go down that path!

I’ll let you know how it goes.

MoodleMoot Edinburgh

I’m excited to say that for the first time I’ll be heading to MoodleMoot, after working directly with Moodle for the past 15 years 

Are you coming, give me a shout…

Looking forward to:

  • 3 days of thought-provoking discussions, workshops, and networking
  • Keynotes from global education and technology leaders
  • Actionable insights on AI, digital transformation, and the future of learning
  • A global community committed to keeping education open, inclusive, and impactful

See you there..

Check out what we can do for you at CoSector

Large Moodle running slow ?

Do you have a Large Moodle 4.5 site and it seems to be slow at waking up and returning results?

This is the kind of thing which I’m talking about which are noticeable in Devtools

5.56 seconds for the time to first byte on /my page !? What is it doing ?!

Well after lot of looking under the hood I can reveal that it is all to do with 2 settings in MySQL

After changing these from the default the site is back to performing as you’d expect, a response in 614 milliseconds.

Interested in knowing what these are, please reach out – otherwise I may just think that I’m talking to myself.

Check out what we can do for you at CoSector

Extra Space in Moodle Quiz?

We’ve recently noticed that there’s extra space within the Moodle Quiz in the releases of Moodle 4.5.5 & 5.0.1 these show on our customer versions as well as on the test Moodle, Mount Orange

See what I mean here

If you too have noticed this and would like to fix, go to the Raw SCSS panel for Boost Union this is here ( https://YOUR-MOODLE-SITE-URL/admin/settings.php?section=theme_boost_union_look#theme_boost_union_look_scss ) and place the following in there. Once done head to Development and Purge caches /admin/purgecaches.php

Depending on theme you may have to change the above.

/* Remove the extra clearfix space on quiz pages, changed from block to inline */
#page-mod-quiz-attempt .clearfix:after, #page-mod-quiz-review .clearfix:after, #page-question-bank-previewquestion-preview .clearfix:after, #page-filter-embedquestion-showquestion .clearfix:after {
   display: inline;
}

That’s it.. If Moodle themselves get around to fixing this the above then might done something odd.. so if you spot that in the future, just remove the above.

Check out what we can do for you at CoSector

Slow running MySQL table? Reindex it

You’ve noticed that a table is not returning data as efficiently as it should be. Then try this

ALTER TABLE <table_name> ENGINE = InnoDB; 

This method uses the ALTER command to change the table engine to InnoDB, even if the table is already using InnoDB. While we have tested with InnoDB, it can also be applied to other storage engines.

Depending on how large this table is and whether it is on a Production site, it might / is best to first stop the site or to take it into Maintenance mode. We recently did this and it took 4 minutes to reindex a Moodle table with 8 million rows.

Afterward the process to load the page increase from 4.4 secs to first byte to 493 ms

Which is a massive justification to do the above.

Check out what we can do for you at CoSector

Mass unenrol using core settings in Moodle

Do you have a course within Moodle which now has so many participants that it has become impossible to maintain? You may have even got as far as attempting to use bulk unenrolment methods, only to find that the frontend of Moodle crashes when trying to delete too many users.

Using the following steps you can use Moodle internal systems to remove the ones which you no longer want to have access.

First off edit the enrolment method used to bring in these users, in our case that was via Manual enrolments

To do this you want to add a Default enrolment duration to this course visit siteroot/enrol/instances.php?id=xxxxxx, and add a number, the below 208 weeks is 4 years.

Now in the siteroot/global setting /admin/settings.php?section=enrolsettingsmanual for Manual enrolments you want to change this from the default of Keep user enrolled to Unenrol user from course

Now, you might be saying what could that do to my other courses !

Well further down this same settings page the following is also most likely to be set to 0, as that is Default

Meaning all your courses across your site with the enrolment method of Manual enrolments will have 0 set as the timeend value within enrolments.

To check what courses have manual enrolments with timeend not set to 0, run the following on the database

SELECT 
    ue.id AS enrolment_id, 
    u.username, 
    u.firstname, 
    u.lastname, 
    c.shortname AS course_shortname, 
    c.fullname AS course_name,
    u.lastaccess AS last_login_date,
    ue.timeend,
    FROM_UNIXTIME(ue.timeend) AS timeend_readable,
    FROM_UNIXTIME(ue.timestart) AS timestart_readable
FROM 
    mdl_user_enrolments ue
JOIN 
    mdl_enrol e ON ue.enrolid = e.id
JOIN 
    mdl_course c ON e.courseid = c.id
JOIN 
    mdl_user u ON ue.userid = u.id
WHERE 
    e.enrol IN ('manual')
    AND ue.timeend != 0;

Now what you have to do is change the enrolments you want to get rid off, if over (in our case) 4 years to have a timeend of x and you can do this by using the enrolment timestart and adding on 4 years to timeend. Run the below SQL, first changing the e.courseid value to the course from above which you’ve set the Default enrolment duration on.

Make sure you test this on a UAT server first as well as backup your mdl_user_enrolments table

UPDATE
mdl_user_enrolments ue
JOIN mdl_enrol e ON ue.enrolid = e.id
SET ue.timeend = ue.timestart + (208 * 7 * 24 * 60 * 60)
WHERE e.courseid IN ('xxxxxx')
AND e.enrol IN ('manual')
AND ue.timeend = 0;   

Once complete, watch the enrolments which are over 4 years magically disappear from your enrolment method.

Remove participants who have never engaged

If you want to remove the participants who have not engaged with the course then run the following SQL, first replacing 1732782442 and c.id, the unix time value can be found here, the one below is Thu Nov 28 2024 08:27:22 as long as the time is in the past to now then this will work.

The below SQL addresses the main 3 enrolments methods as you might want to work with more than just Manual.

 UPDATE 
    mdl_user_enrolments ue
JOIN 
    mdl_enrol e ON ue.enrolid = e.id
JOIN 
    mdl_course c ON e.courseid = c.id
JOIN 
    mdl_user u ON ue.userid = u.id
SET 
    ue.timeend = '1732782442'
WHERE 
    c.id IN ('xxxxxx')
    AND e.enrol IN ('manual','self','meta')
    AND u.lastaccess = 0;

All the best, if stuck – please leave a comment.

If you’d like more information or are having different problems which need solving, then why not have CoSector host your site for you.

Who we are

CoSector is the premier supplier of digital student experience solutions for the HE sector. We are the only provider created by a university for the benefit of universities. Check out the website above for more information.

Christmas Candle Bridge Bulbs

A Festive related post

The problem with most Christmas candle bridges (& some other light sets) is that they are one complete circuit.. Meaning if one bulb is dead the whole thing will not light.. I found this out when decorating our home this weekend. Check out this picture to see how to work out how many of your bulbs need replacing.

Grab a 9v battery, place the end of the bulb on the + (plus) and the side of the bulb touching the (minus) and check that it lights. This trick will only light up bulbs which need less than about 4.5 watts to light.

Please do not throw away the whole item, thinking that it is broken !

If you are thinking of using this same method to check higher powered bulbs on a higher power battery DO NOT do it, it could be very shocking ⚑⚑⚑ for you.

Wishing you a very Happy and Safe Christmas

Moodle OAuth 2 services > Microsoft OneDrive

Setting up OAuth 2 services within Moodle can be quite painful.

Hopefully the below information which is ‘not’ documented by Moodle will help you with that.

The issue I was seeing was when I clicked on ‘Connect to a system account’, it threw this error “The system account was not connected for offline access

To fix this the answer lies within the endpoints on Moodle, the authorization_endpoint & token_endpoint needed the specific endpoints from the Azure App Registration

Within Azure these are here

Rather than the default ones which look like this, in the case for me /common/ was not working

If your issue is a different one and you are after support for your Moodle, why not reach out to us to host and or just support your instance.

Contact us here info@cosector.com

Moodle Scheduled Task & MySQL Going Away

Have you ever had the following error in one of your Moodle scheduled tasks or even when you’ve been upgrading Moodle & have noticed it in the MySQL logs ??

What this means is that and the size of the file it is trying to write is bigger than the variable currently allows, MySQL has tried to do as you’ve asked and couldn’t at which point it has packed its bags and goes home..

You might see it if you ever run a full Sync users with Entra AD on a large scale Moodle site.

The task will then just restart and fail the next time as well and keep looping causing your sync and Moodle site get more and more out of date with your Azure AD.

How to fix.. its pretty simple really, you just need to get MySQL’s connection to be able to write larger sized data files packages.

The default for max_allowed_packets on your Moodle’s MySQL database is likely to be 16mb

show global variables like '%max_allow%';

You want to change this to at least 256mb’s

You do this with the following line on your MySQL command line

set global max_allowed_packet = 268435456;

What is 268435456 ??

268435456 / 1024 / 1024 = 256 as in 256mbs, just like that 16777216 / 1024 / 1024 = 16 as in 16mbs.

This ‘should’ be enough to be able to write the data in the sync back to your database without the databases connection closing and it going off home..

If your Moodle upgrade has been running for an amount of days, then there’s a under lying cause and no amount of increasing this is likely to help, although you could try increasing it to the max setting of 1073741824

set global max_allowed_packet = 1073741824;

πŸ˜€

Moodle Office365 & redirect issues?

Having issue with your Moodle, specifically no longer being able to get to the manual login page when using either of these URL’s

https://yourMoodle/?noredirect=1

or

https://yourMoodle/login/index.php?noredirect=1

Do check that this is switched on

https://yourMoodle/admin/search.php?query=forceredirect

If you have lost access to your frontend in is in mdl_config_plugins

Check whether you Office365 plugins page is all verified, click the button, if yours is not in a state with green ticks as the below screenshot.

https://yourMoodle/admin/settings.php?section=local_o365

Reason this is needed is taken from the manual below – Why this might Undo at any stage in the future is currently unknown, if you figure this out, let us know in the comments.

Verify Setup

  1. This tool verifies that Azure has been correctly set up. Click the “Update” button to check setup.
  2. If the tool reports any missing permissions, return to Azure and ensure that all required permissions have been added to your configured application for Moodle.