Ok
Mais en général l’addon Shelly te remontes tout ce que tu pourrais avoir besoin !
Mais si tu veux vraiment fouiller dans ton Shelly, ils ont implémenté (en interne) un système de script, devrait te faire passer pas mal de temps !
Voir
puis
Clique sur Library pour récupérer quelques exemple !
Exemple pour `consume-limited-power.js`
// Copyright 2021 Allterco Robotics EOOD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Shelly is a Trademark of Allterco Robotics
// Shelly Script example: Shelly Plus 1PM - Stop the output after consuming
// certain amount of power
//
// This script listens for the event when the output is turned on, and starts
// counting the power reported in NotifyStatus every minute It is accumulated in
// a counter and if the combined consumption is over a threshold the output is
// turned off
let startMonitor = false;
let eAccumulator = 0;
let maxEnergy = 120; //threshold, in milliwatthours
Shelly.addEventHandler(function (event, user_data) {
if (typeof event.info.output !== "undefined") {
if (event.info.output) {
startMonitor = true;
eAccumulator = 0;
} else {
startMonitor = false;
}
}
}, null);
Shelly.addStatusHandler(function (event, user_data) {
print(JSON.stringify(event));
if (typeof event.delta.aenergy !== "undefined") {
if (startMonitor) {
eAccumulator = eAccumulator + event.delta.aenergy.by_minute[0];
if (eAccumulator > maxEnergy) {
print("Will turn off because of power consumed");
Shelly.call(
"switch.set",
{ id: 0, on: false },
function (result, code, msg, ud) {},
null
);
}
}
}
}, null);
merci !!!
j’ai fini par me créer un virtuel alimenté par un scénario qui récupère les données avec (http://192.168.xxx.xxx/rpc/Switch.GetStatus?id=0) qui sera plus précis que le plugin Shelly qui ne remonte pas la température par exemple.
je me suis cassé le nez a essayer par le plugin script, j’ai donc fournis le json a chatgpt qui m’a sorti un code en 2 secondes
oups, je parle de Jeedom car sous HA tout remonte nickel. Pour le moment, je fais double boulot pour tester et me mettre en route
A titre indicatif, j’ai un Shelly 1PM qui est logé dans le boîtier de raccordement de mon boiler d’ECS électrique.
Il prend donc sa propre température + celle de la chauffe du boiler (il est au pied de la résistance chauffante).
La puissance du boiler est de 2 kW
Il est installé depuis presque 2 ans et la chauffe du boiler s’opère tous les jours (ou plutôt toutes les nuits).
La t° monte jusque 85°C en début de chauffe.
@+ Guy