/GrentonObjects_HomeAssistant

This is an unofficial integration of the Grenton system with the Home Assistant.

Primary LanguagePythonApache License 2.0Apache-2.0

GrentonObjects_HomeAssistant

This is an unofficial integration of the Grenton system with the Home Assistant.

If you like what I do, buy me a coffee!

Installation

  1. Copy the folder grenton_objects to the custom_components folder in your Home Assistant. Create the folder if you don't have it. You can use the Visual Studio Code add-on to create the folder and copy the files.

image

  1. Create a HTTPListener virtual object on GateHTTP named HA_Listener_Integration and configure it as follows:
  • Path - /HAlistener (You can edit it if you want)

  • ResponseType - JSON

    image

  1. Create a script named HA_Integration_Script and attach it to the OnRequest event of the virtual object.
local reqJson = GATE_HTTP->HA_Listener_Integration->RequestBody
local code = 400
local resp = { g_status = "Grenton script ERROR" }

if reqJson.command or reqJson.status then
    local results = {}

    for key, value in pairs(reqJson) do
        logDebug("HA integration command >> " .. value)
        results[key] = load(value)()
    end

    resp = { g_status = "OK" }
    for key, result in pairs(results) do
        resp[key] = result
    end

    code = 200
end

GATE_HTTP->HA_Listener_Integration->SetStatusCode(code)
GATE_HTTP->HA_Listener_Integration->SetResponseBody(resp)
GATE_HTTP->HA_Listener_Integration->SendResponse()

NOTE! Pay attention to the name of the GATE and the Object.

image

  1. Add your Grenton objects to the Home Assistant. Example:
light:
  - platform: grenton_objects
    name: "Bedroom Lamp"
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->ZWA8272
  - platform: grenton_objects
    name: "Kitchen Lamp"
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->ZWA8272

where:

  • api_endpoint - is your GateHTTP IP and HTTPListener patch

  • grenton_id is copied from the Id section in the Grenton object properties window

    image

  1. Send configuration to the Grenton Gate HTTP, restart HomeAssistant, and test your new objects in your Dashboard!

The data update in Home Assistant occurs automatically every 30 seconds.

Configure Grenton objects

Add your objects to the configuration.yaml file.

Switch (On_Off)

For:

  • IO MODULE 8/8 DIN
  • IO MODULE 2/2 FM
  • RELAY X2 DIN
  • RELAY X4 DIN
  • RELAY Z-WAVE
  • RELAY WI-FI
switch:
  - platform: grenton_objects
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->DOU8272
    name: "Kitchen Radio Switch"

Light (On_Off)

For:

  • IO MODULE 8/8 DIN
  • IO MODULE 2/2 FM
  • RELAY X2 DIN
  • RELAY X4 DIN
  • RELAY Z-WAVE
  • RELAY WI-FI
light:
  - platform: grenton_objects
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->DOU8272
    name: "Bedroom Lamp"

Light (Dimmer)

For:

  • DIMMER DIN
  • DIMMER FM
light:
  - platform: grenton_objects
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->DIM8272
    name: "Bedroom Dimmer"

For:

  • LED RGBW Z-WAVE (SINGLE ZWAVE_LED OBJECT)
light:
  - platform: grenton_objects
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->ZWA8272
    grenton_type: "DIMMER"
    name: "Bedroom Dimmer"

Light (RGB)

For:

  • LED RGBW DIN
  • LED RGBW FM
light:
  - platform: grenton_objects
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->LED8272
    name: "Bedroom Led"

For:

  • LED RGBW Z-WAVE
light:
  - platform: grenton_objects
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->ZWA8272
    grenton_type: "RGB"
    name: "Bedroom Led"

Cover (Roller_Shutter)

For:

  • ROLLER SHUTTER DIN
  • ROLLER SHUTTER X3 DIN
  • ROLLER SHUTTER FM
  • ROLLER SHUTTER Z-WAVE
cover:
  - platform: grenton_objects
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->ROL5664
    name: "Kichen Blinds"

If ReversePosition is set to Yes:

cover:
  - platform: grenton_objects
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->ROL5664
    reversed: True
    name: "Kichen Blinds"

Climate (Thermostat)

For:

  • THERMOSTAT - Virtual Object
climate:
  - platform: grenton_objects
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->THE9334
    name: "Bedroom Thermostat"

Sensor (Analog Value, e.g. OneWire / Temperature)

For:

  • ONE_WIRE
  • TEMPERATURE_SENSOR (MULTISENSOR)
  • PANELSENSTEMP (SMART PANEL / TOUCH PANEL)
sensor:
  - platform: grenton_objects
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->TEM5469
    name: "Bedroom Temperature"

For:

  • ANALOG IN/OUT DIN
sensor:
  - platform: grenton_objects
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->TEM5469
    unit_of_measurement: "%" # your unit
    name: "Power Measurement"

For:

  • CLU User Feature
sensor:
 - platform: grenton_objects
   api_endpoint: http://192.168.0.4/HAlistener
   grenton_id: CLU221001090->my_user_feature # NOTE! if your user feature is on this GATE HTTP, just type "my_user_feature"
   unit_of_measurement: "m/s" # your unit
   name: "Wind Power"

For:

  • MODBUS, MODBUS_VALUE, MODBUS_RTU, MODBUS_CLIENT, MODBUS_SERVER, MODBUS_SLAVE_RTU
sensor:
  - platform: grenton_objects
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->TEM5469
    grenton_type: "MODBUS_RTU" # MODBUS, MODBUS_VALUE, MODBUS_RTU, MODBUS_CLIENT, MODBUS_SERVER, MODBUS_SLAVE_RTU
    unit_of_measurement: "W" # your unit
    name: "Power Measurement"

Binary Sensor (Digital Value)

For:

  • Any Digital Value (e.g. DIN, ZWAVE_DIN)
binary_sensor:
  - platform: grenton_objects
    api_endpoint: http://192.168.0.4/HAlistener
    grenton_id: CLU221001090->TEM5469
    name: "Kitchen Window Sensor"

Forced faster state update

By default, Home Assistant automatically refreshes entities every 30 seconds. If you want to accelerate the object update, go to the Settings->Automations & Scenes and set up the automation:

  1. Trigger -> Time and location -> Time pattern -> e.g. /10 (every 10 seconds)

Przechwytywanie1

  1. Action -> Other action -> Call service -> Home Assistant Core Integration: Update entity
  2. Select objects (+Choose entity) to be updated at specified intervals.

Przechwytywanie2

  1. Save and restart Home Assistant.