Skip to content

Commit

Permalink
2.0.0-beta1
Browse files Browse the repository at this point in the history
Issue #30 - security mode
Issue #26 - upodate entity on config change
Issue #21 - check box to select feature
Issue #16 - Suggest/select entity in a list on the configuration screens
Issue #5  - Thermostat over climate type
  • Loading branch information
Jean-Marc Collin committed Jan 29, 2023
1 parent 4786949 commit b607fb1
Show file tree
Hide file tree
Showing 15 changed files with 787 additions and 326 deletions.
6 changes: 6 additions & 0 deletions .bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

echo "Sourcing .bashrc"
alias ll='ls -l'
export HA='/home/vscode/core'
cd $HA
source venv/bin/activate
19 changes: 17 additions & 2 deletions .devcontainer/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ logger:

# If you need to debug uncommment the line below (doc: https://www.home-assistant.io/integrations/debugpy/)
debugpy:
start: true
wait: false
port: 5678

input_number:
fake_temperature_sensor1:
Expand All @@ -15,25 +18,28 @@ input_number:
max: 35
step: .1
icon: mdi:thermometer
unit_of_measurement: °C
fake_external_temperature_sensor1:
name: Ext Temperature
min: -10
max: 35
step: .1
icon: mdi:home-thermometer
unit_of_measurement: °C
fake_current_power:
name: Current power
min: 0
max: 1000
step: 10
icon: mdi:flash
unit_of_measurement: kW
fake_current_power_max:
name: Current power max threshold
min: 0
max: 1000
step: 10
icon: mdi:flash

unit_of_measurement: kW

input_boolean:
# input_boolean to simulate the windows entity. Only for development environment.
Expand Down Expand Up @@ -95,4 +101,13 @@ climate:
- platform: generic_thermostat
name: Underlying thermostat9
heater: input_boolean.fake_heater_switch3
target_sensor: input_number.fake_temperature_sensor1
target_sensor: input_number.fake_temperature_sensor1

recorder:
include:
domains:
- input_boolean
- input_number
- switch
- climate
- sensor
13 changes: 10 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
// "image": "ghcr.io/ludeeus/devcontainer/integration:latest",
{
"image": "ghcr.io/ludeeus/devcontainer/integration:latest",
"image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.10",
"name": "Versatile Thermostat integration",
"context": "..",
"appPort": [
"9123:8123"
],
"postCreateCommand": "container install",
// "postCreateCommand": "container install",
"postCreateCommand": "./container install",
"extensions": [
"ms-python.python",
"github.vscode-pull-request-github",
"ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance"
],
"mounts": [
"source=/Users/jmcollin/SugarSync/Projets/home-assistant/core,target=/home/vscode/core,type=bind,consistency=cached",
"source=${localWorkspaceFolder}/.devcontainer/configuration.yaml,target=/home/vscode/core/config/configuration.yaml,type=bind,consistency=cached",
"source=${localWorkspaceFolder}/custom_components,target=/home/vscode/core/config/custom_components,type=bind,consistency=cached"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
Expand All @@ -25,7 +32,7 @@
"terminal.integrated.defaultProfile.linux": "Bash Profile",
// "terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/bin/python3",
"python.analysis.autoSearchPaths": false,
"python.analysis.autoSearchPaths": true,
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
Expand Down
8 changes: 6 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
"host": "localhost",
"justMyCode": false,
"pathMappings": [
// {
// "localRoot": "${workspaceFolder}",
// "remoteRoot": "."
//},
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
"localRoot": "${workspaceFolder}/../core",
"remoteRoot": "/home/vscode/core"
}
]
},
Expand Down
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
"python.pythonPath": "/usr/local/bin/python",
"files.associations": {
"*.yaml": "home-assistant"
}
},
"python.analysis.extraPaths": [
"/home/vscode/core",
"/workspaces/versatile_thermostat"
]
}
26 changes: 22 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,43 @@
{
"label": "Run Home Assistant on port 9123",
"type": "shell",
"command": "container start",
"command": "./container start",
"problemMatcher": []
},
{
"label": "Restart Home Assistant on port 9123",
"type": "shell",
"command": "./container restart",
"problemMatcher": []
},
{
"label": "Home Assistant translations update",
"type": "shell",
"command": "./container translations",
"problemMatcher": []
},
{
"label": "Home Assistant hassfest",
"type": "shell",
"command": "./container hassfest",
"problemMatcher": []
},
{
"label": "Run Home Assistant configuration against /config",
"type": "shell",
"command": "container check-config",
"command": "./container check-config",
"problemMatcher": []
},
{
"label": "Upgrade Home Assistant to latest dev",
"type": "shell",
"command": "container install",
"command": "./container install",
"problemMatcher": []
},
{
"label": "Install a specific version of Home Assistant",
"type": "shell",
"command": "container set-version",
"command": "./container set-version",
"problemMatcher": []
}
]
Expand Down
37 changes: 37 additions & 0 deletions container
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# set -x

. .bashrc

cd $HA

echo "arguments are: "$*
# Post installation of container
command=$1
if [ "$command" == "install" ]; then
echo "Running container post installation"
script/setup
fi

if [ "$command" == "start" ]; then
echo "Running container start"
hass -c ./config --debug
fi

if [ "$command" == "translations" ]; then
echo "Running container start"
python3 -m script.translations develop
fi

if [ "$command" == "hassfest" ]; then
echo "Running container start"
python3 -m script.hassfest
fi

if [ "$command" == "restart" ]; then
echo "Killing existing container"
pkill hass
echo "Killing existing container"
hass -c ./config
fi
1 change: 1 addition & 0 deletions custom_components/homeassistant
18 changes: 18 additions & 0 deletions custom_components/versatile_thermostat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,21 @@ def remove_entry(self, entry: ConfigEntry):
def hass(self):
"""Get the HomeAssistant object"""
return self._hass


# Example migration function
async def async_migrate_entry(hass, config_entry: ConfigEntry):
"""Migrate old entry."""
_LOGGER.debug("Migrating from version %s", config_entry.version)

if config_entry.version == 1:

new = {**config_entry.data}
# TODO: modify Config Entry data

config_entry.version = 2
hass.config_entries.async_update_entry(config_entry, data=new)

_LOGGER.info("Migration to version %s successful", config_entry.version)

return True

0 comments on commit b607fb1

Please sign in to comment.