Skip to content

Commit b24ac4b

Browse files
jacky2025093reality-supportjintjautofix-ci[bot]Koenkk
authored
feat: Tuya TS0601_3_phase_clamp_meter: support high-precision AC frequency (#10729)
Signed-off-by: Lucas Hagen <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Daniel Diblik <[email protected]> Co-authored-by: support <[email protected]> Co-authored-by: jintj <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Koen Kanters <[email protected]> Co-authored-by: chris-1243 <[email protected]> Co-authored-by: coldfire0200 <[email protected]> Co-authored-by: gluoncompany <[email protected]> Co-authored-by: Niracler Li <[email protected]> Co-authored-by: DDragicevic <[email protected]> Co-authored-by: David Dreschner <[email protected]> Co-authored-by: torhelge02 <[email protected]> Co-authored-by: Jörn Krenzer <[email protected]> Co-authored-by: Alexandre Jubert <[email protected]> Co-authored-by: joliam <[email protected]> Co-authored-by: Mike Droste <[email protected]> Co-authored-by: Stabni <[email protected]> Co-authored-by: madmalkav <[email protected]> Co-authored-by: MaDMaLKaV <[email protected]> Co-authored-by: Peter Maguire <[email protected]> Co-authored-by: ptvo <[email protected]> Co-authored-by: ptvoinfo <[email protected]> Co-authored-by: Matthew99999 <[email protected]> Co-authored-by: Jakub G. <[email protected]> Co-authored-by: michielstigter <[email protected]> Co-authored-by: Sergio Durigan Junior <[email protected]> Co-authored-by: CCZU1623 <[email protected]> Co-authored-by: Giuliano Barberi <[email protected]> Co-authored-by: Adam Paul <[email protected]> Co-authored-by: Milan Krstić <[email protected]> Co-authored-by: Lucas Hagen <[email protected]> Co-authored-by: Thomas Stig Jacobsen <[email protected]> Co-authored-by: 离骚 <[email protected]> Co-authored-by: Dan Danache <[email protected]> Co-authored-by: Dan Danache <[email protected]> Co-authored-by: Bjk8kds <[email protected]> Co-authored-by: Cedric Krusche <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Liionboy <[email protected]> Co-authored-by: 1tigris1 <[email protected]> Co-authored-by: danivdijk99 <[email protected]> Co-authored-by: AlexisPolegato <[email protected]> Co-authored-by: Bogdan Matei <[email protected]> Co-authored-by: alimac87 <[email protected]> Co-authored-by: tl-zigbee <[email protected]> Co-authored-by: Geoff Ruddock <[email protected]> Co-authored-by: Fedor Lizunkov <[email protected]> Co-authored-by: Jeroen <[email protected]> Co-authored-by: Jeroen van Leusden <[email protected]> Co-authored-by: Alexis Marquet <[email protected]> Co-authored-by: Stephan <[email protected]> Co-authored-by: ff12 <[email protected]> Co-authored-by: CubeZ2mDeveloper <[email protected]> Co-authored-by: QiuYingTao <[email protected]> Co-authored-by: dbmaxpayne <[email protected]> Co-authored-by: Gianmarco Mameli <[email protected]> Co-authored-by: Nailik <[email protected]> Co-authored-by: bilgi-source <[email protected]> Co-authored-by: Marc Perache <[email protected]> Co-authored-by: Nerivec <[email protected]> Co-authored-by: Xenomes <[email protected]> Co-authored-by: Gouar <[email protected]> Co-authored-by: Louis Sautier <[email protected]> Co-authored-by: eject-dream <[email protected]> Co-authored-by: Fabian <[email protected]> Co-authored-by: Christoffer Nielsen <[email protected]> Co-authored-by: Jinna Kiisuo <[email protected]> Co-authored-by: kovbalazs89 <[email protected]> Co-authored-by: batamire <[email protected]> Co-authored-by: Mirko Kirović <[email protected]> Co-authored-by: Andrei LAZAROV <[email protected]> Co-authored-by: zmguko <[email protected]> Co-authored-by: grooveborg <[email protected]> Co-authored-by: manu469 <[email protected]> Co-authored-by: TronickDev <[email protected]> Co-authored-by: Petr Řehoř <[email protected]> Co-authored-by: Ethan‌ <[email protected]> Co-authored-by: lcheng <[email protected]> Co-authored-by: Onium <[email protected]> Co-authored-by: Lucas Teligioridis <[email protected]> Co-authored-by: Kamil Górzyński <[email protected]> Co-authored-by: Christian Grewenig <[email protected]> Co-authored-by: senorosoftware <[email protected]> Co-authored-by: Christopher Chow <[email protected]> Co-authored-by: jomders <[email protected]> Co-authored-by: JNC <[email protected]> Co-authored-by: Arthur Bernardes <[email protected]> Co-authored-by: maxustm <[email protected]> Co-authored-by: Michał Kowol <[email protected]> Co-authored-by: Daniel Diblik <[email protected]> Co-authored-by: Henrik Korkuc <[email protected]> Co-authored-by: 赵德熙 <[email protected]> Co-authored-by: Frank Bakker <[email protected]> Co-authored-by: Dan Gibson <[email protected]> Co-authored-by: Quero Automação <[email protected]> Co-authored-by: Dirk Sveistrup <[email protected]> Co-authored-by: Dominik <[email protected]> Co-authored-by: Bouwe Westerdijk <[email protected]> Co-authored-by: doncarloz1981 <[email protected]> Co-authored-by: Michel Balzer <[email protected]> Co-authored-by: mrmaximas <[email protected]> Co-authored-by: srandier <[email protected]> Co-authored-by: Ian C. <[email protected]> Co-authored-by: agav99 <[email protected]> Co-authored-by: fals3illusion <[email protected]> Co-authored-by: atamanishche <[email protected]> Co-authored-by: Christopher Carruthers <[email protected]> Co-authored-by: dhc25 <[email protected]> Co-authored-by: Ronnie McGregor <[email protected]> Co-authored-by: Martin Meszaros <[email protected]> Co-authored-by: Cato Rønningen <[email protected]> Co-authored-by: vdiogo <[email protected]> Co-authored-by: Antoine Raulin <[email protected]> Co-authored-by: DataGhost <[email protected]> Co-authored-by: mirackle-spb <[email protected]> Co-authored-by: Łukasz Gębicki <[email protected]> Co-authored-by: Krautsalat94 <[email protected]> Co-authored-by: Benjamin Heintz <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: markajm <[email protected]> Co-authored-by: Steve Costin <[email protected]> Co-authored-by: Stemby <[email protected]> Co-authored-by: AudreynHeadburn <[email protected]> Co-authored-by: burmistrzak <[email protected]> Co-authored-by: michi2005 <[email protected]> Co-authored-by: brientim <[email protected]> Co-authored-by: 彭锡楷 <[email protected]> Co-authored-by: Preet Patel <[email protected]> Co-authored-by: Wombatzoner <[email protected]> Co-authored-by: Paul Blacknell <[email protected]> Co-authored-by: Dror Eiger <[email protected]> Co-authored-by: RothBoy <[email protected]>
1 parent 1ded4cb commit b24ac4b

File tree

2 files changed

+32
-22
lines changed

2 files changed

+32
-22
lines changed

src/devices/tuya.ts

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11941,28 +11941,36 @@ export const definitions: DefinitionWithExtend[] = [
1194111941
{vendor: "MatSee Plus", model: "PC321-Z-TY"},
1194211942
{vendor: "OWON", model: "PC321-Z-TY"},
1194311943
],
11944-
exposes: [
11945-
e.ac_frequency(),
11946-
e.temperature(),
11947-
e.current(),
11948-
e.power(),
11949-
e.energy(),
11950-
tuya.exposes.energyWithPhase("a"),
11951-
tuya.exposes.energyWithPhase("b"),
11952-
tuya.exposes.energyWithPhase("c"),
11953-
tuya.exposes.voltageWithPhase("a"),
11954-
tuya.exposes.voltageWithPhase("b"),
11955-
tuya.exposes.voltageWithPhase("c"),
11956-
tuya.exposes.powerWithPhase("a"),
11957-
tuya.exposes.powerWithPhase("b"),
11958-
tuya.exposes.powerWithPhase("c"),
11959-
tuya.exposes.currentWithPhase("a"),
11960-
tuya.exposes.currentWithPhase("b"),
11961-
tuya.exposes.currentWithPhase("c"),
11962-
tuya.exposes.powerFactorWithPhase("a"),
11963-
tuya.exposes.powerFactorWithPhase("b"),
11964-
tuya.exposes.powerFactorWithPhase("c"),
11965-
],
11944+
exposes: (device) => {
11945+
const baseExposes = [
11946+
e.ac_frequency(),
11947+
e.temperature(),
11948+
e.current(),
11949+
e.power(),
11950+
e.energy(),
11951+
tuya.exposes.energyWithPhase("a"),
11952+
tuya.exposes.energyWithPhase("b"),
11953+
tuya.exposes.energyWithPhase("c"),
11954+
tuya.exposes.voltageWithPhase("a"),
11955+
tuya.exposes.voltageWithPhase("b"),
11956+
tuya.exposes.voltageWithPhase("c"),
11957+
tuya.exposes.powerWithPhase("a"),
11958+
tuya.exposes.powerWithPhase("b"),
11959+
tuya.exposes.powerWithPhase("c"),
11960+
tuya.exposes.currentWithPhase("a"),
11961+
tuya.exposes.currentWithPhase("b"),
11962+
tuya.exposes.currentWithPhase("c"),
11963+
tuya.exposes.powerFactorWithPhase("a"),
11964+
tuya.exposes.powerFactorWithPhase("b"),
11965+
tuya.exposes.powerFactorWithPhase("c"),
11966+
];
11967+
11968+
if (device.applicationVersion >= 132) {
11969+
baseExposes.push(e.numeric("ac_frequency_high_precision", ea.STATE).withUnit("Hz").withValueMin(0).withValueMax(100));
11970+
}
11971+
11972+
return baseExposes;
11973+
},
1196611974
meta: {
1196711975
multiEndpointSkip: ["power_factor", "power_factor_phase_b", "power_factor_phase_c", "energy"],
1196811976
tuyaDatapoints: [
@@ -11981,6 +11989,7 @@ export const definitions: DefinitionWithExtend[] = [
1198111989
[7, null, tuya.valueConverter.phaseVariant2WithPhase("b")],
1198211990
[8, null, tuya.valueConverter.phaseVariant2WithPhase("c")],
1198311991
[134, "device_status", tuya.valueConverter.raw],
11992+
[135, "ac_frequency_high_precision", tuya.valueConverter.divideBy100],
1198411993
],
1198511994
},
1198611995
},

src/lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ export interface ModernExtend {
250250
export type DummyDevice = {
251251
manufacturerName?: string;
252252
isDummyDevice: true;
253+
applicationVersion?: number;
253254
};
254255

255256
export type DefinitionExposesFunction = (device: Zh.Device | DummyDevice, options: KeyValue) => Expose[];

0 commit comments

Comments
 (0)