Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDF for Sonoff ZBMini R2 Extreme (ZBMINIR2) #8034

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion button_maps.json
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@
]
},
"sonoffOnOffMap": {
"vendor": "Sonoff",
"vendor": "SONOFF",
"doc": "Switch SNZB-01",
"modelids": ["WB01", "WB-01", "SNZB-01P"],
"map": [
Expand All @@ -1610,6 +1610,16 @@
[1, "0x01", "ONOFF", "TOGGLE", "0", "S_BUTTON_1", "S_BUTTON_ACTION_SHORT_RELEASED", "short"]
]
},
"ZBMINIR2": {
"vendor": "SONOFF",
"doc": "ZBMINIR2",
"modelids": ["ZBMINIR2"],
"map": [
[1, "0x01", "ONOFF", "ATTRIBUTE_REPORT", "0x01", "S_BUTTON_1", "S_BUTTON_ACTION_SHORT_RELEASED", "On"],
[1, "0x01", "ONOFF", "ATTRIBUTE_REPORT", "0x00", "S_BUTTON_2", "S_BUTTON_ACTION_SHORT_RELEASED", "Off"],
[1, "0x01", "ONOFF", "TOGGLE", "0", "S_BUTTON_1", "S_BUTTON_ACTION_SHORT_RELEASED", "Toggle"]
]
},
"ZGRC-KEY-009": {
"vendor": "YPHIX",
"doc": "RGB wall switch",
Expand Down
7 changes: 7 additions & 0 deletions de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4880,6 +4880,13 @@ void DeRestPluginPrivate::checkSensorButtonEvent(Sensor *sensor, const deCONZ::A
{
ok = false;
}
// SonOff
if (sensor->manufacturer() == QLatin1String("SONOFF"))
{
// payload: u16 attrId, u8 datatype, u8 data
// Comparing only data
ok = buttonMap.zclParam0 == zclFrame.payload().at(3);
}
else if (ind.clusterId() == ONOFF_CLUSTER_ID && sensor->manufacturer() == QLatin1String("LUMI"))
{
quint8 value;
Expand Down
8 changes: 8 additions & 0 deletions devices/generic/items/config_on_delayedpoweron_item.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"schema": "resourceitem1.schema.json",
"id": "config/on/delayedpoweron",
"datatype": "Bool",
"access": "RW",
"public": true,
"description": "Delays On/Off state on device startup (power on)."
}
282 changes: 282 additions & 0 deletions devices/sonoff/zbminir2_relay.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
{
"schema": "devcap1.schema.json",
"manufacturername": "SONOFF",
"modelid": "ZBMINIR2",
"product": "Sonoff ZBMINI R2 Extreme",
"sleeper": false,
"status": "Gold",
"subdevices": [
{
"type": "$TYPE_ON_OFF_OUTPUT",
"restapi": "/lights",
"uuid": [
"$address.ext",
"0x01"
],
"items": [
{
"name": "attr/id"
},
{
"name": "attr/lastannounced"
},
{
"name": "attr/lastseen"
},
{
"name": "attr/manufacturername"
},
{
"name": "attr/modelid"
},
{
"name": "attr/name"
},
{
"name": "attr/swversion"
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "state/on"
},
{
"name": "state/reachable"
}
]
},
{
"type": "$TYPE_SWITCH",
"restapi": "/sensors",
"uuid": [
"$address.ext",
"0x01",
"0x0006"
],
"meta": {
"values": {
"config/mode": {
"off": 9,
"on": 20
}
}
},
"items": [
{
"name": "attr/id"
},
{
"name": "attr/lastannounced"
},
{
"name": "attr/lastseen"
},
{
"name": "attr/manufacturername"
},
{
"name": "attr/modelid"
},
{
"name": "attr/name"
},
{
"name": "attr/swversion"
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "config/clickmode",
"description": "Allows configuration of the Relay (Detached Relay Mode). Usable Values are 'coupled' and 'decoupled'",
"default": "coupled",
"refresh.interval": 300,
"read": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0xfc11",
"at": "0x0017"
},
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0xfc11",
"at": "0x0017",
"eval": "if (Attr.val == 0) { Item.val = 'coupled' } else if (Attr.val == 1) { Item.val = 'decoupled'}"
},
"write": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0xfc11",
"at": "0x0017",
"dt": "0x10",
"eval": "if (Item.val == 'coupled') { 0 } else if (Item.val == 'decoupled') { 1 } else { '0' }"
},
"values": [
["\"coupled\"", "Relay Mode"],
["\"decoupled\"", "Detach Relay Mode"]
]
},
{
"name": "config/devicemode",
"description": "Mode of the Switch with possible values 'rocker', 'momentary', 'followingon', 'followingoff'.",
"default": "rocker",
"refresh.interval": 300,
"read": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0xfc11",
"at": "0x0016"
},
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0xfc11",
"at": "0x0016",
"eval": "if (Attr.val == 0) { Item.val = 'rocker' } else if (Attr.val == 1) { Item.val = 'momentary' } else if (Attr.val == 2) { Item.val = 'followingoff' } else if (Attr.val == 130) { Item.val = 'followingon' } else { Item.val = 'unknown' }"
},
"write": {
"fn": "zcl:attr",
"ep": 1,
"at": "0x0016",
"cl": "0xfc11",
"dt": "0x20",
"eval": "if (Item.val == 'rocker') { 0 } else if (Item.val == 'momentary') { 1 } else if (Item.val == 'followingoff') { 2 } else if (Item.val == 'followingon') { 130 } else { 'unknown' }"
},
"values": [
["\"momentary\"", "Momentary"],
["\"rocker\"", "Rocker"],
["\"followingoff\"", "Following (On)"],
["\"follogwingon\"", "Following (Off)"]
]
},
{
"name": "config/delay",
"description": "Timedelay for On/Off state on device startup (power on).",
"refresh.interval": 3600,
"default": 0,
"range": [
1,
3600
],
"read": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0xfc11",
"at": "0x0015"
},
"write": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0xfc11",
"at": "0x0015",
"dt": "0x21",
"eval": "Item.val"
},
"parse": {
"fn": "zcl:attr",
"ep": 1,
"at": "0x0015",
"cl": "0xfc11",
"eval": "Item.val = Attr.val"
}
},
{
"name": "config/mode",
"description": "Enables or disable the Turbo Mode to Boost the signal.",
"default": "off",
"read": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0xfc11",
"at": "0x0012"
},
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0xfc11",
"at": "0x0012",
"eval": "if (Attr.val == 9) { Item.val = 'off' } else if (Attr.val == 20) { Item.val = 'on' } else { Item.val = 'unknown' }"
},
"write": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0xfc11",
"at": "0x0012",
"dt": "0x29",
"eval": "if (Item.val == 'off') { 9 } else if (Item.val == 'on') { 20 }"
},
"values": [
["\"off\"", "Turbo Mode Off"],
["\"on\"", "Turbo Mode On"],
["\"unknown\"", "Unknown"]
]
},
{
"name": "config/on"
},
{
"name": "config/on/delayedpoweron",
"description": "Enables or disable the timedelay for On/Off state on device startup (power on).",
"refresh.interval": 3600,
"read": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0xfc11",
"at": "0x0014"
},
"write": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0xfc11",
"at": "0x0014",
"dt": "0x10",
"eval": "Item.val"
},
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0xfc11",
"at": "0x0014",
"eval": "Item.val = Attr.val"
}
},
{
"name": "config/on/startup"
},
{
"name": "config/reachable"
},
{
"name": "state/buttonevent",
"description": "The last received button event."
},
{
"name": "state/lastupdated"
}
]
}
],
"bindings": [
{
"bind": "unicast",
"src.ep": 1,
"cl": "0x0006",
"report": [
{
"at": "0x0000",
"dt": "0x10",
"min": 5,
"max": 1800
}
]
}
]
}
15 changes: 9 additions & 6 deletions general.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5728,12 +5728,15 @@ Contactor > On/off=0003 - HP/HC=0004</description>
</cluster>

<!-- SONOFF -->
<cluster id="0xfc11" name="Sonoff specific" mfcode="0x1286">
<description>Cluster for light sensor</description>
<server>
<attribute id="0x2001" name="Brightness" type="u8" access="r" required="m" mfcode="0x1286">
<description></description>
</attribute>
<cluster id="0xfc11" name="Cluster for Sonoff Specific Attributes" mfcode="0x1286">
<description>Cluster for Sonoff Specific Attributes</description>
<server>
<attribute id="0x0012" name="Radio Power Turbo Mode" type="s16" access="rw" required="m"></attribute>
<attribute id="0x0014" name="Power-On State" type="bool" access="rw" required="m"></attribute>
<attribute id="0x0015" name="Power-On Time" type="u16" access="rw" required="m"></attribute>
<attribute id="0x0016" name="External Switch Mode" type="u8" access="rw" required="m"></attribute>
<attribute id="0x0017" name="Detach Relay Mode" type="bool" access="rw" required="m"></attribute>
<attribute id="0x2001" name="Brightness" type="u8" access="r" required="m" mfcode="0x1286"></attribute>
</server>
<client>
</client>
Expand Down
Loading