Skip to content

Commit

Permalink
Merge pull request #125 from p-x9/support_fanv2
Browse files Browse the repository at this point in the history
Support Fanv2
  • Loading branch information
benzman81 committed Mar 23, 2021
2 parents 033a11f + ef39131 commit f80ca5c
Show file tree
Hide file tree
Showing 5 changed files with 685 additions and 0 deletions.
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ For outlets the value for `NEWSTATE` is either `true` for on or `false` for off.
For outlets the additional state `stateOutletInUse` is available. The value for `NEWSTATE` is either `true` for on or `false` for off and
can be changed by calling the url `http://yourHomebridgeServerIp:webhook_port/?accessoryId=theAccessoryIdToTrigger&stateOutletInUse=NEWSTATE`

## Fanv2
For fanv2 the value for `NEWSTATE` is either `true` for on or `false` for off.

# Trigger action

## Switch
Expand All @@ -65,6 +68,9 @@ For lights you can trigger a url of any system for switching the light on or off
## Outlet
For outlets you can trigger a url of any system for switching the outlet on or off.

## Fanv2
For fanv2 you can trigger a url of any system for switching the fanv2 on or off.

# Update a numeric accessory
To update a numeric accessory you need to call the url `http://yourHomebridgeServerIp:webhook_port/?accessoryId=theAccessoryIdToUpdate&value=NEWVALUE`

Expand Down Expand Up @@ -127,6 +133,14 @@ Setting of target position you can realize by send link to: open, 20%, 40%, 60%

If you dont use callbacks to let your covering give feedback of current position back to homekit you can set "auto_set_current_position" to true.

# Fanv2
To update a fanv2 you can update five different values:
* Rotation Speed (%): `http://yourHomebridgeServerIp:webhook_port/?accessoryId=theAccessoryIdToUpdate&speed=%s` (%s is replaced by fan's rotation speed)
* Swing Mode (DISABLED=0 / ENABLED=1): `http://yourHomebridgeServerIp:webhook_port/?accessoryId=theAccessoryIdToUpdate&swingMode=0 (or 1)` (To use this feature, "enableSwingModeControls" in confing must be set to true.)
* Rotation Direction (CLOCKWISE=0 / COUNTER_CLOCKWISE=1): `http://yourHomebridgeServerIp:webhook_port/?accessoryId=theAccessoryIdToUpdate&rotationDirection=0 (or 1)`
* Lock Physical Controls (DISABLED=0 / ENABLED=1): `http://yourHomebridgeServerIp:webhook_port/?accessoryId=theAccessoryIdToUpdate&lockstate=0 (or 1)` (To use this feature, "enableLockPhysicalControls" in confing must be set to true.)
* Target Fan State (MANUAL=0 / AUTO=1): `http://yourHomebridgeServerIp:webhook_port/?accessoryId=theAccessoryIdToUpdate&targetState=0 (or 1)`(To use this feature, "enableTargetStateControls" in confing must be set to true.)


# Configuration
Example config.json:
Expand Down Expand Up @@ -361,6 +375,49 @@ Example config.json:
"close_body": "{ \"open\": false }", // (optional only for POST and PUT; use "close_form" for x-www-form-urlencoded JSON)
"close_headers": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}" // (optional)
}
],
"fanv2s": [
{
"id": "fanv2-1",
"name": "Fanv2-1",
"rejectUnauthorized": true, // (optional)
"on_url": "your url to switch the fanv2 on",
"on_method": "GET",
"on_body": "{ \"on\" : true }",
"on_headers": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"off_url": "your url to switch the fanv2 off",
"off_method": "GET",
"off_body": "{ \"off\" : true }",
"off_headers": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"speed_url": "your url to change the fanv2 rotation speed",
"speed_method": "GET",
"speed_body": "{ \"on\" : %statusPlaceholder, \"speed\" : %speedPlaceholder}",
"speed_headers": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"speed_factor":2.55,
"enableLockPhysicalControls": true,
"lock_url": "your url to lock the fanv2's physical controls",
"lock_method": "GET",
"lock_body": "{ \"physicalLock\": true }",
"lock_headers": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"unlock_url": "your url to unlock the fanv2's physical controls",
"unlock_method": "GET",
"unlock_body": "{ \"physicalLock\": false }",
"unlock_headers": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"enableTargetStateControls": true,
"target_state_url": "your url to change the fanv2's target state",
"target_state_method": "GET",
"target_state_body": "{ \"mode\": %targetState }",
"target_state_headers": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"enableSwingModeControls": true,
"swing_mode_url": "your url to change the fanv2's swing mode",
"swing_mode_method": "GET",
"swing_mode_body": "{ \"swing_mode\": %swingMode }",
"swing_mode_headers": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"rotation_direction_url": "your url to change the fanv2's rotation direction",
"rotation_direction_method": "GET",
"rotation_direction_body": "{ \"rotation_direction\": %rotationDirection }",
"rotation_direction_headers": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}"
}
]
}
]
Expand Down
301 changes: 301 additions & 0 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,253 @@
}
}
}
},
"fanv2s": {
"type": "array",
"title": "Fanv2",
"description": "Turn On and Off Fanv2 by triggering a URL of any system.",
"items": {
"title": "Fanv2s",
"type": "object",
"properties": {
"id": {
"title": "ID",
"type": "string",
"placeholder": "fanv2-1",
"required": false
},
"name": {
"title": "Name",
"type": "string",
"placeholder": "Fanv2 1",
"required": false
},
"rejectUnauthorized": {
"title": "Reject Unauthorized SSL Certificate",
"type": "boolean",
"placeholder": true,
"required": false
},
"on_url": {
"title": "On URL",
"type": "string",
"placeholder": "your url to switch the fanv2 on",
"required": false
},
"on_method": {
"title": "On Method",
"type": "string",
"placeholder": "GET",
"required": false
},
"on_body": {
"title": "On Body",
"type": "string",
"placeholder": "{ \"on\" : true }",
"required": false
},
"on_headers": {
"title": "On Headers",
"type": "string",
"placeholder": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"required": false
},
"off_url": {
"title": "Off URL",
"type": "string",
"placeholder": "your url to switch the fanv2 off",
"required": false
},
"off_method": {
"title": "Off Method",
"type": "string",
"placeholder": "GET",
"required": false
},
"off_body": {
"title": "Off Body",
"type": "string",
"placeholder": "{ \"on\": false }",
"required": false
},
"off_headers": {
"title": "Off Headers",
"type": "string",
"placeholder": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"required": false
},
"speed_url": {
"title": "Speed URL",
"type": "string",
"placeholder": "your url to change the fanv2 rotation speed",
"required": false
},
"speed_method": {
"title": "Speed Method",
"type": "string",
"placeholder": "GET",
"required": false
},
"speed_body": {
"title": "Speed Body",
"type": "string",
"placeholder": "{ \"on\" : %statusPlaceholder, \"speed\" : %speedPlaceholder}",
"required": false
},
"speed_headers": {
"title": "Speed Headers",
"type": "string",
"placeholder": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"required": false
},
"speed_factor": {
"title": "Speed Factor",
"type": "number",
"placeholder": 2.55,
"required": false,
"typeahead": {
"source": [
2.55
]
}
},
"enableLockPhysicalControls": {
"title": "Enable lock physical controls",
"type": "boolean",
"required": false
},
"lock_url": {
"title": "Lock URL",
"type": "string",
"placeholder": "your url to lock the fanv2's physical controls",
"required": false
},
"lock_method": {
"title": "Lock Method",
"type": "string",
"placeholder": "GET",
"required": false
},
"lock_body": {
"title": "Lock Body",
"type": "string",
"placeholder": "{ \"physicalLock\": true }",
"required": false
},
"lock_headers": {
"title": "Lock Headers",
"type": "string",
"placeholder": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"required": false
},
"unlock_url": {
"title": "Unlock URL",
"type": "string",
"placeholder": "your url to unlock the fanv2's physical controls",
"required": false
},
"unlock_method": {
"title": "Unlock Method",
"type": "string",
"placeholder": "GET",
"required": false
},
"unlock_body": {
"title": "Unlock Body",
"type": "string",
"placeholder": "{ \"physicalLock\": false }",
"required": false
},
"unlock_headers": {
"title": "Unlock Headers",
"type": "string",
"placeholder": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"required": false
},
"enableTargetStateControls": {
"title": "Enable Target State Controls",
"type": "boolean",
"required": false
},
"target_state_url": {
"title": "Target State URL",
"type": "string",
"placeholder": "your url to change the fanv2's target state",
"required": false
},
"target_state_method": {
"title": "Target State Method",
"type": "string",
"placeholder": "GET",
"required": false
},
"target_state_body": {
"title": "Target State Body",
"type": "string",
"placeholder": "{ \"mode\": %targetState }",
"required": false
},
"target_state_headers": {
"title": "Target State Headers",
"type": "string",
"placeholder": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"required": false
},
"enableSwingModeControls": {
"title": "Enable Swing Mode Controls",
"type": "boolean",
"required": false
},
"swing_mode_url": {
"title": "Swing Mode URL",
"type": "string",
"placeholder": "your url to change the fanv2's swing mode",
"required": false
},
"swing_mode_method": {
"title": "Swing Mode Method",
"type": "string",
"placeholder": "GET",
"required": false
},
"swing_mode_body": {
"title": "Swing Mode Body",
"type": "string",
"placeholder": "{ \"swing_mode\": %swingMode }",
"required": false
},
"swing_mode_headers": {
"title": "Swing Mode Headers",
"type": "string",
"placeholder": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"required": false
},
"rotation_direction_url": {
"title": "Rotation Direction URL",
"type": "string",
"placeholder": "your url to change the fanv2's rotation direction",
"required": false
},
"rotation_direction_method": {
"title": "Rotation Direction Method",
"type": "string",
"placeholder": "GET",
"required": false
},
"rotation_direction_body": {
"title": "Rotation Direction Body",
"type": "string",
"placeholder": "{ \"rotation_direction\": %rotationDirection }",
"required": false
},
"rotation_direction_headers": {
"title": "Rotation Direction Headers",
"type": "string",
"placeholder": "{\"Authorization\": \"Bearer ABCDEFGH\", \"Content-Type\": \"application/json\"}",
"required": false
}
}
}
}
}
},
Expand Down Expand Up @@ -1288,6 +1535,60 @@
]
}
]
},
{
"type": "section",
"title": "Fanv2",
"expandable": true,
"expanded": false,
"items": [
{
"title": "Fanv2",
"type": "array",
"orderable": false,
"items": [
"fanv2s[].id",
"fanv2s[].name",
"fanv2s[].rejectUnauthorized",
"fanv2s[].on_url",
"fanv2s[].on_method",
"fanv2s[].on_body",
"fanv2s[].on_headers",
"fanv2s[].off_url",
"fanv2s[].off_method",
"fanv2s[].off_body",
"fanv2s[].off_headers",
"fanv2s[].speed_url",
"fanv2s[].speed_method",
"fanv2s[].speed_body",
"fanv2s[].speed_headers",
"fanv2s[].speed_factor",
"fanv2s[].enableLockPhysicalControls",
"fanv2s[].lock_url",
"fanv2s[].lock_method",
"fanv2s[].lock_body",
"fanv2s[].lock_headers",
"fanv2s[].unlock_url",
"fanv2s[].unlock_method",
"fanv2s[].unlock_body",
"fanv2s[].unlock_headers",
"fanv2s[].enableTargetStateControls",
"fanv2s[].target_state_url",
"fanv2s[].target_state_method",
"fanv2s[].target_state_body",
"fanv2s[].target_state_headers",
"fanv2s[].enableSwingModeControls",
"fanv2s[].swing_mode_url",
"fanv2s[].swing_mode_method",
"fanv2s[].swing_mode_body",
"fanv2s[].swing_mode_headers",
"fanv2s[].rotation_direction_url",
"fanv2s[].rotation_direction_method",
"fanv2s[].rotation_direction_body",
"fanv2s[].rotation_direction_headers"
]
}
]
}
]
}
Expand Down
Loading

0 comments on commit f80ca5c

Please sign in to comment.