Index WP MySQL For Speed

Consider using his plugin by default:
https://wordpress.org/plugins/index-wp-mysql-for-speed/

You only have to run it once, to create better indexing keys on the database tables, which in my eyes should be default in WordPress.
Unbelievable what I see in speed performance so far!

(Found this plugin actually by following the steps in this blog article for a client.)

But wait, there is more!
https://www.plumislandmedia.net/wordpress/performance/optimizing-wordpress-database-servers/

Wifi to Zigbee

My wifi is not slow at all, but I started getting more and more connection problems from random devices. The solution for me was to replace some wifi devices with zigbee versions.

I started with adding a SMLIGHT SLZB-06 to my network. This is a Zigbee 3.0 to Ethernet USB WiFi Gateway Coordinator with PoE and it works with Home Assistant using ZHA or Zigbee2MQTT.
So I gave it a fixed IP address, and on my NAS, where Home Assistant is running in a Docker container, I installed eclipse-mosquitto and koenkk/zigbee2mqtt. Next I added the SMLIGHT SLZB-06 and MQTT integration in Home Assistant and everything started coming together and working like a charm.

First added devices were temperature and humidity sensors, Sonoff SNZB-02P and SNZB-02D. Next I started adding smart plugs Sonoff S60ZBTPF and IHOMECAM Smart power plugs, replacing my HomeWizard wifi energy sockets.

And guess what? With more devices on zigbee, my wifi is stable again and I get a lot more data out of my smart home!

That’s all folks!
Have a nice day…

Meet je stad! #1084

We are live!

the project: https://meetjestad.net/
info: https://meetjestad.net/node/1084
data: https://meetjestad.net/data/sensors_recent.php?sensor=1084&limit=12
json: https://meetjestad.net/data/?type=sensors&ids=1084&format=json&limit=1
Utrecht: https://meetjestad.net/index3.php?loc=Ut
RIVM: https://samenmeten.rivm.nl/dataportaal/sensor_dashboard.php?kit_id=MJS_1084#tabs-2

Of course I wanted to add the data to my own Home Assistant installation. For this I had to add some custom sensors to:
\\NAS\docker\homeassistant\config\configuration.yaml

rest:
  - resource: "https://meetjestad.net/data/?type=sensors&ids=1084&format=json&limit=1"
    scan_interval: 00:15:00
    sensor:
      - name: "mjs_1084_humidity"
        unique_id: mjs_1084_humidity
        value_template: '{{ (value_json[0].humidity | float) | round(1) }}'
        device_class: humidity
        state_class: measurement
        unit_of_measurement: "%"
        availability: '{{ ((value_json[0].humidity | float) >= 0) and ((value_json[0].humidity | float) <= 100) }}'
      - name: "mjs_1084_temperature"
        unique_id: mjs_1084_temperature
        value_template: '{{ (value_json[0].temperature | float) | round(1) }}'
        device_class: temperature
        state_class: measurement
        unit_of_measurement: "°C"
        availability: '{{ ((value_json[0].temperature | float) > -25) and ((value_json[0].temperature | float) < 100) }}'
      - name: "mjs_1084_pm25"
        unique_id: mjs_1084_pm25
        value_template: '{{ (value_json[0]["pm2.5"] | float) | round(0) }}'
        device_class: pm25
        state_class: measurement
        unit_of_measurement: "µg/m³"
        availability: '{{ ((value_json[0]["pm2.5"] | float) >= 0) and ((value_json[0]["pm2.5"] | float) < 50000) }}'
      - name: "mjs_1084_pm10"
        unique_id: mjs_1084_pm10
        value_template: '{{ (value_json[0].pm10 | float) | round(0) }}'
        device_class: pm10
        state_class: measurement
        unit_of_measurement: "µg/m³"
        availability: '{{ ((value_json[0].pm10 | float) >= 0) and ((value_json[0].pm10 | float) < 50000) }}'
      - name: "mjs_1084_battery_voltage"
        unique_id: mjs_1084_battery_voltage
        value_template: '{{ (value_json[0].supply | float) | round(2) }}'
        device_class: voltage
        state_class: measurement
        unit_of_measurement: V
      - name: "mjs_1084_timestamp"
        unique_id: mjs_1084_timestamp
        device_class: timestamp
        value_template: "{{ strptime( value_json[0].timestamp ~ '+00:00' , '%Y-%m-%d %H:%M:%S%z') }}"

* Please note some changes I made, compared to the instructions I found here. The following does not work:

value_template: '{{ (value_json[0].pm2.5 | float) }}'

I had to use:

value_template: '{{ (value_json[0]["pm2.5"] | float) | round(0) }}'

* I added the timestamp as a sensor as well, so I could see when the last data packet was transmitted. For the timestamp, the following did not quite work. It just gave me the UTC time:

value_template: "{{ value_json[0].timestamp | as_datetime | as_local }}"

So, I had to add some string manipulation to get the data in the correct timezone:

value_template: "{{ strptime( value_json[0].timestamp ~ '+00:00' , '%Y-%m-%d %H:%M:%S%z') }}"

* And to filter out invalid data, like temperature at -26 or pm at over 50k, I had to add some availability filters, like so:

availability: '{{ ((value_json[0].pm10 | float) >= 0) and ((value_json[0].pm10 | float) < 50000) }}'

That’s all folks…
Have a nice day!

HomeWizard silly graphs

Since HomeWizard still does not show the graphs I would like to see, I started setting up Home Assistant to create my own smart home, with logging of all the stats displayed correctly. A combination of P1 import/export, Solar panels production PLUS the effect of the plug-in Batteries charging and discharging!

Look at what I see in the HomeWizard App, in three graphs(!): my ‘Home Usage’, ‘Solar Consumption’ and ‘Plug-In Battery’ profiles:

Please note these graphs are showing me using incredible amounts all during the day, PLUS the consumption at night is shown as zero watts, while of course the batteries are keeping everything running in the home, at around 250w ‘standby usage’…


So, now look at how much better it is, when all the data is combined in one simple graph:

Anything in the plus is actual usage by the home; split over battery, solar and grid as power source. And the minus shows batteries charging and power returned to the grid. This tells me exactly what I would like to know, my actual home usage!
Thank you Home Assistant!

I have tried to explain to Homewizard what is wrong with their graphs… Unfortunately it has not improved yet and I am not expecting anything anymore. Anyway, by now I cancelled my HomeWizard+ subscription.

That’s all folks!
Have a nice day…

Webhosters pricing development

It was not my imagination … it was getting ridiculous!
So glad I moved all my hosting to mijn.host and my customers to their own hosting accounts. Just read this article today:

SOURCE: EMERCE

Webhosting behoorlijk duur geworden

Webhosting pakketten zijn sinds mei 2020 gemiddeld 39,83 procent duurder geworden. Dat blijkt uit onderzoek van Start24.

Prijzen van hostingproviders die tot een conglomeraat behoren zijn met gemiddeld 71,15 procent omhoog gegaan. Bij onafhankelijke providers zijn de prijzen met 22,29 procent gestegen. Bij drie van de 39 onderzochte providers bedroegen de prijsstijgingen zelfs meer dan 100 procent. Dit was het geval bij Versio (221,98%), Neostrada (189.38%) en Argeweb (162,57%).

~~knip~~

Prijsvoering zegt aardig wat over de ethiek van een onderneming, stelt Boer. Bedrijven die hun prijzen met een factor 3 verhogen zonder een aanmerkelijk betere dienstverlening aan te bieden, hebben over het algemeen minimale interesse in jouw belang als klant. Met dit soort bedrijven wil je (waarschijnlijk) niet in zee gaan. Hosting providers wiens prijzen echter binnen een redelijke marge zijn gestegen, zullen in de regel betrouwbaarder zijn.

Remember a setting in a Cookie

When you have jquery:

$(document).ready(function(){

function setmyCookie(cname, cvalue, exdays) {
  const d = new Date();
  d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
  let expires = "expires="+d.toUTCString();
  document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getmyCookie(cname) {
  let name = cname + "=";
  let ca = document.cookie.split(";");
  for(let i = 0; i < ca.length; i++) {
    let c = ca[i];
    while (c.charAt(0) == " ") {
      c = c.substring(1);
    }
    if (c.indexOf(name) == 0) {
      return c.substring(name.length, c.length);
    }
  }
  return "";
}
$('a.nturl.single-language.es').click(function () { 
	setmyCookie("mylng", "es", 365);
});
$('a.nturl.single-language.en').click(function () { 
	setmyCookie("mylng", "en", 365);
});
$('a.nturl.single-language.nl').click(function () { 
	setmyCookie("mylng", "nl", 365);
});

mylng = getmyCookie("mylng");
if (mylng == "") {
	mylng = "es";
}
if (mylng == "es") {
	window.setTimeout(function() {
		$('a.nturl.single-language.es').click();
	}, 0);
}
if (mylng == "nl") {
	window.setTimeout(function() {
		$('a.nturl.single-language.nl').click();
	}, 0);
}

});

And if you’re trying to figure out the functionality;
The links are from a plugin and a click also activates a language. This script just adds another click-hook to save the language in a cookie, and also activate the chosen language on every page load.
That’s all!