Skip to content

Commit

Permalink
Updates (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
psimsa authored Jul 10, 2023
1 parent 5cdc2ab commit 8b8d7e0
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
version:
description: 'Version'
required: true
create-tag:
description: 'Create tag'
required: true
default: 'false'

jobs:
release:
Expand All @@ -24,25 +28,46 @@ jobs:
working-directory: ./custom_components/oig_cloud
run: |
echo 'COMPONENT_VERSION = "${{ github.event.inputs.version }}"' > release_const.py
echo 'SERVICE_NAME = "oig_cloud"' >> release_const.py
if [ "${{ github.event.inputs.version }}" == "dev" ]; then
echo 'SERVICE_NAME = "oig_cloud_dev"' >> release_const.py
else
echo 'SERVICE_NAME = "oig_cloud"' >> release_const.py
fi
- name: Update version property in manifest.json
working-directory: ./custom_components/oig_cloud
run: |
jq --arg version ${{ github.event.inputs.version }} '.version = $version' manifest.json > manifest.tmp && mv manifest.tmp manifest.json
if [ "${{ github.event.inputs.version }}" == "dev" ]; then
jq --arg version '0.0.0' '.version = $version' manifest.json > manifest.tmp && mv manifest.tmp manifest.json
else
jq --arg version ${{ github.event.inputs.version }} '.version = $version' manifest.json > manifest.tmp && mv manifest.tmp manifest.json
fi
- name: Commit changes
working-directory: ./custom_components/oig_cloud
run: |
git config --global user.name "Pavel Simsa"
git config --global user.email "pavel@simsa.cz"
git add release_const.py manifest.json
git commit -m "Creating release"
git commit -m "Setting release variables to ${{ github.event.inputs.version }}"
- name: Push changes
working-directory: ./custom_components/oig_cloud
if: ${{ github.event.inputs.create-tag != 'true' }}
run: |
git push
- name: Create tag
if: ${{ github.event.inputs.create-tag == 'true' }}
working-directory: ./custom_components/oig_cloud
run: |
git tag -a v${{ github.event.inputs.version }} -m "Version ${{ github.event.inputs.version }}"
git push --tags
- name: Create draft release
uses: actions/create-release@v1
if: ${{ github.event.inputs.create-tag == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/oig_cloud/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"opentelemetry-exporter-otlp-proto-grpc==1.18.0"
],
"ssdp": [],
"version": "1.0.0-preview2",
"version": "1.0.0-rc1",
"zeroconf": []
}
2 changes: 1 addition & 1 deletion custom_components/oig_cloud/release_const.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
COMPONENT_VERSION = "1.0.0-preview2"
COMPONENT_VERSION = "1.0.0-rc1"
SERVICE_NAME = "oig_cloud"
3 changes: 3 additions & 0 deletions custom_components/oig_cloud/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def state(self):
+ pv_data["ac_in"]["aci_ws"]
+ pv_data["ac_in"]["aci_wt"]
)

if self._sensor_type == "batt_batt_comp_p":
return float(pv_data["batt"]["bat_i"] * pv_data["batt"]["bat_v"])

if self._sensor_type == "dc_in_fv_total":
return float(pv_data["dc_in"]["fv_p1"] + pv_data["dc_in"]["fv_p2"])
Expand Down
9 changes: 9 additions & 0 deletions custom_components/oig_cloud/sensor_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,15 @@
"state_class": None,
"entity_category": EntityCategory.DIAGNOSTIC,
},
"batt_batt_comp_p":{
"name": "Battery Power",
"name_cs": "Výkon baterie",
"device_class": SensorDeviceClass.POWER,
"unit_of_measurement": "W",
"node_id": None,
"node_key": None,
"state_class": SensorStateClass.MEASUREMENT,
}
# these don't seem to work like this, disabling
# "box_prms_fan1":{
# "name": "Fan 1",
Expand Down

0 comments on commit 8b8d7e0

Please sign in to comment.