Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #277 from DewGew/beta
Browse files Browse the repository at this point in the history
Merge Beta to Master
* New functon for chromcast notification
* Added Blinds with stop
* Added Doorbell with voice notification
* Removed Blinds Inverted, Diomoticz V.2022.2 has change behavior for blinds
* Small change for battery reporting
* Added devicetype light, outlet to pushbutton
  • Loading branch information
DewGew authored Dec 13, 2022
2 parents acfc71b + 4ee9c89 commit af49b99
Show file tree
Hide file tree
Showing 10 changed files with 898 additions and 476 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ branches:
python:
- "3.5"
- "3.6" # current default Python on Travis CI
- "3.7"
- "3.8"
# command to install dependencies
install:
Expand Down
2 changes: 2 additions & 0 deletions config/default_config
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ ssl_cert: # /path/to/fullchain.pem
# Login on Google Home app and configuration interface
auth_user: 'admin'
auth_pass: 'admin'
# If you change authToken you need to disconnect and reconnect to Google Assistant
authToken: 'ZsokmCwKjdhk7qHLeYd2'

# Google Assistant Settings:
ClientID: 'clientid_from aog'
Expand Down
91 changes: 47 additions & 44 deletions const.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-

"""Constants for Google Assistant."""
VERSION = '1.10.9'
VERSION = '1.22.25'
PUBLIC_URL = 'https://[your public url]'
CONFIGFILE = 'config/config.yaml'
LOGFILE = 'dzga.log'
Expand All @@ -22,6 +22,7 @@
DOMOTICZ_GET_SETTINGS_URL = '/json.htm?type=settings'
DOMOTICZ_GET_CAMERAS_URL = '/json.htm?type=cameras'
DOMOTICZ_GET_VERSION = '/json.htm?type=command&param=getversion'
DOMOTICZ_SEND_COMMAND = 'json.htm?type=command&param='

# https://developers.google.com/actions/smarthome/guides/
PREFIX_TYPES = 'action.devices.types.'
Expand All @@ -34,6 +35,7 @@
TYPE_CURTAIN = PREFIX_TYPES + 'CURTAIN'
TYPE_DISHWASHER = PREFIX_TYPES + 'DISHWASHER'
TYPE_DOOR = PREFIX_TYPES + 'DOOR'
TYPE_DOORBELL = PREFIX_TYPES + 'DOORBELL'
TYPE_DRYER = PREFIX_TYPES + 'DRYER'
TYPE_FAN = PREFIX_TYPES + 'FAN'
TYPE_GARAGE = PREFIX_TYPES + 'GARAGE'
Expand Down Expand Up @@ -75,16 +77,16 @@
ERR_VALUE_OUT_OF_RANGE = "valueOutOfRange"
ERR_WRONG_PIN = 'pinIncorrect'

domains = {
DOMAINS = {
'ac_unit': 'AcUnit',
'bathtub': 'Bathtub',
'blinds': 'Blind',
'blindsinv': 'BlindInverted',
'camera': 'Camera',
'coffeemaker': 'Coffeemaker',
'color': 'ColorSwitch',
'cooktop': 'Cooktop',
'door': 'DoorSensor',
'doorbell': 'Doorbell',
'dishwasher': 'Dishwasher',
'dryer': 'Dryer',
'fan': 'Fan',
Expand Down Expand Up @@ -129,47 +131,48 @@
ATTRS_PERCENTAGE = 1
ATTRS_FANSPEED = 1
ATTRS_VACUUM_MODES = 1
ATTRS_HUMIDITY = 1

DOMOTICZ_TO_GOOGLE_TYPES = {
domains['ac_unit']: TYPE_AC_UNIT,
domains['bathtub']: TYPE_BATHTUB,
domains['blinds']: TYPE_BLINDS,
domains['blindsinv']: TYPE_BLINDS,
domains['camera']: TYPE_CAMERA,
domains['coffeemaker']: TYPE_COFFEE,
domains['color']: TYPE_LIGHT,
domains['cooktop']: TYPE_COOKTOP,
domains['dishwasher']: TYPE_DISHWASHER,
domains['door']: TYPE_DOOR,
domains['dryer']: TYPE_DRYER,
domains['fan']: TYPE_FAN,
domains['garage']: TYPE_GARAGE,
domains['gate']: TYPE_GATE,
domains['group']: TYPE_SWITCH,
domains['heater']: TYPE_HEATER,
domains['kettle']: TYPE_KETTLE,
domains['light']: TYPE_LIGHT,
domains['lock']: TYPE_LOCK,
domains['lockinv']: TYPE_LOCK,
domains['media']: TYPE_MEDIA,
domains['microwave']: TYPE_MICRO,
domains['mower']: TYPE_MOWER,
domains['outlet']: TYPE_OUTLET,
domains['oven']: TYPE_OVEN,
domains['push']: TYPE_SWITCH,
domains['scene']: TYPE_SCENE,
domains['screen']: TYPE_SCREEN,
domains['security']: TYPE_SECURITY,
domains['selector']: TYPE_SWITCH,
domains['sensor']: TYPE_SENSOR,
domains['smokedetector']: TYPE_SMOKE_DETECTOR,
domains['speaker']: TYPE_SPEAKER,
domains['switch']: TYPE_SWITCH,
domains['temperature']: TYPE_THERMOSTAT,
domains['thermostat']: TYPE_THERMOSTAT,
domains['vacuum']: TYPE_VACUUM,
domains['valve']: TYPE_VALVE,
domains['washer']: TYPE_WASHER,
domains['waterheater']: TYPE_WATERHEATER,
domains['window']: TYPE_WINDOW,
DOMAINS['ac_unit']: TYPE_AC_UNIT,
DOMAINS['bathtub']: TYPE_BATHTUB,
DOMAINS['blinds']: TYPE_BLINDS,
DOMAINS['camera']: TYPE_CAMERA,
DOMAINS['coffeemaker']: TYPE_COFFEE,
DOMAINS['color']: TYPE_LIGHT,
DOMAINS['cooktop']: TYPE_COOKTOP,
DOMAINS['dishwasher']: TYPE_DISHWASHER,
DOMAINS['door']: TYPE_DOOR,
DOMAINS['doorbell']: TYPE_DOORBELL,
DOMAINS['dryer']: TYPE_DRYER,
DOMAINS['fan']: TYPE_FAN,
DOMAINS['garage']: TYPE_GARAGE,
DOMAINS['gate']: TYPE_GATE,
DOMAINS['group']: TYPE_SWITCH,
DOMAINS['heater']: TYPE_HEATER,
DOMAINS['kettle']: TYPE_KETTLE,
DOMAINS['light']: TYPE_LIGHT,
DOMAINS['lock']: TYPE_LOCK,
DOMAINS['lockinv']: TYPE_LOCK,
DOMAINS['media']: TYPE_MEDIA,
DOMAINS['microwave']: TYPE_MICRO,
DOMAINS['mower']: TYPE_MOWER,
DOMAINS['outlet']: TYPE_OUTLET,
DOMAINS['oven']: TYPE_OVEN,
DOMAINS['push']: TYPE_SWITCH,
DOMAINS['scene']: TYPE_SCENE,
DOMAINS['screen']: TYPE_SCREEN,
DOMAINS['security']: TYPE_SECURITY,
DOMAINS['selector']: TYPE_SWITCH,
DOMAINS['sensor']: TYPE_SENSOR,
DOMAINS['smokedetector']: TYPE_SMOKE_DETECTOR,
DOMAINS['speaker']: TYPE_SPEAKER,
DOMAINS['switch']: TYPE_SWITCH,
DOMAINS['temperature']: TYPE_SENSOR,
DOMAINS['thermostat']: TYPE_THERMOSTAT,
DOMAINS['vacuum']: TYPE_VACUUM,
DOMAINS['valve']: TYPE_VALVE,
DOMAINS['washer']: TYPE_WASHER,
DOMAINS['waterheater']: TYPE_WATERHEATER,
DOMAINS['window']: TYPE_WINDOW,
}
30 changes: 17 additions & 13 deletions helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@
import google.auth.crypt
import google.auth.jwt

from const import (CONFIGFILE, LOGFILE, KEYFILE, HOMEGRAPH_SCOPE, HOMEGRAPH_TOKEN_URL, PUBLIC_URL)
from const import (
CONFIGFILE,
LOGFILE,
KEYFILE,
HOMEGRAPH_SCOPE,
HOMEGRAPH_TOKEN_URL,
PUBLIC_URL
)

FILE_PATH = os.path.abspath(__file__)
FILE_DIR = os.path.split(FILE_PATH)[0]
Expand Down Expand Up @@ -116,6 +123,8 @@ def saveFile(filename, text):
configuration['ClientID'] = 'sampleClientId'
if 'ClientSecret' not in configuration:
configuration['ClientSecret'] = 'sampleClientSecret'
if 'authToken' not in configuration:
configuration['authToken'] = 'ZsokmCwKjdhk7qHLeYd2'

Auth = {
'clients': {
Expand All @@ -125,36 +134,29 @@ def saveFile(filename, text):
},
},
'tokens': {
'ZsokmCwKjdhk7qHLeYd2': {
configuration['authToken']: {
'uid': '1234',
'accessToken': 'ZsokmCwKjdhk7qHLeYd2',
'refreshToken': 'ZsokmCwKjdhk7qHLeYd2',
'accessToken': configuration['authToken'],
'refreshToken': configuration['authToken'],
'userAgentId': '1234',
},
'bfrrLnxxWdULSh3Y9IU2cA5pw8s4ub': {
'uid': '2345',
'accessToken': 'bfrrLnxxWdULSh3Y9IU2cA5pw8s4ub',
'refreshToken': 'bfrrLnxxWdULSh3Y9IU2cA5pw8s4ub',
'userId': '2345'
'userAgentId': '2345'
},
},
'users': {
'1234': {
'uid': '1234',
'name': configuration['auth_user'],
'password': configuration['auth_pass'],
'tokens': ['ZsokmCwKjdhk7qHLeYd2'],
'tokens': [configuration['authToken']],
},
# '2345': {
# 'uid': '2345',
# 'name': configuration['auth_user_2'],
# 'password': configuration['auth_pass_2'],
# 'tokens': ['bfrrLnxxWdULSh3Y9IU2cA5pw8s4ub'],
# },
},
'usernames': {
configuration['auth_user']: '1234',
# configuration['auth_user_2']: '2345',
}
}

Expand Down Expand Up @@ -206,6 +208,8 @@ def __init__(self):
self.lastupdate = ''
self.selectorLevelName = ''
self.merge_thermo_idx = None
self.minThreehold = -20
self.maxThreehold = 40


def uptime():
Expand Down
2 changes: 1 addition & 1 deletion requirements/pip-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Jinja2>=2.11.3
PyChromecast==9.1.2
gTTS>=2.2.1
unicode-slugify>=0.1.3
protobuf>=3.0.0
protobuf==3.20.0
zeroconf>=0.25.1
casttube>=0.2.0
Loading

0 comments on commit af49b99

Please sign in to comment.