From 8bed04eb8b401e578053352e0e873f9d16eed3d0 Mon Sep 17 00:00:00 2001 From: Tim Panajott Date: Sat, 7 Sep 2024 22:19:00 +0200 Subject: [PATCH] Fixed issue #178 --- .gitignore | 1 + .../include/light/home_assistant_light.cpp | 4 ++-- docker/nginx/sites-enabled/nspanelmanager.conf | 18 +++++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index ccd5c3da..fa3af5a1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ docker/test-beta/data* docker/web/nspanelmanager/db.sqlite3 docker/web/nspanelmanager/secret.key docker/web/node_modules/ +docker/nginx/sites-enabled/nspanelmanager.conf firmware/NSPanelManagerFirmware/data/config.json firmware/NSPanelManagerFirmware/.pio firmware/NSPanelManagerFirmware/littlefs.md5 diff --git a/docker/MQTTManager/include/light/home_assistant_light.cpp b/docker/MQTTManager/include/light/home_assistant_light.cpp index ca6c546c..34c488f9 100644 --- a/docker/MQTTManager/include/light/home_assistant_light.cpp +++ b/docker/MQTTManager/include/light/home_assistant_light.cpp @@ -67,9 +67,9 @@ void HomeAssistantLight::send_state_update_to_controller() { } else if (this->_home_assistant_light_type == MQTT_MANAGER_HOME_ASSISTANT_LIGHT_TYPE::TYPE_SWITCH) { service_data["domain"] = "switch"; if (this->_requested_state) { - service_data["service"] = "switch_on"; + service_data["service"] = "turn_on"; } else { - service_data["service"] = "switch_off"; + service_data["service"] = "turn_off"; } } HomeAssistantManager::send_json(service_data); diff --git a/docker/nginx/sites-enabled/nspanelmanager.conf b/docker/nginx/sites-enabled/nspanelmanager.conf index c8e7be91..8f185535 100644 --- a/docker/nginx/sites-enabled/nspanelmanager.conf +++ b/docker/nginx/sites-enabled/nspanelmanager.conf @@ -25,6 +25,10 @@ server { # max upload size client_max_body_size 75M; # adjust to taste + location /static { + alias /usr/src/app/nspanelmanager/web/static; + } + location /websocket { proxy_pass http://mqttmanager; proxy_http_version 1.1; @@ -32,13 +36,9 @@ server { proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host;} - - location /{ - proxy_pass http://django; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - proxy_set_header Host $host;} - # Finally, send all non-media requests to the Django server. -} + location / { + uwsgi_pass django; + include /etc/nginx/sites-enabled/uwsgi_params; + } +} \ No newline at end of file