gh-device
Description
The gh-device block exposes one device in Google Home and connects it to the project logic. You can read its state and control it from the Google Home app or through Google Assistant. You can also update the device state from the project logic by sending a valid value to the input. The integration uses the F&Home server’s existing connection to F&Home Cloud.
Configuration parameters
| Parameter name | Value |
|---|---|
Name (name) |
The device name sent to Google Home. The name must be non-empty. A name assigned by the user in Google Home takes precedence in the app. |
| Device type in Google Home | One device type from the table below. The type determines the functions available in Google Home and the meaning of signals in the project. |
Local accounts (send_to) |
The list of local accounts that can read the device state and control the device. The list is empty by default and the block operates locally. |
Update state from input only (state_from_input_only) |
The option is unchecked by default and the input is optional. When checked, the block uses device feedback to determine the state. At least one source must then be connected to the input. |
| Device type in Google Home | Available functions |
|---|---|
| Gate | Open and close the gate and read its state. |
| Door | Open and close the door and read its state. |
| Switch | Turn on and off and read the state. |
| Dimmable Light | Turn on and off and set and read brightness. |
| RGB Light | Turn on and off and set and read brightness and color. The type is rgb_led when importing a project. |
| Blinds | Set and read the blind position. |
| Blinds with adjustable louvers | Set and read the blind and louver positions. |
| Roller blind without louvers | Set and read the roller blind position. |
| Roller blind with louvers | Set and read the roller blind and louver positions. |
Sharing in Google Home
You can select a local account before linking it to a cloud client account. To share the device, connect the server to F&Home Cloud, configure the block and select at least one local account linked to a cloud client account. To use the device in Google Home, link your cloud client account to Google Home.
Deselecting a local account or unlinking it from its cloud client account immediately revokes its access, even if Google Home still shows the device. Other authorized accounts keep their access.
Input handling
The block has one input, which accepts multiple connections. For each part of the state, the last valid value received takes effect.
| Input signal | Accepted values |
|---|---|
| Switch state | Boolean values true (on) and false (off). |
| Dimmable Light or RGB Light brightness | A number from 0 to 100, a percentage from 0% to 100%, or boolean values true (turn on) and false (turn off). |
| RGB Light color | Text in RRGGBB format with exactly six hexadecimal digits, without # or spaces. Uppercase and lowercase letters are accepted. |
| Gate or Door state | 0 or false (closed), 1 or true (fully open), 2 (intermediate position), 3 (fault), null (unknown state). |
| Blind or roller blind position | A number from 0 to 100 or a percentage from 0% to 100%, sent directly without a tag block. |
Louver position (tag1) |
A number from 0 to 100 or a percentage from 0% to 100%, sent through a tag block with number 1. Applies to Blinds with adjustable louvers and Roller blind with louvers. |
For a gate or door, send each code as a unitless whole number. 2 and 2.0 indicate the same state. The block ignores fractions, numbers outside the 0–3 range, percentages, temperatures and text. Sending null sets the state to unknown even after the position was known.
For brightness and blind, roller blind or louver positions, you can send an integer, a decimal number or a percentage. The block checks that the value is in the range of 0% to 100% inclusive, then drops the fractional part. 35.9% gives 35%. For brightness, 0.9% gives 0% and turns the light off. The block ignores out-of-range values such as -0.5% and 100.5%, as well as null.
You can change the color of an RGB Light while it is off. The text 000000 means black, and the number 0 means 0% brightness. Invalid color text leaves the current color unchanged.
For blinds and roller blinds, only types with louvers use a tag, tag1. For other devices, the tag number has no effect on how the value is interpreted.
Updating the state
| “Update state from input only” option | Valid change on the input | Google Home command requiring action |
|---|---|---|
| Unchecked | Updates the state and sends the change to the corresponding output. Gate and Door send the state to output 1. | The block adopts the requested state immediately and sends the control value. Gate and Door send the target state to output 1 and the command to output 2. |
| Checked | Updates the current state. Gate and Door forward state changes to output 1. The control outputs wait for Google Home commands. | The block sends the command to the corresponding control output. The next valid input value determines the state, even if it differs from the target. |
If the target has already been reached, the block completes the command without emitting a value. Repeating a command whose target still differs from the current state sends the control value again.
When the option is checked, the block receives feedback through the input. In this mode, the block ignores signals sent to it by group-broadcast.
Each time the project loads with the option unchecked, Switch starts at false and Dimmable Light at 0%. Both emit this value on output 1. With the option checked, their state starts out unknown and output 1 waits for the first command requiring action. Gate and Door initially emit null on output 1 in both modes. Output 2 waits for a Google Home command. The blind or roller blind position and the louver position start out unknown. The position outputs emit no value on project load alone.
RGB Light starts off in both modes, with 0% brightness and the color ffffff. Google Home can read this state as soon as the light is shared. With the option unchecked, the block sends 0% on output 1, while output 2 emits no value on project load alone. With the option checked, both control outputs wait for Google Home commands and a valid input value updates the state.
Input changes update the local state immediately. For a shared device, the server sends the first input change to the cloud immediately. It also sends a change immediately when at least 6 seconds have passed since the preceding input change. After a series of rapid changes, the server waits 6 seconds from the last actual change and sends the latest state if it differs from the last state sent. A repeated value does not extend this wait. If Google Home requests the state during this wait, it receives the current value. The server sends state changes from commands in the default mode immediately.
Dimmable Light and RGB Light brightness
A level from 1% to 100% means the light is on at that brightness. false or 0% means the light is off, and the block remembers the last positive level. true uses the current brightness if the light is on. If the light is off or its state is unknown, true uses the last positive level or 100% if none has been set. The same conversion applies to on and off commands from Google Home.
When the light is off, the control value is 0%. The block sends the off state to Google Home along with the remembered brightness, or 0% if it has yet to remember one. With “Update state from input only” checked, the block remembers brightness based on accepted input values. The remembered brightness is cleared when the project loads.
If a single Google Home command combines turning the light off with brightness above 0%, or turning it on with brightness of 0%, the block rejects the whole command, including any color change.
Blind, roller blind and louver positions
On the blind or roller blind position input and output, 0% means fully open and 100% means fully closed, as in the app-blind-controller block. Google Home uses the percentage open. The block subtracts the value from 100 in both directions. For example, 35.9% on the input gives 35% closed, or 65% open in Google Home.
For louvers, 0% points up, 50% is perpendicular to the window pane and 100% points down. Google Home uses the same louver scale as the logic. The block sends the blind or roller blind position and the louver position to the cloud independently once it knows each value.
Block outputs
| Output number and name | Output description |
|---|---|
| 1. Gate or door state / On or off / Brightness / Blind position / Roller blind position | Gates and doors send an integer code from 0 to 3, or null. Switches send a boolean value, Dimmable Light and RGB Light send brightness in whole percentages, and blinds and roller blinds send their position as a percentage according to the selected mode. |
| 2. Gate or Door command / Louver position / Color | Gate and Door send true (open) or false (close) in response to a Google Home command that requires action. Blinds with adjustable louvers and Roller blind with louvers send the louver position as a percentage, and RGB Light sends its color as six lowercase hexadecimal digits, according to the selected mode. This output is inactive for other device types. |
| 3. F&Home Cloud connection | Sends true when the server has an authenticated connection to F&Home Cloud and false in other states. The output sends its value at startup and whenever it changes. All blocks indicate the status of the same connection, including blocks that operate locally. true can appear before the device is available in Google Home. |
For gates and doors, Google Home shows 0 as 0% open, 1 as 100% open, and 2 as 50% open. Google Home shows null as 100% open so the device is available at startup. Code 3 tells Google Home that the device needs repair.
For a correctly configured block without an assignment error, the description below the block shows the English label for the device type in Google Home, the current state on the logic scale, and cloud connected or cloud disconnected. A correctly configured block continues processing local signals while disconnected. When the connection returns, the server registers the shared devices again and sends their current known states.
Errors returned by the block
The integration supports up to 200 gh-device blocks, including blocks with an empty account list. Existing assignments take priority. A block without an assignment shows an error in its description and remains unavailable in Google Home. When configured correctly, it continues handling local input and output signals according to the selected mode.
| Message or condition | What to do |
|---|---|
Invalid block ID. |
Check the block identifier in the imported project. A valid identifier is 1 to 33 bytes long and contains no NUL character. |
Invalid parameter 'devctl_interface_type'. |
In the configurator, select a value for “Device type in Google Home” and save the project. |
Invalid parameter 'name'. |
Enter a non-empty name. When importing a project, use a name that contains no NUL character. |
Invalid parameter 'state_from_input_only'. |
Set the “Update state from input only” option in the configurator and save the project. |
Invalid parameter 'send_to'. or No valid users specified. |
Select the local accounts again in the configurator. For local operation, clear the account list. |
| The input is disconnected with “Update state from input only” checked | Connect a suitable source of state. The connection itself satisfies this requirement for sharing. A valid input value updates the corresponding part of the state. |
No devctl interface number available. |
Remove an unused gh-device block to free a slot, then reload the project. |
Device initialization failed., Could not determine the devctl interface number. or Could not save the devctl interface number assignment. |
Reload the project. If the message recurs, pass it on to the installer. |
The devctl interface number assignment is ambiguous. |
Give the message to the installer so they can check the devctl interface number assignments. |
If the device is unavailable in Google Home, check the connection on output 3, the local account selection, the link to the cloud client account, and the link from that cloud client account to Google Home. If a switch, dimmable light, blind or roller blind still has an unknown state, send an appropriate value to the input. If output 1 of a gate or door sends 3 (fault), check the source of state connected to the input.
Usage examples
-
Gate with feedback. Check “Update state from input only”, connect the gate's state source to the input and use output 2 to control opening and closing. When the input provides
false(closed), a Google Home command to close completes without emitting a value. A command to open sendstrueto output 2. When the source provides2and thentrue, output 1 sends2and then1. If the input reports0again, the next command to open sendstrueto output 2 again. -
Dimmable Light with feedback. Check the same option and send the actual brightness to the input. With
30%confirmed, two Google Home requests to set70%send70%on output 1 twice if the brightness remains at30%during that time. When the input confirms70%, the block adopts that state. A further request for70%completes without emitting a value. -
Changing the color of an RGB Light while it is off. In the default mode, send
35.9%, thenfalse, then the textFF0080. The light turns on at35%, turns off and receivesff0080on output 2. Sendingtruenext restores35%with the new color.