Compare commits
22 Commits
f0d05130a7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| feef76b9b5 | |||
| 758bfff35c | |||
| a9443b2121 | |||
| ae5b887f33 | |||
| 93b6b08fda | |||
| b07bcb5f47 | |||
| b81f2345e2 | |||
| 099aa1b849 | |||
| 6f49ba2ae9 | |||
| 9608cf02be | |||
| 3f411c7113 | |||
| b71c02fcca | |||
| bd60a67402 | |||
| d5c6b4ae5b | |||
| 220fefc1ad | |||
| ebd6172329 | |||
| 4d2083c9a4 | |||
| 23bfca8efa | |||
| 3fab16a994 | |||
| 973a78d80e | |||
| e9f307af97 | |||
| c28cc4f08f |
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
secret.py
|
||||||
|
log.log
|
||||||
|
__pycache__
|
||||||
174
README.md
174
README.md
@ -1,7 +1,175 @@
|
|||||||
# TEMPO ESS : dynamic ESS for EDF TEMPO
|
# TEMPO ESS : dynamic ESS for EDF TEMPO
|
||||||
|
|
||||||
(French only)
|
This code is for French Users that have an installation
|
||||||
|
with Multiplus-II, ESS, Battery AND have access to EDF TEMPO
|
||||||
|
electricity contract.
|
||||||
|
|
||||||
|
Since this mostly for French users only the rest of the doc is only
|
||||||
|
in French
|
||||||
|
|
||||||
|
*French only*
|
||||||
|
|
||||||
|
Ce code permet de régler de façon semi dynamique votre installation
|
||||||
|
Victron Energy avec un (ou des) Multiplus-II, ESS et EDF TEMPO (ou
|
||||||
|
équivalent ex EDF ZenFlex, à voir si les jours ZenFlex correspondent
|
||||||
|
au jours rouges de TEMPO).
|
||||||
|
|
||||||
|
*ATTENTION*: Code en cours de developpement.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Vous avez besoin d'un installation qui fonctionne avec :
|
||||||
|
|
||||||
|
- Victron Energy Multiplus-II
|
||||||
|
- Batterie correctement configurée
|
||||||
|
- Des panneaux solaires (pas nécessaire mais ça aide a passer quand il y a du soleil)
|
||||||
|
- Un GX quelconque (soit intégré, soit Gerbo, soit home made)
|
||||||
|
- Une machine Linux/FreeBSD (l'installation sur le Venus OS sera a *vos propres risques*).
|
||||||
|
|
||||||
|
## Trucs en plus
|
||||||
|
|
||||||
|
- Un EcoDevice v1 (pas le RT2, pas conseillé)
|
||||||
|
|
||||||
|
Cet outil permet de trouver les informations de téléinformation de
|
||||||
|
façon indépendante de l'internet.
|
||||||
|
|
||||||
|
- Un compte prowl pour envoyer les notifications de changement de tarifs
|
||||||
|
|
||||||
|
A noter que le code se basant sur l'API EDF et/ou Enedis *n'est pas* fini.
|
||||||
|
|
||||||
|
## Fonctionnement / Idée
|
||||||
|
|
||||||
|
Dans tempo nous avons 3 type de jours où les Heure Pleines qui sont de 6h à 22h
|
||||||
|
sont variablement plus ou moins chères (a voir s'il existe des abo TEMPO où
|
||||||
|
les heures pleines sont en dehors de la plage horaire 6h -> 22h).
|
||||||
|
|
||||||
|
L'idée est d'utiliser le chargeur du Multiplus pour recharger la batterie et
|
||||||
|
utiliser l'ESS associé pour moins manger d'heures pleines dans les plages
|
||||||
|
BLANCHES et ROUGES.
|
||||||
|
|
||||||
|
### Jour BLEU
|
||||||
|
|
||||||
|
C'est le tarif moins cher donc on est en mode "openbar" :
|
||||||
|
|
||||||
|
- Recharge de la batterie si SOC < 80% en heure creuse (nécessite un schedule 1 dans le GX)
|
||||||
|
- Battery Life : On, car lorsque la batterie n'est pas rechargée souvent il y a une charge lente qui peux arriver
|
||||||
|
- Min Soc : 30% (configurable)
|
||||||
|
|
||||||
|
|
||||||
|
### Jour BLANC
|
||||||
|
|
||||||
|
Le tarifs est un peu plus cher en heures pleines donc on vas limiter la conso
|
||||||
|
le matin (machine a café, grille pain,...)
|
||||||
|
|
||||||
|
- Recharge de la batterie à 90% sur schedule 1
|
||||||
|
- Batterie Life : On
|
||||||
|
- Min Soc : 30%
|
||||||
|
|
||||||
|
Pareil que les jours blanc, j'ai dans la todo d'ajouter un plage horaire
|
||||||
|
où on peux fermer un relais, pour informer ma pompe à chaleur dois passer
|
||||||
|
sur le backup Gaz pour la préchauffe du circuit d'eau chauffage.
|
||||||
|
*Pour l'instant*: le code en question n'existe pas.
|
||||||
|
|
||||||
|
### Jour ROUGE
|
||||||
|
|
||||||
|
- Recharge de la batterie à 100% sur schedule 1
|
||||||
|
- Batterie Life : Off
|
||||||
|
- Min Soc : 25%
|
||||||
|
|
||||||
|
Dans ce avoir la batterie à 100% avec battery life off, permet de
|
||||||
|
rester sur batterie jusqu'au SoC Minimal. En pratique sans soleil
|
||||||
|
chez moi, je suis de 6h à 16h sans toucher un seul kWh HP rouge.
|
||||||
|
S'il y a du soleil, j'arrive largement à rester toute les HP sans consommer
|
||||||
|
du réseau.
|
||||||
|
|
||||||
|
Le Battery Life à Off évite aussi de "charger lentement la batterie" quand
|
||||||
|
on est à Battery Life à On.
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration du GX
|
||||||
|
|
||||||
|
Je ne vais pas expliquer comment configurer un Multiplus avec un GX en ESS mais les points
|
||||||
|
*IMPORTANT* a mettre en place.
|
||||||
|
|
||||||
|
### Activer le broker MQTT sur GX
|
||||||
|
|
||||||
|
Dans Settings -> Services, activez MQTT on LAN (SSL), _puis_ MQTT on LAN (Plaintext) :
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Pour l'instant le code ne prévois pas de se connecter en MQTT over SSL.
|
||||||
|
|
||||||
|
### Activer un schedule 1 sur le GX
|
||||||
|
|
||||||
|
Utilisé pour recharger les batteries en heures creuse, la valeur de recharge sera modifiée
|
||||||
|
selon les jours Bleu, Blanc et Rouge.
|
||||||
|
|
||||||
|
*Si vous ne voulez pas utiliser cette feature* il _suffit juste_ de laisser ce schedule a inactif.
|
||||||
|
|
||||||
|
Dans Settings -> ESS -> Scheduled charge levels -> Schedule 1 (capture prise en veille de jour Blanc) :
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Configuration du code
|
||||||
|
|
||||||
|
### Prerequis
|
||||||
|
|
||||||
|
Il vous faut trouver les points suivants :
|
||||||
|
|
||||||
|
- L'ip ou le nom de votre eco device
|
||||||
|
- L'ip ou le nom de votre GX
|
||||||
|
- Le numéro de série du GX
|
||||||
|
|
||||||
|
*NOTE IMPORTANTE*: le code API EDF n'est pas encore fonctionnel.
|
||||||
|
|
||||||
|
Sur les deux premier points, vous avez ces informations sur votre routeur, box, ou ailleurs.
|
||||||
|
Je ne détaillerais pas comment retrouver ces point.
|
||||||
|
|
||||||
|
Pour le numéro de série c'est assez facile a coup de MQTT Explorer, vous le trouverez dans l'arbre `N/`, le
|
||||||
|
première serie de numeros est le numéro de série de votre GX.
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
Copiez le fichier `secret.py.exemple` en `secret.py` et remplissez les variables présentes.
|
||||||
|
|
||||||
|
### Ajout des modules python nécessaires
|
||||||
|
|
||||||
|
Le code a besoin des modules python suivants :
|
||||||
|
|
||||||
|
- urllib3
|
||||||
|
- paho_mqtt
|
||||||
|
- pyprowl
|
||||||
|
|
||||||
|
Ces dependances peuvent être installées :
|
||||||
|
|
||||||
|
```
|
||||||
|
pip3 install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Cette partie est a voir avec votre distribution linux.
|
||||||
|
|
||||||
|
## Comment faire un test ?
|
||||||
|
|
||||||
|
C'est assez simple vu tout se configure via MQTT, au lieu de mettre votre GX dans la varible `gx`de `secret.py`
|
||||||
|
utilisez un mosquitto de test pour voir si les valeur sont celles attendus.
|
||||||
|
Une fois que vous êtes sûr alors vous pouvez mettre en crontab le fonctionnemnt de code.
|
||||||
|
|
||||||
|
Exemple :
|
||||||
|
```
|
||||||
|
#
|
||||||
|
# EDF TEMPO
|
||||||
|
#
|
||||||
|
# Lors de la recup jour demain
|
||||||
|
5 20 * 1-3,9-12 * test -x $HOME/git/tempo-ess/tempo-ess-dynamic.py && $HOME/git/tempo-ess/tempo-ess-dynamic.py
|
||||||
|
# Lors du passage HC
|
||||||
|
2 22 * 1-3,9-12 * test -x $HOME/git/tempo-ess/tempo-ess-dynamic.py && $HOME/git/tempo-ess/tempo-ess-dynamic.py
|
||||||
|
```
|
||||||
|
|
||||||
|
Donc le code est executé 2 fois:
|
||||||
|
- une fois a 20:05, pour récuperer la couleur du lendemain et la valeur du Schedule 1
|
||||||
|
- une fois a 22:02, pour éventuellement changer la valeur du Min Soc et si on active/desactive Battery Life
|
||||||
|
|
||||||
Ce dépôt permet de régler de façon dynamique des Victron Energy Multiplus-II en ESS pour permettre de faire des économies d'énergie dans le cadre d'un abonnement EDF TEMPO
|
|
||||||
|
|
||||||
*WARNING* : Work in progress
|
|
||||||
|
|||||||
BIN
img/gx-mqtt.png
Normal file
BIN
img/gx-mqtt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
img/schedule1-settings.png
Normal file
BIN
img/schedule1-settings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
BIN
img/schedule1.png
Normal file
BIN
img/schedule1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
3
requirements.txt
Normal file
3
requirements.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
paho_mqtt==1.6.1
|
||||||
|
urllib3==1.26.18
|
||||||
|
pyprowl>=3.0.0
|
||||||
32
secret.py.example
Executable file
32
secret.py.example
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
# Settings
|
||||||
|
|
||||||
|
# EcoDevice (not the RT one) can be ip address or FQDN
|
||||||
|
ecodevice = "192.0.2.1"
|
||||||
|
|
||||||
|
# Use EcoDevice or EDF "API"
|
||||||
|
# True : EcoDevice
|
||||||
|
# False: EDF "API"
|
||||||
|
# WARNING not completly tested
|
||||||
|
use_eco = True
|
||||||
|
|
||||||
|
# MQTT Broker (or GX with MQTT enabled)
|
||||||
|
gx = "192.0.2.2"
|
||||||
|
|
||||||
|
# Note Publish R/<sn>/keepalive -> montre l'arbre des bidules
|
||||||
|
|
||||||
|
# GX device to be found with N/<number>/system/0/Serial
|
||||||
|
gxsn = "123456789abc"
|
||||||
|
|
||||||
|
# Max Charge according to colors
|
||||||
|
chgbleu = 80 # Jours Bleus
|
||||||
|
chgblanc = 90 # Jours Blanc
|
||||||
|
chgrouge = 98 # Jours Rouge / On VenusOS < 3.10 set this to 95%
|
||||||
|
|
||||||
|
# Min Charge according to colors
|
||||||
|
minbleu = 30 # Jours Bleus
|
||||||
|
minblanc = 30 # Jours Blanc
|
||||||
|
minrouge = 25 # Jours Rouge
|
||||||
|
|
||||||
|
# Your PROWL API Key
|
||||||
|
# set it to 'NO' if you don't want PROWL support
|
||||||
|
prowkey = 'NO'
|
||||||
312
tempo-ess-dynamic.py
Executable file
312
tempo-ess-dynamic.py
Executable file
@ -0,0 +1,312 @@
|
|||||||
|
#!/usr/local/bin/python3
|
||||||
|
|
||||||
|
import urllib3
|
||||||
|
import json
|
||||||
|
import paho.mqtt.client as mqtt
|
||||||
|
import time
|
||||||
|
import pyprowl
|
||||||
|
#import syslog
|
||||||
|
|
||||||
|
from datetime import date,datetime
|
||||||
|
|
||||||
|
# Settings
|
||||||
|
from secret import ecodevice,use_eco,gx,gxsn,chgbleu,chgblanc,chgrouge,minbleu,minblanc,minrouge,prowlkey
|
||||||
|
|
||||||
|
|
||||||
|
# Lancer ceci du 01 Oct au 31 mai
|
||||||
|
# une fois avant 22h / une fois apres 22h
|
||||||
|
|
||||||
|
# Don't touch that
|
||||||
|
# See : https://github.com/victronenergy/venus/wiki/dbus#settings
|
||||||
|
ESSwBL = 1 # ESS "Optimized with BatteryLife)
|
||||||
|
ESSwoBL = 10 # ESS "Optimized without BatteryLife)
|
||||||
|
|
||||||
|
p = pyprowl.Prowl(prowlkey)
|
||||||
|
|
||||||
|
def sendprowl(foo):
|
||||||
|
p.notify(event='EDF TEMPO', description='Attention EDF Tarif: '+foo,
|
||||||
|
priority=0, appName='EDF TEMPO')
|
||||||
|
|
||||||
|
# Log !
|
||||||
|
def loggerinfo(foo):
|
||||||
|
#syslog.syslog(syslog.LOG_INFO,foo)
|
||||||
|
print(foo)
|
||||||
|
|
||||||
|
# Setup MQTT Client
|
||||||
|
global client
|
||||||
|
|
||||||
|
def on_connect(client, userdata, flags, rc):
|
||||||
|
client.subscribe("$SYS/#")
|
||||||
|
global flagConntected
|
||||||
|
flagConntected = 1
|
||||||
|
loggerinfo("Broker connected.")
|
||||||
|
|
||||||
|
def on_message(client, userdata, msg):
|
||||||
|
loggerinfo(msg.topic+" "+str(msg.payload))
|
||||||
|
|
||||||
|
def on_publish(client, userdata, mid):
|
||||||
|
loggerinfo("Message Published.")
|
||||||
|
|
||||||
|
def on_disconnect(client, userdata, rc):
|
||||||
|
global flagConntected
|
||||||
|
flagConntected = 0
|
||||||
|
loggerinfo("Broker disconnected.")
|
||||||
|
|
||||||
|
##client = mqtt.Client("clientdynTEMPO")
|
||||||
|
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1)
|
||||||
|
flagConntected = 0
|
||||||
|
client.on_connect = on_connect
|
||||||
|
client.on_message = on_message
|
||||||
|
client.on_publish = on_publish
|
||||||
|
client.on_disconnect = on_disconnect
|
||||||
|
#client.tls_set("venus-ca.crt")
|
||||||
|
#client.username_pw_set(username, password)
|
||||||
|
|
||||||
|
# Set the Maxmium SOC when schedule Charge
|
||||||
|
def setChargeSetpoint(chargepoint):
|
||||||
|
loggerinfo("Set charge setpoint: " + str(chargepoint) + " %")
|
||||||
|
if (chargepoint < 50) or (chargepoint > 100):
|
||||||
|
loggerinfo("Chargepoint should be between 50 to 100%")
|
||||||
|
else:
|
||||||
|
# Control ESS over MQTT
|
||||||
|
client.connect(gx, 1883, keepalive=60)
|
||||||
|
client.loop_start()
|
||||||
|
# Wait for connecting
|
||||||
|
while not flagConntected:
|
||||||
|
time.sleep(1)
|
||||||
|
client.publish("W/" + gxsn + "/settings/0/Settings/CGwacs/BatteryLife/Schedule/Charge/0/Soc", '{"value":' + str(chargepoint) + '}')
|
||||||
|
client.loop_stop()
|
||||||
|
|
||||||
|
# Set the Minimum Soc Limit
|
||||||
|
def setMinSocSetpoint(chargepoint):
|
||||||
|
loggerinfo("Set MinSoc setpoint: " + str(chargepoint) + " %")
|
||||||
|
if (chargepoint < 10) or (chargepoint > 40):
|
||||||
|
loggerinfo("Chargepoint should be between 50 to 100%")
|
||||||
|
else:
|
||||||
|
# Control ESS over MQTT
|
||||||
|
client.connect(gx, 1883, keepalive=60)
|
||||||
|
client.loop_start()
|
||||||
|
# Wait for connecting
|
||||||
|
while not flagConntected:
|
||||||
|
time.sleep(1)
|
||||||
|
client.publish("W/" + gxsn + "/settings/0/Settings/CGwacs/BatteryLife/MinimumSocLimit", '{"value":' + str(chargepoint) + '}')
|
||||||
|
client.loop_stop()
|
||||||
|
|
||||||
|
# Set ESS State (danger only 1 or 10 is ok)
|
||||||
|
# 1 = Optimized with Battery Life
|
||||||
|
# 10 = Optimized without battery life
|
||||||
|
# See https://github.com/victronenergy/venus/wiki/dbus#settings
|
||||||
|
def setESSstate(state):
|
||||||
|
loggerinfo("Set ESS State: " + str(state) )
|
||||||
|
# Security Checks
|
||||||
|
if (state == 1 or state == 10):
|
||||||
|
# Control ESS over MQTT
|
||||||
|
client.connect(gx, 1883, keepalive=60)
|
||||||
|
client.loop_start()
|
||||||
|
# Wait for connecting
|
||||||
|
while not flagConntected:
|
||||||
|
time.sleep(1)
|
||||||
|
client.publish("W/" + gxsn + "/settings/0/Settings/CGwacs/BatteryLife/State", '{"value":' + str(state) + '}')
|
||||||
|
lastChargeCondition = 1
|
||||||
|
client.loop_stop()
|
||||||
|
else:
|
||||||
|
loggerinfo(" -> not published")
|
||||||
|
|
||||||
|
# Setup Prowl
|
||||||
|
try:
|
||||||
|
p.verify_key()
|
||||||
|
except Exception as e:
|
||||||
|
print("Error verifying Prowl API key: {}".format(e))
|
||||||
|
exit()
|
||||||
|
|
||||||
|
|
||||||
|
http = urllib3.PoolManager()
|
||||||
|
if use_eco:
|
||||||
|
# Setup EcoDevice
|
||||||
|
resp = http.request("GET", "http://"+ecodevice+"/api/xdevices.json?cmd=10")
|
||||||
|
|
||||||
|
if resp.status == 200:
|
||||||
|
teleinfo = json.loads(resp.data)
|
||||||
|
|
||||||
|
# Value of var today daynight
|
||||||
|
# HPJB = Bleu 0 1
|
||||||
|
# HCJB = Bleu 0 0
|
||||||
|
# HPJW = Blanc 1 1
|
||||||
|
# HCJW = Blanc 1 0
|
||||||
|
# HPJR = Rouge 2 1
|
||||||
|
# HCJR = Rouge 2 0
|
||||||
|
curtarif = teleinfo['T1_PTEC']
|
||||||
|
if curtarif == "HPJB":
|
||||||
|
today = 0
|
||||||
|
daynight = 1
|
||||||
|
elif curtarif == "HCJB":
|
||||||
|
today = 0
|
||||||
|
daynight = 0
|
||||||
|
elif curtarif == "HPJW":
|
||||||
|
today = 1
|
||||||
|
daynight = 1
|
||||||
|
elif curtarif == "HCJW":
|
||||||
|
today = 1
|
||||||
|
daynight = 0
|
||||||
|
elif curtarif == "HPJR":
|
||||||
|
today = 2
|
||||||
|
daynight = 1
|
||||||
|
elif curtarif == "HCJR":
|
||||||
|
today = 2
|
||||||
|
daynight = 0
|
||||||
|
else:
|
||||||
|
today = 0
|
||||||
|
daynight = 0
|
||||||
|
|
||||||
|
|
||||||
|
# Value of var tomorrow
|
||||||
|
# ---- = Bleu 0
|
||||||
|
# BLEU = Bleu 0
|
||||||
|
# BLAN = Blanc 1
|
||||||
|
# ROUG = Rouge 2
|
||||||
|
demaintarif = teleinfo['T1_DEMAIN']
|
||||||
|
if demaintarif == "----":
|
||||||
|
tomorrow = 0
|
||||||
|
elif demaintarif == "BLEU":
|
||||||
|
tomorrow = 0
|
||||||
|
elif demaintarif == "BLAN":
|
||||||
|
tomorrow = 1
|
||||||
|
elif demaintarif == "ROUG":
|
||||||
|
tomorrow = 2
|
||||||
|
else:
|
||||||
|
tomorrow=0
|
||||||
|
|
||||||
|
loggerinfo("Current tarif: " + curtarif + " ("+str(today)+" / "+str(daynight) + ")")
|
||||||
|
loggerinfo("Demain tarif: " + demaintarif + " ("+str(tomorrow)+")")
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Use EDF "API"
|
||||||
|
today=date.today()
|
||||||
|
resp = http.request("GET", "https://particulier.edf.fr/services/rest/referentiel/searchTempoStore?dateRelevant="+str(today.strftime("%Y-%m-%d")))
|
||||||
|
if resp.status == 200:
|
||||||
|
edfapi = json.loads(resp.data)
|
||||||
|
curcouleur = edfapi['couleurJourJ']
|
||||||
|
demaincouleur = edfapi['couleurJourJ1']
|
||||||
|
|
||||||
|
if curcouleur == "TEMPO_BLEU":
|
||||||
|
today = 0
|
||||||
|
elif curcouleur == "TEMPO_BLANC":
|
||||||
|
today = 1
|
||||||
|
elif curcouleur == "TEMPO_ROUGE":
|
||||||
|
today = 2
|
||||||
|
else:
|
||||||
|
today = -1
|
||||||
|
|
||||||
|
if demaincouleur == "TEMPO_BLEU":
|
||||||
|
tomorrow = 0
|
||||||
|
elif demaincouleur == "TEMPO_BLANC":
|
||||||
|
tomorrow = 1
|
||||||
|
elif demaincouleur == "TEMPO_ROUGE":
|
||||||
|
tomorrow = 2
|
||||||
|
elif demaincouleur == "NON_DEFINI":
|
||||||
|
tomorrow = -1
|
||||||
|
else:
|
||||||
|
tomorrow = -1 # trop tot.
|
||||||
|
|
||||||
|
now = datetime.now()
|
||||||
|
#Heures creuses: 22h00 -> 06h00
|
||||||
|
loggerinfo("Current hour : "+str(now.hour))
|
||||||
|
|
||||||
|
if now.hour >= 6 and now.hour <=22:
|
||||||
|
loggerinfo("We are DAY")
|
||||||
|
daynight = 1
|
||||||
|
else:
|
||||||
|
loggerinfo("We are NIGHT")
|
||||||
|
daynight = 0
|
||||||
|
|
||||||
|
loggerinfo("La couleur aujourd'hui "+str(curcouleur))
|
||||||
|
loggerinfo("La couleur demain "+str(demaincouleur))
|
||||||
|
if tomorrow == -1:
|
||||||
|
loggerinfo("La couleur de demain n'est pas definie -> exit")
|
||||||
|
quit()
|
||||||
|
|
||||||
|
|
||||||
|
# daynight : 1 = jour / 0 nuit
|
||||||
|
# Today Tomorrow Daynight Action
|
||||||
|
# 0 0 O Rien
|
||||||
|
# 0 0 1 Rien
|
||||||
|
# 0 1 0 Rien
|
||||||
|
# 0 1 1 Charge 90%
|
||||||
|
# 0 2 0 SocMin 25% / Batterlife Off
|
||||||
|
# 0 2 1 Charge 95%
|
||||||
|
# 1 0 0 SocMin 30%
|
||||||
|
# 1 0 1 Charge 80%
|
||||||
|
# 1 1 0 Rien
|
||||||
|
# 1 1 1 Rien
|
||||||
|
# 1 2 0 SocMin 25% / Batterlife Off
|
||||||
|
# 1 2 1 Charge 95%
|
||||||
|
# 2 0 0 SocMin 30% / Batterlife On
|
||||||
|
# 2 0 1 Charge 80%
|
||||||
|
# 2 1 0 SocMin 30% / Batterlife On
|
||||||
|
# 2 1 1 Charge 90%
|
||||||
|
# 2 2 0 Rien
|
||||||
|
# 2 2 1 Rien
|
||||||
|
#today = 1
|
||||||
|
#tomorrow = 0
|
||||||
|
#daynight = 0
|
||||||
|
if today == tomorrow:
|
||||||
|
loggerinfo ("Rien a faire on sort")
|
||||||
|
elif today == 0: # Bleu
|
||||||
|
if tomorrow == 1: # Blanc
|
||||||
|
if daynight == 1:
|
||||||
|
sendprowl('BLANC')
|
||||||
|
loggerinfo ("Charge "+str(chgblanc)+"%")
|
||||||
|
setChargeSetpoint(chgblanc)
|
||||||
|
elif tomorrow == 2: # Rouge
|
||||||
|
if daynight == 1:
|
||||||
|
loggerinfo ("Charge "+str(chgrouge)+"%")
|
||||||
|
sendprowl('ROUGE')
|
||||||
|
setChargeSetpoint(chgrouge)
|
||||||
|
else:
|
||||||
|
loggerinfo ("SocMin "+str(minrouge)+"%")
|
||||||
|
setMinSocSetpoint(minrouge)
|
||||||
|
loggerinfo ("Battery life OFF")
|
||||||
|
setESSstate(ESSwoBL)
|
||||||
|
elif today == 1: # Blanc
|
||||||
|
if tomorrow == 0: # Bleu
|
||||||
|
if daynight == 1:
|
||||||
|
loggerinfo ("Charge "+str(chgbleu)+"%")
|
||||||
|
setChargeSetpoint(chgbleu)
|
||||||
|
sendprowl('BLEU')
|
||||||
|
else:
|
||||||
|
loggerinfo ("SocMin "+str(minbleu)+"%")
|
||||||
|
setMinSocSetpoint(minbleu)
|
||||||
|
elif tomorrow == 2: # Rouge
|
||||||
|
if daynight == 1:
|
||||||
|
sendprowl('ROUGE')
|
||||||
|
loggerinfo ("Charge "+str(chgrouge)+"%")
|
||||||
|
setChargeSetpoint(chgrouge)
|
||||||
|
else:
|
||||||
|
loggerinfo ("SocMin "+str(minrouge)+"%")
|
||||||
|
setMinSocSetpoint(minrouge)
|
||||||
|
loggerinfo ("Battery life OFF")
|
||||||
|
setESSstate(ESSwoBL)
|
||||||
|
elif today == 2: # Rouge
|
||||||
|
if tomorrow == 0: # Bleu
|
||||||
|
if daynight == 1:
|
||||||
|
loggerinfo ("Charge "+str(chgbleu)+"%")
|
||||||
|
setChargeSetpoint(chgbleu)
|
||||||
|
sendprowl('BLEU')
|
||||||
|
else:
|
||||||
|
loggerinfo ("SocMin "+str(minbleu)+"%")
|
||||||
|
setMinSocSetpoint(minbleu)
|
||||||
|
loggerinfo ("Battery life ON")
|
||||||
|
setESSstate(ESSwBL)
|
||||||
|
elif tomorrow == 1: # Blanc
|
||||||
|
if daynight == 1:
|
||||||
|
sendprowl('BLANC')
|
||||||
|
loggerinfo ("Charge "+str(chgblanc)+"%")
|
||||||
|
setChargeSetpoint(chgblanc)
|
||||||
|
else:
|
||||||
|
loggerinfo ("SocMin "+str(minblanc)+"%")
|
||||||
|
setMinSocSetpoint(minblanc)
|
||||||
|
loggerinfo ("Battery life ON")
|
||||||
|
setESSstate(ESSwBL)
|
||||||
|
|
||||||
|
# Voir code : https://github.com/xbeaudouin/dynamic-ess
|
||||||
|
# ET : https://github.com/victronenergy/venus/wiki/dbus#settings
|
||||||
Reference in New Issue
Block a user