Sending http push url to HASS

Would it be possible to share your php script?

It might be a good solution for me at this point.

offcourse, you can use this one to create the .php file

https://incarnate.github.io/curl-to-php/

here is mine:


<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://xxx:8123/api/webhook/your_webhook');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);


$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);
?>

you dont need a webhook though, you can also use the API directly to turn something on / off like in your first post… just create multiple php files , or you can work with arguments that you pass in your .php url

1 Like

Thank you :slight_smile: :slight_smile:

Just converted HASS to use Postgresql instead of sqlite DB too so hopefully I will get higher performance too now as things were getting a little slow and the db size went to over 12GB. Hopefully now with added ZFS compression it should become much smoother :wink:

I will write it up soon once I have fixed my lights :rofl: <- just needs an fsck on the UFS file system in my Pine64 Astronomic Clock…

This is really awesome!

It works great and is basically instant.

Thank you so much!!!

Out of scope of HASS but if anyone else reads this and finds it difficult to get it working, make sure you have a web server setup. Something around the size of a Pi et el… should be fine but it depends on the number of queries, upgrading to a light Atom or Celeron might be better.
This means Apache or Nginx to mention two of the big names with php module for Apache or php-fpm for Nginx.

Even more good news is that my lights are also fixed :wink:

Many thanks to everyone for your suggestions and ideas :smile:

Hopefully if I get a chance tomorrow I’ll create a writeup on the Pgsql setup too…