Skip to content

Commit

Permalink
Merge branch 'main' into GELighting-RightBulbName-A19
Browse files Browse the repository at this point in the history
  • Loading branch information
linus2017 authored Sep 21, 2023
2 parents a8da5bf + fad8e69 commit 2ae53db
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 2 deletions.
3 changes: 2 additions & 1 deletion drivers/SmartThings/matter-window-covering/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ local function current_status_handler(driver, device, ib, response)
) or DEFAULT_LEVEL
for _, rb in ipairs(response.info_blocks) do
if rb.info_block.attribute_id == clusters.WindowCovering.attributes.CurrentPositionLiftPercent100ths.ID and
rb.info_block.cluster_id == clusters.WindowCovering.ID then
rb.info_block.cluster_id == clusters.WindowCovering.ID and
rb.info_block.data.value ~= nil then
position = 100 - math.floor((rb.info_block.data.value / 100))
end
end
Expand Down
5 changes: 5 additions & 0 deletions drivers/SmartThings/zwave-valve/src/inverse_valve/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ local capabilities = require "st.capabilities"
local cc = require "st.zwave.CommandClass"
--- @type st.zwave.CommandClass.SwitchBinary
local SwitchBinary = (require "st.zwave.CommandClass.SwitchBinary")({ version=2, strict=true })
--- @type st.zwave.CommandClass.Basic
local Basic = (require "st.zwave.CommandClass.Basic")({ version=1, strict=true })
local valve_defaults = require "st.zwave.defaults.valve"

local function open_handler(driver, device, command)
Expand All @@ -42,6 +44,9 @@ local inverse_valve = {
zwave_handlers = {
[cc.SWITCH_BINARY] = {
[SwitchBinary.REPORT] = binary_report_handler
},
[cc.BASIC] = {
[Basic.REPORT] = binary_report_handler
}
},
capability_handlers = {
Expand Down
37 changes: 37 additions & 0 deletions drivers/SmartThings/zwave-valve/src/test/test_inverse.valve.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ local zw = require "st.zwave"
local zw_test_utils = require "integration_test.zwave_test_utils"
local t_utils = require "integration_test.utils"
local SwitchBinary = (require "st.zwave.CommandClass.SwitchBinary")({version=2})
local Basic = (require "st.zwave.CommandClass.Basic")({ version=1 })

local fortrezz_valve_endpoints = {
{
Expand Down Expand Up @@ -77,6 +78,42 @@ test.register_message_test(
}
)

test.register_message_test(
"Basic valve on/off report should be handled: off",
{
{
channel = "zwave",
direction = "receive",
message = { mock_device.id, zw_test_utils.zwave_test_build_receive_command(
Basic:Report({value=SwitchBinary.value.OFF_DISABLE})
) }
},
{
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main", capabilities.valve.valve.open())
}
}
)

test.register_message_test(
"Basic valve on/off report should be handled: on",
{
{
channel = "zwave",
direction = "receive",
message = { mock_device.id, zw_test_utils.zwave_test_build_receive_command(
Basic:Report({value=SwitchBinary.value.ON_ENABLE})
) }
},
{
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main", capabilities.valve.valve.closed())
}
}
)

test.register_coroutine_test(
"Turning valve on should generate correct zwave messages",
function()
Expand Down
19 changes: 18 additions & 1 deletion tools/deploy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os, subprocess, requests, json, time, yaml
import os, subprocess, requests, json, time, yaml, csv

BRANCH = os.environ.get('BRANCH')
ENVIRONMENT = os.environ.get('ENVIRONMENT')
Expand Down Expand Up @@ -31,6 +31,23 @@
drivers_updated = []
uploaded_drivers = {}

## do translations here
LOCALE = os.environ.get('LOCALE')
if LOCALE:
LOCALE = LOCALE.lower()

current_path = os.path.dirname(__file__)
localization_dir = os.path.join(current_path, "localizations")
localization_file = os.path.join(localization_dir, LOCALE+".csv")
slash_escape = str.maketrans({"/": r"\/"})
if os.path.isfile(localization_file):
print("Localizing from english to "+LOCALE+" using "+str(localization_file))
with open(localization_file) as csvfile:
reader = csv.reader(csvfile)
for row in reader:
print("en: "+row[0]+" "+LOCALE+": "+row[1])
subprocess.run("find . -name 'fingerprints.yml' | xargs sed -i '' 's/deviceLabel: "+row[0].translate(slash_escape)+"/deviceLabel: "+row[1].translate(slash_escape)+"/g'", shell=True)

# Get drivers currently on the channel
response = requests.get(
ENVIRONMENT_URL+"/channels/"+CHANNEL_ID+"/drivers",
Expand Down
38 changes: 38 additions & 0 deletions tools/localizations/cn.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Orvibo Gas Detector,欧瑞博 可燃气体报警器
GDKES Switch 1,粤奇胜智能墙面开关 1
Button,无线开关
DG Light,DG智能灯
GDKES Outlet,粤奇胜智能插座
GDKES Switch 1,粤奇胜智能墙面开关 1
HEIMAN Button,海曼智能紧急按钮
HEIMAN Carbon Monoxide Sensor,海曼一氧化碳报警器
HEIMAN Gas Detector,海曼燃气报警器
HEIMAN Motion Sensor,海曼人体红外传感器
HEIMAN Multipurpose Sensor,海曼温湿度传感器
HEIMAN Open/Closed Sensor,海曼门窗传感器
HEIMAN Remote Control,海曼情景开关
HEIMAN Scene Panel,海曼情景开关
HEIMAN Siren,海曼智能声光报警器
HEIMAN Smoke Detector,海曼烟雾报警器
HEIMAN Switch 1,海曼智能墙面开关 1
HEIMAN Water Leak Sensor,海曼水浸探测器
HONYAR Outlet,鸿雁智能插座
HONYAR Switch 1,鸿雁智能墙面开关 1
Light,智能球泡灯
Motion Sensor,人体传感器
Multipurpose Sensor,温湿度传感器
Orvibo Outlet,欧瑞博智能插座
Orvibo Smoke Detector,欧瑞博 烟雾报警器
Orvibo Switch 1,欧瑞博智能墙面开关 1
Samsung Door Lock,SDS联网型智能锁
Window Treatment,智能窗帘电机
Wistar Window Treatment,威仕达开合帘电机
Zigbee Dimmer,Zigbee调光器
Zigbee Light,Zigbee灯
Zigbee Lock,Zigbee锁
Zigbee Meter,Zigbee功率计
Zigbee Switch,Zigbee开关
Zigbee Thermostat,Zigbee温控
Zigbee Thing,Zigbee设备
Zigbee Vent,Zigbee新风系统
Zigbee Window Treatment,Zigbee窗帘电机

0 comments on commit 2ae53db

Please sign in to comment.