Thanks again @visser for looking in to this and updating your code again. Your update has removed the frontend error message, but using your debug suggestion (see results below) and adding:
echo '<pre>'; print_r( $response ); echo '</pre>';
error_log( '[wordhue] url: ' . $url );
on lines 18 and 19 I can now see the following:
WP_Error Object
(
[errors] => Array
(
[http_request_failed] => Array
(
[0] => cURL error 28: Connection timed out after 5000 milliseconds
)
)
[error_data] => Array
(
)
)
The URL you asked me to check correct displays my bridge data if I put it in the address bar manually.
This is what the debug.log is getting now:
[31-Mar-2017 10:08:41 UTC] [wordhue] sensors_job (error):
wp_remote_get() returned false for the URL: https://IP/api/USERNAME/sensors
[31-Mar-2017 10:08:46 UTC] [wordhue] url: https://IP/api/USERNAME/lights
[31-Mar-2017 10:08:46 UTC] [wordhue] lights_job (error):
wp_remote_get() returned false for the URL: https://IP/api/USERNAME/lights
[31-Mar-2017 10:08:51 UTC] [wordhue] sensors_job (error):
wp_remote_get() returned false for the URL: https://IP/api/USERNAME/sensors
[31-Mar-2017 10:08:51 UTC] [wordhue] sensors_job (error):
wp_remote_get() returned false for the URL: https://IP/api/USERNAME/sensors
I have tested wp_remote_get() and it works using a normal URL, just not with the URL to connect to my bridge.
Doing a bit of googling I have found that someone else had an issue with their server not supporting cURL correctly (I don’t understand it). So I have contact my server to see if the issue is at their end. I will let you know what happens once they’ve look into it.
I hope I can get this sorted as I would love to use your plugin and maybe help develop it further if you were interested? I was looking for something that I could expand on so I could customise my lights myself rather than being stuck to 3rd party apps etc.
Thanks again for your help.