From e903562a0191c743d09782b488dbcd84520fe6c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Erik=20Hedenstr=C3=B6m?= <erik@hedenstroem.com>
Date: Thu, 28 Sep 2023 10:19:39 +0000
Subject: [PATCH] Add CI/CD pipeline using GitLab

---
 .gitlab-ci.yml |  7 +++++++
 set_state.py   | 15 +--------------
 2 files changed, 8 insertions(+), 14 deletions(-)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..2dc47bb
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,7 @@
+deploy:
+  script:
+    - export PATH=$PATH:/opt/host/bin:/opt/host/local/bin
+    - cp -Rfv * /opt/host/homeassistant/python_scripts
+    - hasscli service python_script reload
+  tags:
+    - shell
diff --git a/set_state.py b/set_state.py
index 173ac11..f8d9115 100644
--- a/set_state.py
+++ b/set_state.py
@@ -1,16 +1,3 @@
-"""Set the state or other attributes for the specified entity."""
-
-# ========================================================================================
-# python_scripts/set_state.py
-# modified from -
-# https://community.home-assistant.io/t/how-to-manually-set-state-value-of-sensor/43975/37
-# ========================================================================================
-
-# ----------------------------------------------------------------------------------------
-# Set the state or other attributes for the specified entity.
-# Updates from @xannor so that a new entity can be created if it does not exist.
-# ----------------------------------------------------------------------------------------
-
 inputEntity = data.get("entity_id")
 if inputEntity is None:
     logger.warning("===== entity_id is required if you want to set something.")
@@ -37,4 +24,4 @@ else:
             else:
                 inputAttributesObject[item] = newAttribute
 
-        hass.states.set(inputEntity, inputState, inputAttributesObject)
\ No newline at end of file
+        hass.states.set(inputEntity, inputState, inputAttributesObject)
-- 
GitLab