This tells you how to set up the Command Line Interface (CLI)
This is the starting tutorial for Zigbee edge drivers:
And one for Z wave:
Does that help?
This tells you how to set up the Command Line Interface (CLI)
This is the starting tutorial for Zigbee edge drivers:
And one for Z wave:
Does that help?
Thanks @JDRoberts yes it helps some, unfortunately for me I’m a learn by watching and doing kind of person.
I was hoping for a step by step from a blank slate.
There’s a lot of before you do this you need this setup, go to this link. Then you need this and by the way you need to configure this go to this link.
There needs to be a very clear step by step not got to this link do this, go to this link then this link do this now, then go back 1 step do this now, go to this link do this and now you can go back to where you started.
SmartThings has rarely provided beginner’s guides throughout their history. (Try figuring out how to use only specific selected sensors for STHM, for example. Or what repeaters do. Or how geopresence works. Or what a precondition does. Or using light groups. Just sayin ’…)
but who knows, maybe they will this time. One can always hope.
Deleted my posts. You asked about edge and my posts were not about edge. Sorry. Should have read it closer.
The videos inside of @JDRoberts 's links are pretty good overall. They walk you through it in the fashion you are looking for, including setup. Just choose your flavor zigbee/zwave/lan and go from there. For completeness, here is the LAN setup.
You need to install the CLI and have a way to edit text files. Everything else is fluff.
I don’t know exactly where you are, but I’ll try to explain how I did it
How to edit the LUA and yml code of the Edge drivers
I’m going to explain the steps I did, that I’m not a developer and I started from scratch, without knowing the CLI or Lua.
This is the official tutorial.
• Unzip it and move the smartthings.exe file to a folder on your computer from where it will be used. for example to a new folder in documents/CLI
• You have to open the windows powerShell terminal window and you have to go to the directory (folder) where the smarttings.exe file is.
• Use the DOS commands “cd…” to move down directory and “cd directory name” to move to that directory. This is an example of my folder for CLI or VSC folder
• the first time you type a CLI command it will take you to the smartthing page to authorize your account.
• type .\smartthings edge:drivers:logcat
• enter the IP of your HUB, you can see it in IDE
• It will show you the list of drivers installed on your HUB
• type the number corresponding to the driver you want to see
• It will show you the activity of the device connected to that driver.
To modify an existing Driver
VERY IMPORTANT to create different versions of the driver. The Driver ID is unique:
10.1. Youcan create different versions of the driver with different IDs, which will look like different drivers
10.2. You can create driver versions with the same ID, which will look like a new version with a different date of the same driver and overwrite the previous version.
10.3. this is controlled with the config.yml file and the name and packagekey fields
name: 'Zigbee Switch Mc'
packageKey: 'Zigbee_Switch_v5'
permissions:
zigbee: {}
10.4. Name: It is the name with which the driver is created. Changes in this field does not change the driver ID, it only modifies the name and overwrites the previous driver
10.5. packageKey: This name is used to create the Driver ID. If you modify this field, versions of the driver with different ID are created, which will be seen as different drivers. You can use -v1… vx to create different versions without modifying the previous ones that already work well
- id: "LIDL Plug/TS011F"
deviceLabel: Lidl Plug
manufacturer: _TZ3000_kdi2o9m6
model: TS011F
deviceProfileName: single-switch-plug
.\smartthings edge:drivers:package C:\Users\Mariano\Documents\Mariano\VSC\SampleDrivers\zigbee-switch-power-v2
You can copy the path of the containing folder of the code and paste it into the CLI command
┌─────────────┬──────────────────────────────────────┐
│ Driver Id │ f72a817f-7181-4538-8ef3-e932343a03de │
│ Name │ Zigbee Switch Power Mc │
│ Package Key │ Zigbee_Switch_Power-v2 │
│ Version │ 2022-01-25T11:40:11.202738 │
.\smartthings edge:channels:assign
Install the driver on your Hub and follow the cli prompts:
.\smartthings edge:drivers:install
To capture the pairing log:
• Uninstall the device with the app
• Open the terminal window with the CLI ready to see the log of the driver to which the device is going to be paired
• In the app, add new device and search nearby
• When paired in the app you will see information appear in the CLI window
• When it finishes pairing, select the data in the window, copy and paste it in the post
Kudos to @Mariano_Colmenarejo. Not only do you provide drivers for a lot of devices you took the time to document the process that you used. Very much appreciated.
Good write up.
@Jake_Mohl the tutorials don’t cover things like setting up node or your development environment because these processes are being updated frequently and there are many tutorials for this. Once you have your workstation configured the actual driver development process is quite straight forward.
@Mariano_Colmenarejo
NOW THIS IS EXACTLY WHAT I WAS HOPING FOR!
THANK YOU!
I can only smash the button once but if I could it would be x1000.
I agree but there should be something better than what was there.
With each question and with each answer we all learn something new!!!
Hello Mariano
I’m not a developer or coder, just follow along these discussions with interest. Not that I understand anything about edge but have a curiosity. After ready your write up I feel better prepared to take the plunge and dabble in edge. Thank you for the clear explanation of how to approach this. In my book your a valuable asset to this community.
Regards
Doug
Sort off, I generally forget the answer… and then ask again months later when I remember to ask the same question, probably why I feel I don’t have the aptitude for dev work
Wonderful guide and well explained
Can you please write some more regarding regarding init.lua files , Preferences buttons, other buttons. Give some good hints for non developer…
I just want to create setting that initialize calibration and % reversal for ZigBee shutter module. I know the cluster and attribute and values but how to send and debug. Any help is appreciate.
Moving and pausing is working with generic ST driver…
manufacturer: _TZ3000_vd43bbfq
model : TS130F
This is not something that is explained in a few words, it is several different tasks and the best is see examples and try do it.
if it is about writing a value in a cluster attribute, you can see how the writing of the attribute is done to restore the state after a power outage in my Zigbee Switch Mc driver:
- name: "restoreState"
title: "Restore State After Power Lost"
description: "After the power supply is back on, the State can be restored to previous state or remain switched off"
required: false
preferenceType: enumeration
definition:
options:
"0": "device remains switched Off"
"1": "device remains switched On"
"255": "device restores previous state"
default: "255"
--- Update preferences after infoChanged recived---
function driver_handler.do_Preferences (self, device)
for id, value in pairs(device.preferences) do
print("device.preferences[infoChanged]=", device.preferences[id])
oldPreferenceValue = device:get_field(id)
newParameterValue = device.preferences[id]
if oldPreferenceValue ~= newParameterValue then
device:set_field(id, newParameterValue, {persist = true})
print("<< Preference changed: name, old, new >>", id, oldPreferenceValue, newParameterValue)
--- Configure on-off cluster, attributte 0x8002 and 4003 to value restore state in preferences
if id == "restoreState" then
print("<<< Write restore state >>>")
local value_send = tonumber(newParameterValue)
local data_value = {value = value_send, ID = 0x30}
local cluster_id = {value = 0x0006}
--write atribute for Tuya devices
local attr_id = 0x4003
write_attribute_function(device, cluster_id, attr_id, data_value)
--write atribute for Tuya devices (Restore previous state = 0x02)
if newParameterValue == "255" then data_value = {value = 0x02, ID = 0x30} end
attr_id = 0x8002
write_attribute_function(device, cluster_id, attr_id, data_value)
end
The function write_attribute_function(device, cluster_id, attr_id, data_value)
is a custom code modified from default libraries, is in the top of random.lua. You can copy and paste in your file.
Only have to send the values of the variables (device, cluster_id, attr_id, data_value)
The data_value = {value = 0x02, ID = 0x30} : value is new value to send and ID is the datatype, you have to use the correct data Type for the atributte (see the developers document or lua libraries to see all types). data type 0x30 = “Enum8”
Thank you for this great intro, it is extremely helpful.
Do you have any idea how to get started with window shutter calibration (zigbee)?
Hi Mariano,
thanks for very detailed guide.
I did your steps carefully, step by step.
in the end of the toturial i got error when type “.\smartthings edge:drivers:package ”
i very want to learn how to add and customized new devices to help the community grows
thanks,
Haim
Hi @Haim_Azulay
The error that the compiler has encountered is that the file fingerprints.yml on line 127 is misaligned.
Align the - id with the previous - id line
Be careful with .yaml and .yml files. With YAML the amount of indentation at the start of a line carries different meanings depending on whether it is the same, more than, or less than, that on the previous line. It also has to be all spaces, tab stops will not be accepted. If you are editing an existing file try and make things line up with the existing code and then you should be OK.
Hi @Mariano_Colmenarejo ,
thanks for your response!
How can i fix it? the id is a unique one, as you can see it’s combine with
manufacturer and model text.