Fix deprecated HA API #107
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test with Home Assistant | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
test_with_home_assistant: | |
name: Test with Home Assistant | |
strategy: | |
matrix: | |
channel: [stable, beta, dev] | |
runs-on: ubuntu-latest | |
steps: | |
- name: π₯ Checkout the repository | |
uses: actions/checkout@v2 | |
- name: π Copy integration files to test configuration | |
run: cp -r ./custom_components ./.github/test_configuration | |
- name: π· Setup Home Assistant | |
id: homeassistant | |
uses: ludeeus/setup-homeassistant@main | |
with: | |
tag: ${{ matrix.channel }} | |
config-dir: .github/test_configuration | |
- name: β Add entity | |
run: | | |
curl -sSL -f -X POST \ | |
-H "Authorization: Bearer ${{ steps.homeassistant.outputs.token }}" \ | |
-H "Content-Type: application/json" \ | |
-d '{"entity_id": "sensor.awesome", "state": "Even more awesome!"}' \ | |
${{ steps.homeassistant.outputs.url }}/api/services/netdaemon/entity_create | |
- name: β Check the state of the entity | |
run: | | |
result=$(curl -sSL -f -X GET \ | |
-H "Authorization: Bearer ${{ steps.homeassistant.outputs.token }}" \ | |
-H "Content-Type: application/json" \ | |
${{ steps.homeassistant.outputs.url }}/api/states/sensor.awesome | jq -r .state) | |
echo "$result" | |
if [ "$result" != "Even more awesome!" ];then | |
exit 1 | |
fi | |
- name: π Get logs | |
if: ${{ failure() }} || ${{ cancelled() }} | |
run: docker logs ${{ steps.homeassistant.outputs.containername }} |