Skip to content

Commit

Permalink
ShellyPro3EM63 addet (#1132)
Browse files Browse the repository at this point in the history
* Create shellypro3em63.js

* Update for Shelly Pro 3 EM63

* Update for Shelly Pro 3EM63 Temperaturesensor
  • Loading branch information
Joylancer authored Feb 27, 2025
1 parent 8f453db commit 4adfd5d
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/datapoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const shellypro2pm = require('./devices/gen2/shellypro2pm').shellypro2pm;
const shellypro3 = require('./devices/gen2/shellypro3').shellypro3;
const shellypro4pm = require('./devices/gen2/shellypro4pm').shellypro4pm;
const shellypro3em = require('./devices/gen2/shellypro3em').shellypro3em;
const shellypro3em63 = require('./devices/gen2/shellypro3em63').shellypro3em63;
const shellypro2cover = require('./devices/gen2/shellypro2cover').shellypro2cover;
const shellyprodm1pm = require('./devices/gen2/shellyprodm1pm').shellyprodm1pm;
const shellyprodm2pm = require('./devices/gen2/shellyprodm2pm').shellyprodm2pm;
Expand Down Expand Up @@ -125,6 +126,7 @@ const devices = {
shellypro3,
shellypro4pm,
shellypro3em,
shellypro3em63,
shellypro2cover,
shellyprodm1pm,
shellyprodm2pm,
Expand Down Expand Up @@ -200,6 +202,7 @@ const deviceTypes = {
shellypro3: ['shellypro3'],
shellypro4pm: ['shellypro4pm'],
shellypro3em: ['shellypro3em', 'shellypro3em400'],
shellypro3em63: ['shellypro3em63'],
shellypro2cover: ['shellypro2cover'],
shellyprodm1pm: ['shellyprodm1pm'],
shellyprodm2pm: ['shellyprodm2pm'],
Expand Down Expand Up @@ -274,6 +277,7 @@ const deviceGen = {
shellypro3: 2,
shellypro4pm: 2,
shellypro3em: 2,
shellypro3em63: 2,
shellypro2cover: 2,
shellyprodm1pm: 2,
shellyprodm2pm: 2,
Expand Down Expand Up @@ -349,6 +353,7 @@ const deviceKnowledgeBase = {
shellypro3: 'https://kb.shelly.cloud/knowledge-base/shelly-pro-3-v1',
shellypro4pm: 'https://kb.shelly.cloud/knowledge-base/4shelly-pro-4pm',
shellypro3em: 'https://kb.shelly.cloud/knowledge-base/shelly-pro-3em',
shellypro3em63: 'https://kb.shelly.cloud/knowledge-base/shelly-pro-3em-3ct63',
shellypro2cover: 'https://kb.shelly.cloud/knowledge-base/shelly-pro-dual-cover-pm',
shellyprodm1pm: 'https://kb.shelly.cloud/knowledge-base/shelly-pro-dimmer-1pm',
shellyprodm2pm: 'https://kb.shelly.cloud/knowledge-base/shelly-pro-dimmer-2pm',
Expand Down
91 changes: 91 additions & 0 deletions lib/devices/gen2-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3453,7 +3453,97 @@ function addRGBW(deviceObj, rgbwId) {
},
};
}
/**

Check warning on line 3456 in lib/devices/gen2-helper.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Missing JSDoc @param "deviceObj" declaration
* Adds a generic Temp-Sensor definition for Shelly Pro3EM63 devices
*
* The following states are added:
* - EM63 Temperature in °C and °F
*/
function addEMTemperatureSensor(deviceObj) {
deviceObj[`EMTemperature.tC`] = {
mqtt: {
http_publish: `/rpc/Temperature.GetStatus?id=0`,
http_publish_funct: value => (value ? parseInt(JSON.parse(value).tC) : undefined),
},
common: {
name: {
en: 'Temperature',
de: 'Temperatur',
ru: 'Температура',
pt: 'Temperatura',
nl: 'Temperatuur',
fr: 'Température',
it: 'Temperatura',
es: 'Temperatura',
pl: 'Temperatura',
'zh-cn': '模范',
},
type: 'number',
role: 'value.temperature',
read: true,
write: false,
unit: '°C',
},
};
deviceObj[`EMTemperature.tF`] = {
mqtt: {
http_publish: `/rpc/Temperature.GetStatus?id=0`,
http_publish_funct: value => (value ? parseInt(JSON.parse(value).tF) : undefined),
},
common: {
name: {
en: 'Temperature',
de: 'Temperatur',
ru: 'Температура',
pt: 'Temperatura',
nl: 'Temperatuur',
fr: 'Température',
it: 'Temperatura',
es: 'Temperatura',
pl: 'Temperatura',
'zh-cn': '模范',
},
type: 'number',
role: 'value.temperature',
read: true,
write: false,
unit: '°F',
},
};
deviceObj[`EMTemperature.ReportThreshold`] = {
mqtt: {
http_publish: `/rpc/Temperature.GetConfig?id=0`,
http_publish_funct: value => (value ? (JSON.parse(value).report_thr_C) : undefined),

Check failure on line 3516 in lib/devices/gen2-helper.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Replace `(JSON.parse(value).report_thr_C)` with `JSON.parse(value).report_thr_C`
},
common: {
name: {
en: 'Threshold',
},
type: 'number',
role: 'value.temperature',
read: true,
write: false,
unit: '°C',
},
};
deviceObj[`EMTemperature.Offset`] = {
mqtt: {
http_publish: `/rpc/Temperature.GetConfig?id=0`,
http_publish_funct: value => (value ? (JSON.parse(value).offset_C) : undefined),

Check failure on line 3532 in lib/devices/gen2-helper.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Replace `(JSON.parse(value).offset_C)` with `JSON.parse(value).offset_C`
},
common: {
name: {
en: 'Offset',
},
type: 'number',
role: 'value.temperature',
read: true,
write: false,
unit: '°C',
},

Check failure on line 3543 in lib/devices/gen2-helper.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Delete `⏎`

};
}
module.exports = {
addEM1,
addPM1,
Expand All @@ -3471,4 +3561,5 @@ module.exports = {
addProOutputAddon,
addRGB,
addRGBW,
addEMTemperatureSensor,
};
19 changes: 19 additions & 0 deletions lib/devices/gen2/shellypro3em63.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

const shellyHelperGen2 = require('../gen2-helper');

/**
* Shelly Pro 3 EM / shellypro3em63
*
* https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen2/ShellyPro3EM
*/
const shellypro3em63 = {};

shellyHelperGen2.addEnergyMeter(shellypro3em63, 0, ['a', 'b', 'c']);
shellyHelperGen2.addEnergyMeterData(shellypro3em63, 0, ['a', 'b', 'c']);
shellyHelperGen2.addEMTemperatureSensor(shellypro3em63);
shellyHelperGen2.addProOutputAddon(shellypro3em63);

module.exports = {
shellypro3em63,
};

0 comments on commit 4adfd5d

Please sign in to comment.