WordPress REST API Authentication

Trying to access your custom posttype through the WordPress rest-API, but want to make sure the session has the correct permissions? Well, according to the docs you could do this with Basic Authentication.
However it did not seem to work. I was trying the proof of concept with a request like this:

$url_test  = 'https://yourtestwebsite.url/wp-json/wp/v2/yourcustomposttype';
$user = 'yourapiusername';
$pass = 'yourapiuserpassword';
$auth = base64_encode($user.':'.$pass);
$ctx = stream_context_create(array('http' => array('header' => 'Authorization: Basic '.$auth)));
$data = file_get_contents($url_test, false, $ctx);

Adding yourcustomposttype to the rest api is simple, but you can not add any permissions check. So I added an extra check for the correct permission first before adding the custom endpoint, like so:

Continue reading WordPress REST API Authentication

Home Assistant over https

Synology: How to Allow Home Assistant to Work Over an HTTPS Connection?
Plus, when you get that working, how to fix the Home Assistant Supervisor 400: Bad Request?

Have you already installed Home Assistant using docker on your Synology NAS following my step by step guide? Do you want to log in via HTTPS using your custom domain name even when you are away from home? It’s simple and free. You don’t need to buy domains, you don’t need to look for information elsewhere because here you will find the easy way to do it. Say you’re at a friend’s house and want to use Home Assistant. You can access Home Assistant from outside your home, just like you would any website.

So, cannot find “Control Panel / Application Portal / Reverse Proxy” ?
Well, just go to Control Panel (System) Login Portal / Advanced / Reverse Proxy!!!

Or try as alternative with a wilcard certificate.
Have a nice day!

Shokz OpenRun Pro 2

Thank you: reddit

“Just got my pair of ORP2, the standard EQ is too tinny and paper thin.
This is what I’ve landed and now it sounds more full-bodied, clearer with more bass.”
Give this a try:

125Hz: +5
400Hz: +4
1.2kHz: -4
3kHz: -3
10kHz: +3

“I was also surprised at how much better the vocals sounded by dialling down the mids – I read on a review that the mids were quite boosted by default.”
“Just got my pair ~ and immediately tried out this EQ – huge difference. Vocals sound much more natural and they sound much more like a standard pair of headphones now. Thanks!”

dito

invalid input ‘unknown’

After updating the Home Assistant container, I noticed a lot of errors in the log. For example:

ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ (iif((states('sensor.s8_power') | float) > 42) ...
~
ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ iif( (states['sensor.t2_temperature'].state | float() ) >= ((states['climate.airco_slaapkamer'].attributes['temperature'] | float()) + (states['input_number.airco_off_delta'].state | float())) ) }}' but no default was specified

A quick google found this, so basically, don’t use float() but specify a default value, and use float(0) instead in your templates! Change that in \NAS\docker\homeassistant\config\configuration.yaml and any template used in your automations, restart Home Assistant and the errors are gone!

Have a nice day!

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/