- Categoria: Domotics
introduzione
I DomBus sono moduli progettati per impianti industriali e domotici disponibili con 2 diversi protocolli:
- Il protocollo DomBus , supportato dal controller domotico Domoticz , è un protocollo affidabile che consente di gestire dozzine di moduli e ottenere lo stato dai moduli non appena cambiano. Include anche i cosiddetti comandi DCMD che, analogamente al KNX, vengono trasmessi tra i moduli DomBus nello stesso bus per attivare le uscite in caso di eventi (interruttore o pulsante premuto, valore di temperatura, valore di potenza, ....) senza bisogno per l'intervento o la centralina domotica, soluzione utile per ottenere un impianto domotico che funzioni anche in caso di guasto alla centralina domotica . Il plug-in Creasol DomBus deve essere installato in Domoticz, utilizzando il Python Plugin Manager o scaricando il software da GitHub (vedere la sezione seguente).
- Il protocollo Modbus RTU , ampiamente utilizzato nei sistemi di automazione industriale e domotica, è supportato da quasi tutti i controller domotici come Home Assistant , OpenHAB , IObroker , Node-RED , ...
Modbus è un protocollo master-slave che permette di attivare e disattivare un singolo relè, tutti i relè o un gruppo di relè con un unico comando. Inoltre, è possibile specificare, per ogni relè, il tempo di ON da 31.5ms a 1500 giorni, in modo che il relè si spenga automaticamente dopo il tempo selezionato.
La versione Modbus RTU può essere utilizzata dal sistema Node-RED per realizzare flussi tra cui uscite relè, ingressi digitali e analogici, sensori di temperatura, umidità, energia, stazione di ricarica per veicoli elettrici e altro ancora.
Configurazione
Innanzitutto, la palette modbus dovrebbe essere abilitata: se non è già abilitata, digitare il comando
npm install node-red-contrib-modbus
quindi riavvia Node-RED.
Il flusso precedente mostra come utilizzare il modulo a 8 relè DomBus31 con Node-RED: trascinare Modbus-Write nel flusso e configurarlo come mostrato nell'immagine.
Per avere informazioni complete sui moduli DomBus, consultare https://www.creasol.it/domotics
Di seguito alcune informazioni sul modulo 8 relè DomBus31
Funzionalità Modbus RTU del modulo DomBus31
Le seguenti specifiche si riferiscono alla versione Modbus: DomBus31 è disponibile con 2 firmware, protocollo DomBus e protocollo Modbus, quindi in questo caso va scelto quest'ultimo firmware.
Indirizzo slave predefinito: 49 (0x31)
ind | Nome | Valori | Descrizione |
0 | RL1 | 0=OFF, 65280=ON, 1-65279=ON per il tempo specificato | Uscita relè SPST, contatto NO, capacità di uscita 5A 250Vac o 30Vdc. Il contatto del relè è protetto da varistore |
1 | RL2 | 0=OFF, 65280=ON, 1-65279=ON per il tempo specificato | Uscita relè SPST, contatto NO, capacità di uscita 5A 250Vac o 30Vdc. Il contatto del relè è protetto da varistore |
2 | RL3 | 0=OFF, 65280=ON, 1-65279=ON per il tempo specificato | Uscita relè SPST, contatto NO, capacità di uscita 5A 250Vac o 30Vdc. Il contatto del relè è protetto da varistore |
3 | RL4 | 0=OFF, 65280=ON, 1-65279=ON per il tempo specificato | Uscita relè SPST, contatto NO, capacità di uscita 5A 250Vac o 30Vdc. Il contatto del relè è protetto da varistore |
4 | RL5 | 0=OFF, 65280=ON, 1-65279=ON per il tempo specificato | Uscita relè SPST, contatto NO, capacità di uscita 5A 250Vac o 30Vdc. Il contatto del relè è protetto da varistore |
5 | RL6 | 0=OFF, 65280=ON, 1-65279=ON per il tempo specificato | Uscita relè SPST, contatto NO, capacità di uscita 5A 250Vac o 30Vdc. Il contatto del relè è protetto da varistore |
6 | RL7 | 0=OFF, 65280=ON, 1-65279=ON per il tempo specificato | Uscita relè SPDT, contatti NO + NC, capacità di uscita 10A 250Vac o 250Vdc. Il contatto del relè è protetto da varistore |
7 | RL8 | 0=OFF, 65280=ON, 1-65279=ON per il tempo specificato | Uscita relè SPDT, contatti NO + NC, capacità di uscita 10A 250Vac o 250Vdc. Il contatto del relè è protetto da varistore |
255 | Tutti i relè | 0=OFF, 65280=ON, 1-65279=ON per il tempo specificato | Questo indirizzo è utilizzato per accendere o spegnere tutti i relè con un unico breve comando |
8192 | Indirizzo secondario | 1-250 | Permette di modificare l'indirizzo slave del modulo, quindi è possibile aggiungere nuovi moduli DomBusXX allo stesso bus |
8193 | Bitrate seriale | 0=115200bps, 1=57600, 2=38400, 3=19200, 4=9600, 5=4800, 6=2400, 7=1200bps | Velocità seriale, predefinita 115200 bps 8,n,1 |
8194 | Parità seriale | 0=nessuno, 1=pari, 2=dispari | Parità seriale, impostazione predefinita nessuna (115200 bps 8,n,1) |
8198 | Revisione, maggiore | Sola lettura | Ottieni il numero di revisione. Ad esempio "02" significa che la revisione è "02XX" dove XX è definito dal parametro 8199 |
8199 | Revisione, minore | Sola lettura | Ottieni numero di revisione, numero minore. Ad esempio "h1" significa che la revisione è "XXh1" dove XX è definito dal parametro 8198 |
E' possibile attivare una o più uscite per un certo tempo (uscita monostabile/temporizzata) come indicato in tabella. Il parametro corrispondente al tempo necessario può essere calcolato utilizzando le seguenti regole:
Da 0 a 60s => risoluzione 31.25ms 1=31.25ms, 1920=60s => valore=tempo_in_millisecondi/32
Da 1m a 1h con risoluzione 1s 1921=61s, 3540+1920=5460=1h => valore=(time_in_seconds-60)+1920
Da 1h a 1d con risoluzione 1m 5461=1h+1m, 1380+5460=6840=24h => valore=(time_in_minutes-60)+5460
Da 1g a 1500 giorni con risoluzione 1h 6841=25h, 6842=26h, e così via => value=(time_in_hours-24)+6840
Le seguenti tabelle mostrano alcuni esempi di comandi Modbus.
Indirizzo slave | Funz. Codice | Reg.Ind | Reg.Val | Telaio | Descrizione |
49 | 06 | 8192 | 1 | [31][06][20][00][00][01][46][3A] | Modificare l'indirizzo dello slave da 49 (0x31) a 1 |
01 | 06 | 8193 | 4 | [01][06][20][01][00][04][D2][09] | Imposta la velocità seriale a 9600 bps |
01 | 06 | 8194 | 1 | [01][06][20][02][00][01][E2][0A] | Imposta la parità pari |
49 | 10 | 8192 | 1,4,1 | [31][10][20][00][00][03][06][00][01][00][04][00][01][B1][71] | Con un singolo comando, imposta l'indirizzo slave a 1, la velocità seriale a 9600 bps, parità pari. Si prega di notare che nessuna risposta verrà inviata a questo comando. |
01 | 06 | 0 | 65280 | [01][06][00][00][FF][00][C8][3A] | Attiva l'uscita RL1 per sempre (65280=0xff00) |
01 | 06 | 1 | 960 | [01][06][00][01][03][C0][D8][AA] | Attiva RL2 per 960/32=30s |
01 | 06 | 255 | 0 | [01][06][00][FF][00][00][B9][FA] | Disabilita tutte le uscite (Reg.Addr=255) |
01 | 10 | 0 | 32,0,0,65280 | [31][10][00][00][00][04][08][00][20][00][00][00][00][FF][00][E6][5C ] | Imposta RL1 On per 1s (32), RL2 Off, RL3 Off, RL4 On - Possono essere impostati max 10 registri in un comando |
01 | 03 | 255 | 1 | [01][03][00][FF][00][01][B4][3A] | Legge un valore a 16 bit con lo stato delle porte. Ad esempio, se il valore restituito è 0xd1 (0b11010001), lo stato dell'output è: RL8=On, RL7=On, RL6=Off, RL5=On, RL4=Off, RL3=Off, RL2=Off, RL1=On |
01 | 03 | 8198 | 2 | [01][03][20][06][00][02][2F][CA] | Leggi 4 byte all'interno della versione del modulo. Ad esempio, se il valore restituito è <30><32><68><31> (in formato esadecimale), il valore ASCII corrispondente è "02h1" (Firmware 02h1) |
01 | 0F | 0 | 8,1,0xd1 | [01][0F][00][00][00][08][01][D1][3E][C9] | Impostare lo stato della bobina a 0xd1 (0b11010001), attivando RL8, RL7, RL5, RL1 e disabilitando altri relè |
01 | 01 | 0 | 8 | [01][01][00][00][00][08][3D][CC] | Legge lo stato della bobina. Se il valore restituito è 0xd1 (0b11010001), significa che RL8, RL7, RL5 e RL1 sono On |
Altri moduli DomBus funzionanti con Node-RED
Produciamo diversi moduli con protocollo Modbus, lavorando con NodeRED:
- DomBusTH : piccola scheda inseribile in un coperchio cieco, con sensori di temperatura + umidità, led RGW, sensore touch (simulante un interruttore a pulsante), 6 I/O configurabili
- DomBus12 : piccolo modulo con 9 I/O configurabili (ingressi analogici/digitali, contatori, sonde di temperatura NTC, uscite open-drain da collegare al modulo relè esterno DomRelay2 , uscite tapparelle, cicalino, lampeggiatore, ....)
- DomBus23 : modulo con 2 relè, uscita mosfet (dimmer led), ingresso 230V AC, 2 ingressi optoisolati, 2 I/O, 2 uscite analogiche 0-10V, ...
- DomBus31 : Modulo 8 relè
- DomBus32 : 3 relè + 3 ingressi 230Vac + 5 moduli I/O
- DomBus33 : Modulo 3 luci (utilizzabile per domotizzare un impianto luci esistente tramite relè passo-passo)
- DomBus36 : Modulo 12 relè
- DomBus37 : Modulo 12 I/O + 3 ingressi AC + 3 uscite relè predisposto per impianti antintrusione
- DomBusEVSE : modulo EVSE che può essere utilizzato per costruire una smart wallbox per la ricarica di veicoli elettrici
Modulo acquistabile su https://store.creasol.it/domotics
- Categoria: Domotics
introduzione
L'obiettivo è costruire da soli un sistema di allarme completo che sia affidabile, scalabile, economico e ricco di funzionalità .
Utilizzando i seguenti script è possibile integrare tutte le funzioni del sistema di allarme in un controller Domoticz in esecuzione in un RaspberryPI (computer a scheda singola con consumo energetico di 2,3 W), RockPIS (piccolo computer a scheda singola con consumo energetico di soli 400 mW) o un altro tipo di hardware.
Gestisce 3 diverse tipologie di allarme:
- Lontano, quando non c'è nessuno in casa
- Di notte, quando tutti sono a casa a dormire
- Giorno in cui qualcuno è in casa e desidera rilevare eventuali tentativi di intrusione
Inoltre, in caso di attivazione del sensore , il sistema può registrare piccoli video, ricodificarli con velocità 2x e inviarli a un gruppo/canale Telegram , così è possibile verificare cosa succede sullo smartphone. Ciò è utile soprattutto con i sensori esterni.
Perchè Domoticz? Perché Domoticz è gratuito, veloce e molto molto affidabile : è scritto in C++ (non Python, Java o altri linguaggi interpretati) e può essere aggiornato senza problemi. Supporta inoltre lo scripting LUA che consente di scrivere automazioni facili da gestire in un linguaggio chiaro e semplice che può essere compreso da chiunque. L'interfaccia utente di Domoticz sembra vecchia, non bella, ma è davvero forte e questa è la cosa più importante per salvare il matrimonio quando la casa è altamente domotica ;-)
Il sistema di allarme è composto da un file di configurazione e da alcuni script LUA e Bash: uno è chiamato all'attivazione delle scene AlarmAway, AlarmNight, AlarmDay, e l'altro è chiamato a registrare video dalle IPcam in caso di attivazione dei sensori esterni. Basta modificare il file di configurazione per impostare quali sensori e sirene gestire.
Utilizzando i moduli DomBus per interfacciare i sensori di allarme è possibile ottenere una rete cablata domotica affidabile , con cavo bus che collega tutti i sensori che trasportano sia i dati che l'alimentazione a 12V: utilizzando una batteria di backup al piombo da 12V, il sistema funzionerà anche in caso di interruzione di corrente . In ogni caso, gli script di allarme descritti di seguito funzionano con qualsiasi tipo di sensore. Ultimo, ma non meno importante, i moduli DomBus consentono di ottenere un consumo energetico molto basso : ogni modulo DomBus consuma tipicamente circa 10 mW per gestire molti ingressi e uscite , molto inferiore ai moduli WiFi che consumano 400 mW o più. Di seguito uno screenshot che mostra alcuni dei nostri prodotti con i prezzi.
Naturalmente, è possibile utilizzare per il sistema di allarme tutti i dispositivi supportati, come Shelly, Sonoff, Denkovi, KMTronic, RaspberryPI GPIO, ...
L'allarme può essere abilitato/disabilitato attraverso 3 scene/gruppo, come mostrato in figura, oppure tramite pulsanti, lettori di impronte digitali, tastiere, tag RFID o NFC, ... Ad esempio è molto utile avere pulsanti accanto al letto per attivare/disattivare disattivare l'allarme NOTTURNO (guarda l'immagine qui sotto, usando DomBusTH per farlo).
Controlla la sezione qui sotto per sapere come aggiungere icone sul tuo smartphone per attivare/disattivare la sveglia ! Tocca un'icona per attivare l'allarme AWAY, tocca un'altra icona per disabilitare l'allarme.
Tutte le notifiche saranno disponibili in Telegram , così come brevi video che vengono registrati e inviati a Telegram quando viene attivato un sensore esterno: per rendere più semplice controllare cosa succede quando un sensore si attiva , vengono registrati 24 secondi di video con velocità 2x, quindi è possibile verificarlo in soli 12 secondi .
Caratteristiche
- Tre tipologie di allarme: giorno (emette solo un breve impulso sulla sirena interna, se qualcuno apre una porta o una finestra o una tapparella), notte (attiva solo le sirene interne e alcune luci), assenza (attiva le sirene interne ed esterne).
- notifiche complete tramite l'app Telegram
- gestisce fino a 128 sensori a contatto magnetico (ma è facilmente espandibile ad un numero superiore), 32 sensori di movimento (PIR), 32 tamper, 32 sirene
- allarme attivabile/disattivabile da pulsanti, smartphone o altri dispositivi (lettori di impronte digitali, tastiere, ...)
- lo script è in grado di inviare un breve video IP-Cam (24 secondi) quando sono stati attivati PIR/Radar/sensori esterni , mostrando il video in Telegram per far sapere al proprietario cosa succede esternamente. Ciò è utile per monitorare se qualcuno (o magari un gatto!) sta camminando per l'edificio mentre l'allarme è attivato. Per ottenere un controllo video veloce, i video vengono registrati con velocità 2x!
- Inoltre, uno o più display collegati alla IP-Cam o all'NVR possono accendersi quando è stato attivato un sensore esterno, mostrando le IP-CAM esterne
Installazione
Per ottenere un sistema di allarme affidabile, credo che non possiamo usare Microsoft Windows. Le istruzioni di installazione riguardano solo il sistema operativo Linux (Raspbian, Debian, Ubuntu o simili). E' possibile ottenere una microSD già programmata con Linux+Domoticz+Firewall+sistema di backup+script di automazione da store.creasol.it , dove sono disponibili anche alcuni kit domotici che includono il controller, l'alimentatore,...
Dalla shell di Linux, digitare i seguenti comandi (copia e incolla):
sudo su - #get root access
apt update; apt install lua-dkjson git #install lua dkjson library and git
cd ~pi/domoticz/scripts/lua
git clone https://github.com/CreasolTech/domoticz_lua_scripts #get all scripts from CreasolTech into domoticz_lua_scripts dir
cd domoticz_lua_scripts
#add some files, if they not exists
cp -n alarmSet.sh alarm_sendsnapshot.sh config_alarm.lua globalfunctions.lua globalvariables.lua alarm.lua script_device_master.lua ..
cd ..
Configurazione
Innanzitutto, tutti i dispositivi dovrebbero essere denominati utilizzando i seguenti prefissi:
- MCS_ per sensori a contatto magnetico, ad esempio MCS_Door_Garage, MCS_Window_Kitchen, ...
- PIR_ per PIR, ad esempio PIR_Garage, PIR_Kitchen, ...
- TAMPER_ per manomissioni, ad esempio TAMPER_Blinds_GroundFloor, ...
- SIREN_ per le sirene, ad esempio SIREN_Esterno, SIREN_Interno
- ALARM_ per i pulsanti utilizzati per attivare/disattivare l'allarme, ad esempio ALARM_Pulsante_Camera da letto, ...
Configura il file scripts/lua/globalvariables.lua scrivendo il tuo chatid di telegramma, chiave api, ....
Configura il file scripts/lua/config_alarm.lua scrivendo la lista dei sensori e le tue preferenze
Configurare il file scripts/lua/alarmSet.sh scrivendo nel SIREN_IDX l'elenco, separato da uno spazio, di tutti gli idx dei dispositivi che si attivano in caso di allarme (sirena esterna, sirena interna, luci, cicalini, ...): in questo caso, se si verifica un allarme, è possibile premere il pulsante Off sulla scena/gruppo AlarmXXXX per attivare lo script AlarmSet.sh che disabiliterà tutte le sirene/cicalini/luci che sono stati attivati dallo script script_device_alarm.lua .
Hardware
Domoticz supporta diversi protocolli e tipi di hardware.
Poiché produciamo moduli domotici per sistemi domotici, consigliamo di utilizzare i nostri moduli DomBus che sono molto affidabili, funzionano in caso di interruzione di corrente (basta utilizzare una batteria al piombo da 12V per alimentare il bus), bassissima latenza e bassissima latenza. bassi consumi : ad esempio in una casa il consumo energetico è di soli 1,02W per 23 moduli DomBus che gestiscono 113 ingressi, 67 uscite, 19 sensori e 1 EV di ricarica .
DomBus37 è un modulo progettato specificamente per il sistema di allarme, con 11 ingressi ( sensori di contatto magnetico per porte/finestre/tapparelle, PIR, manomissione , ...), capacità di fornire e monitorare il consumo energetico di una sirena esterna , 3 uscite relè e 3 uscite AC ingressi (per monitorare interruzioni di corrente su pompa di calore, frigoriferi, tutta la casa, ... ).
DomBusTH ad esempio è un modulo economico e compatto , senza custodia, che può essere posizionato su coperchi ciechi con un foro da 3-4mm al centro, ed è ideale per essere posizionato in qualsiasi stanza per monitorare temperatura+umidità , ha colore rosso/verde /LED bianchi utilizzabili come luce di stato e di emergenza , 4 I/O collegabili a sensori a contatto magnetico, PIR, pulsanti, cicalini, contatori, ... 2 uscite open-drain collegabili a relè esterni , e un sensore tattile per utilizzare il dispositivo come un interruttore a pulsante multifunzione .
DomBus12 è un altro modulo economico e compatto, con 7 ingressi, che possono essere utilizzati per collegare sensori di allarme , e 2 uscite open-drain , che possono essere collegate a relè esterni .
DomBus31 è un modulo domotico con 8 relè, ottimizzato per un consumo energetico molto basso : meno di 10 mW in stand-by (tutti i relè spenti), e MENO DI 500 mW con tutti gli 8 relè accesi : imbattibile!
A titolo di confronto, solitamente i moduli domotici consumano almeno 400 mW per un singolo relè!
DomBus23 è un sofisticato modulo con diverse tipologie di ingressi e uscite.
I moduli DomBus non sono dispositivi wireless: comunicano tramite il potente standard RS485 a 115200bps, quindi possono essere collegati tra loro utilizzando qualsiasi tipo di topologia di bus utilizzando un sottile cavo schermato a 4 fili: 2 fili per l'alimentazione a 12V e 2 fili per lo scambio dati. Nessun inquinamento RF, nessuna batteria, nessuna latenza!
Utilizzando un alimentatore a 12V che gestisce una batteria tampone al piombo da 12V è possibile realizzare una rete domotica che funziona anche in caso di blackout.
Quando un modulo DomBus è connesso alla rete, Domoticz riconosce automaticamente e mostra tutte le porte (plug&play) : ciascuna porta può essere configurata tramite l'interfaccia web Domoticz. Inoltre, per far funzionare il sistema domotico anche nel caso in cui il controller (Domoticz) non sia attivo , è possibile programmare ciascuna porta per controllare le porte sullo stesso o su altri dispositivi , come la rete KNX: ad esempio, se un pulsante viene premuto per meno per più di 0,5 s, accende per 123 secondi l'uscita 2 del modulo X e l'uscita 1 del modulo Y, mentre se viene premuto per 1 secondo, attiva/disattiva l'uscita 3 del modulo Z. Oppure, se la temperatura < 21 gradi, accende il riscaldatore , mentre se temperatura > 21,4 gradi spegnerlo. Maggiori informazioni nella pagina del dispositivo, sezione DCMD.
Nonostante siano made in Italy, sono anche economici! Di seguito un vecchio screenshot del nostro store:
Aggiungi icone allo smartphone per abilitare e disabilitare il sistema di allarme
È molto utile avere nello smartphone un'icona per abilitare l'allarme di assenza quando si esce di casa, ed una per disattivare il sistema di allarme prima di entrare in casa.
Domoticz supporta molti comandi HTTP per attivare scene, gruppi, interruttori, ... e gli smartphone hanno molte applicazioni che possono essere utilizzate per chiamare tali URL.
- Installa sul tuo smartphone l'app HTTP Shortcuts
- Crea una nuova scorciatoia regolare, specificando un nome (nell'esempio Sveglia Assenza )
- Specificare l'URL per chiamare il gruppo/scena Alarm Away (è necessario modificare quel gruppo/scena per ottenere il suo idx, 13 nell'esempio) scrivendo i parametri corretti (IP, PORTA, idx)
- Abilita l'autenticazione di base, specificando nome utente e password domoticz
- Scegli un'icona
- Salva e aggiungi l'icona alla schermata iniziale del tuo smartphone.
- Duplica questa icona, modifica quella nuova, cambia il nome in Sveglia disattivata , cambia icona, cambia URL sostituendo Attiva con Disattiva , salva e aggiungi l'icona alla schermata principale.
Ora hai due icone sullo smartphone, una per attivare il sistema di allarme e una per disattivarlo.
- Categoria: Domotics
DomBus modules are connected together by a serial bus, using a thin/common alarm cable with 4 wires: 2 to carry the 12-24V power supply and 2 wires for data at 115200bps 8,n,1.
Normally, the bus is connected to the domotic controller by a cheap RS485/USB adapter.
In case that the bus cannot be physically connected to the domotic controller (different area, no cable, ...), it's possible to use a TCP tunnel to keep into communication the domotic controller (with a virtual serial device) with the DomBus network.
To achieve the virtual serial tunnel over TCP/IP it's possible to use the following solutions.
Virtual serial over TCP/IP between two linux devices
If domotic controller is hosted in a linux device (for example a Raspberry PI or NUC, now called "main") and the DomBus devices are connected to another linux device (Raspberry, Rock PI S, QNAP, ..., now called "slave"), it's possible to have the main controller connecting the DomBus network by a TCP/IP connection, wired or wireless, in this way:
- On the slave device (where the DomBus network is connected using the cheap USB/RS485 adapter), install the ser2net service:
sudo apt install ser2net - Configure the ser2net service by modifying the file /etc/ser2net.yaml :
sudo nano /etc/ser2net.yaml - Remove existing connections that are not used, and insert the following lines to define the connection with one bus:
connection: &dombus
accepter: tcp,2000
enable: on
options:
kickolduser: true
telnet-brk-on-sync: true
connector: serialdev,
/dev/ttyUSB0,
115200n81,local
- It's possible to modify the tcp port (2000, in the example) and serial port (ttyUSB0 in the example).
- In case that more than one DomBus bus are connected to the slave device, define a connection for each bus (specifying a different TCP port for each bus).
- Restart the ser2net service using the command service ser2net restart
- Test that it works by using the command telnet localhost 2000 on the slave device; ctrl+] to exit
- On the main device (with Domoticz, Home Assistant, Node-RED, OpenHAB controller...) install the socat application:
sudo apt install socat - Exec the following command to create the virtual serial port /dev/ttyUSBDomBusNet to manage the DomBus devices attached to the slave device: socat pty,link=/dev/ttyUSBDomUSBBusNet tcp:192.168.6.2:2000 where 192.168.6.2 should be replaced with the IP number of the slave device
- In case that connection is done through internet or one or more routers with NAT, maybe it's needed to configure port forwarding / destination NAT on the routers
- Test the whole system by executing the command cat /dev/ttyUSBDomBusNet : if it works, write a small bash script to activate the virtual serial port, and call that script from /etc/rc.local assuring that there is the "&" character at the end, to execute the script in background:
#!/bin/bash
# New file /usr/local/sbin/dombusnet.sh , permissions 0700
# Thanks to Patrick Schaerer for testing and suggestions
TTYDEV=/dev/ttyUSBDomBusNet
TCPSERVER=192.168.6.2
TCPPORT=2000
while true; do
socat pty,link=${TTYDEV},waitslave tcp:${TCPSERVER}:${TCPPORT}
sleep 5
done
# End of file
# File /etc/rc.local
# ........
/usr/local/sbin/dombusnet.sh &
exit 0
This is a the cheaper solution to control DomBus modules by a wired or wireless connection in case that DomBus modules are located in a area where a linux device is already active
Connecting DomBus modules by using a RS485 to Ethernet or WiFi converters
Using an ethernet <--> RS485 converter like MOXA NPORT or other devices it's really simple to connect RS485 devices (DomBus modules, or other Modbus RTU modules) that are placed in a different area from the controller.
In this case a driver should be installed to create a virtual COM port (virtual serial port) to access the remote RS485 bus.
Below a list of RS485 to ethernet converters:
- Waveshare RS485 to WiFi / Ethernet : not tested, but the manufacturing company says it works using socat program (Linux)
- Waveshare RS485 TO ETH (available also with PoE support) : not tested, but the manufacturing company says it works using socat program (Linux)
- PUSR W610 RS485/RS232 to WiFi/Ethernet : not tested, but the manufacturing company says it works using socat program (Linux) or Windows software provided by the manufacturer. TCP port is configurable on the module (Local/Remote port number)
- Protoss PW11 or PW21 RS485 to WiFi/Ethernet : not tested, but it should work
If you know other devices that can be used for this purpose at reasonable prices, please let us know.
Using ESP32 + ESPHome to connect Modbus modules like DomBus
Slawomir describes in the github page https://github.com/SCiunczyk/wallbox-diy how to use ESP32 + ESPHome firmware to create a gateway between Modbus devices and Home Assistant, using WiFi. This is only a part of the described project, that permits to charge an electric vehicle by using single-phase (low power, from 1kW to 7kW, generally used in Solar mode) and three-phase power (used to charge the vehicle at full speed, from 4kW to 22kW) by using the Creasol DomBusEVSE module.
Thanks to Slawomir for sharing info about his very smart wallbox!
- Categoria: Domotics
Introduction
Creasol DomBus devices are home automation modules that manage inputs, outputs and sensors, available with two protocols:
DomBus proprietary protocol (works with Domoticz controllers) and Modbus RTU standard protocol that works with Home Assistant, Node-RED and other controllers.
Actually we produce the following modules:
- DomBusTH: Temperature + Relative Humidity sensors, red + green + white LEDs, 4 GPIO, 2 open-drain outputs, 1 analog input
- DomBus12: 7 GPIO, 2 open-drain outputs (configurable also as inputs)
- DomBus23: 2 relay outputs, 1 mosfet output (for 12-24V LED dimming or other DC loads), 2 analog outputs 0-10V, 2 GPIO, 2 low voltage opto-inputs (5-40V), 1 230Vac opto input
- DomBus31: low power module with 6 N.O. relay outputs + 2 N.O./N.C. relay outputs
- DomBus32: 3x relays, 3x 230Vac inputs, 5 IOs
- DomBus33: 3x relays, 3x 230Vac inputs, 5 IOs with special firmware to control 3 lights activated by existing step-by-step relays
- DomBus36: 12x relays
- DomBus37: 12x inputs, 3x 230Vac inputs, 3x relay outputs
- DomBusEVSE: EVSE module usable to build a smart wallbox (electric vehicle charging station)
- ...
Modules are available at https://store.creasol.it and explained in details at https://www.creasol.it/domotics
Using DomBus modules it's possible to make a full domotic system: the following picture describe a real example of a house using Domoticz + DomBus modules to control:
- full alarm system, with PIR and magnetic contact sensors on windows/doors/blinds
- climate control (heating and cooling by heat pump) with optimizations to use the most energy from renewable (photovoltaic system on the roof)
- ventilation control, disabling air renewal, in winter, when the wind blows from certain directions (to prevent combustion fumes from entering the house)
- lights on/off control
- 230V sockets that can be enabled/disabled by smartphone
- garden irrigation and rainwater tank level measure/control
- door bell control: when someone ring the bell, send a picture to the smartphone by Telegram. Obviously, it's also possible to open the gate or pedestrian gate by smartphone
- when presence/movement is detected outside, with the alarm enabled, grab a short 20s video from IPcam near the outdoor sensor and send video to Telegram.
DomBusTH is a really powerful and cheap board, to be mount on a blank cover with a 4mm hole in the center, with a touch sensor (to have a virtual pushbutton) that measures emperature and humidity, and have 3 LEDs: red and green LEDs are used to notify alarm, ventilation or electricity power import/export status, and white led is used as night light and emergency light (in case of blackout). Also, it can be connected to piezo buzzer for sound alerts, pushbutton switches, and external relay module DomRelay2 to control 230V sockets or roller shutter motor.
Also, GPIO/input of DomBus modules can be connected to energy meter with pulsed output, to measure the current imported/exported power. As written above, it's possible to show the actual imported/exported power on RED/GREEN Leds of a DomBusTH module.
Other modules are available at https://store.creasol.it/domotics and fully described at https://www.creasol.it/domotics
Installation
Using the Home Assistant Modbus integration it's possible to use our modules provided with Modbus RTU firmware: Modbus protocol is standard and well supported by Home Assistant as like as other systems (Node-RED, OpenHAB, ...).
Configuration examples are available on GitHub page.
Using DomBusEVSE module with Home Assistant
DomBusEVSE is a smart module that permits to get a home-made EV charging station Mode-3 for vehicles.
The Modbus version of DomBusEVSE can be used with the HomeAssistant hub using the native Modbus integration.
More information are available in the product page, where it's possible to know how to get it working with HA, and in the specific page for HomeAssistant.
DomBus36, a 12 relays module with Home Assistant
DomBus36 is a simple module with 12 relay outputs, grouped in 3 groups to have an easier wiring: each group share the same common, so you don't need to make jumpers to connect the common wire (Line, Neutral, Ground or +12/24V) to all relays.
Relays are protected from overvoltage and overcurrent, and module has a very low power consumption: less than 15mW with all relays OFF, and less than 750mW when all 12 relays are ON. Please compare with the power consumption of a Shelly, Sonoff, Denkovi or KMTronic module!

DomBus37, a versatile module with 12 low voltage inputs, 3 AC inputs and 3 relay outputs
DomBus37 is a versatile module integrating inputs, AC inputs (to sense 230V presence) and relay outputs.
In the application note below the simplest configuration with Home Assistant.
Using DomBus12 to measure water tank level, temperatures, start irrigation and light, check alarm sensors
DomBus12 is a compact and cost effective module with 9 I/Os. Each I/O can be configured as button, switch, double-pushbutton (UP/DOWN pushbutton connected to a single port), counter, meter, NTC temperature sensor, distance sensor, buzzer, led, ...
- Categoria: Domotics
Using Domoticz it's possible to supply a router through the normally-closed relay output (SPDT relay); so, normally power supply is applied to the router, but if internet connection goes down, after some seconds or minutes Domoticz remove the power supply, wait for 10s, and apply power supply again to restart the router.
This monitoring procedure is performed by a bash script that sends pings to two different hosts, and if they do not respond, after some seconds or minutes, sends a command to Domoticz to activate the relay output that remove power supply to the router.
First, check that 127.0.0.1 (and your network, if you prefer) are specified in the Domoticz panel Setup -> Settings -> Local Networks: in this way any connection to domoticz from the specified networks do not need authentication (no username and password is required). If you add your LAN, all devices from your LAN can enter domoticz without asking for username and password.
To install the bash script, copy and paste the following code into the raspberry/linux shell:
[code]#become root
sudo su
#download script
if [ `which wget` ]; then
wget -O /usr/local/sbin/netwatchdog.sh http://docs.creasol.it/netwatchdog.sh
elif [ `which curl` ]; then
curl -o /usr/local/sbin/netwatchdog.sh http://docs.creasol.it/netwatchdog.sh
else
#wget and curl not installed: install now
apt install wget curl
wget -O /usr/local/sbin/netwatchdog.sh http://docs.creasol.it/netwatchdog.sh
fi
chmod 755 /usr/local/sbin/netwatchdog.sh
# prepare /etc/rc.local so it is sufficient to remove a # to let raspberry start the script at boot time
sed -i 's:^exit 0:#/usr/local/sbin/netwatchdog.sh >/dev/null 2>/dev/null \&\nexit 0:' /etc/rc.local
sed -i 's/amp;//' /etc/rc.local[/code]
Now, find the idx corresponding to the relay output: open the web browser to the Domoticz page, go to Setup -> Devices to list all installed devices. Look in the idx column to find the idx of the router power supply device.
Now, copy&paste the following commands in the raspberry shell to put the script in debug mode (variable DEBUG=1 : in this way the script will print several debugging messages on the console and reduce the timings to check the script easily), edit the script (you have to write the right idx in the variable ROUTER_RELAY_IDX, check other variables, and type ctrl+x to exit):
[code]#set DEBUG=1 in /usr/local/sbin/netwatchdog.sh
sed -i 's/^DEBUG=0\(.*\)/DEBUG=1\1/' /usr/local/sbin/netwatchdog.sh
#edit script
nano /usr/local/sbin/netwatchdog.sh[/code]
and finally start the script in debug mode (reset the router after only 20s of ping failures), writing some information in the console and other information in the logfile:
[code]/usr/local/sbin/netwatchdog.sh[/code]
Remove the internet cable or switch-off the router: you should see that ping returns 100% packet loss and after 20s the script send a command to Domoticz to reset the router. Type ctrl+c to terminate the script.
If it works, type the following commands to edit /usr/local/sbin/netwatchdog.sh setting DEBUG=0 and to modify /etc/rc.local so the script is executed at boot time:
[code]#set DEBUG=0 in /usr/local/sbin/netwatchdog.sh
sed -i 's/^DEBUG=1\(.*\)/DEBUG=0\1/' /usr/local/sbin/netwatchdog.sh
#and now let linux starting the script
sed -i 's:^#/usr/local/sbin/netwatchdog.sh:/usr/local/sbin/netwatchdog.sh:' /etc/rc.local[/code]
Now you have to reboot to let linux start the netwatchdog.sh script.
Good luck.
Need help? join the DomBus channel on Telegram!
- Categoria: Domotics
The following script check temperature for one or more zones, to find out if windows or doors are open: in that case send notification by Telegram
Useful to avoid energy consumption during winter or summer, when someone forget windows/doors open.
The up-to-date version of this file is avaible at http://docs.crasol.it/script_time_openwindows.lua
[code]-- Script that checks temperature and try to discover if doors/windows are open: in that case sends notification by Telegram.
-- Useful to limit energy consumption in winter and summer, if someone forgets windows or doors open.
--
-- This script should be named DOMOTICZ_HOME/scripts/lua/script_time_SCRIPTNAME.lua , e.g. /home/pi/domoticz/scripts/lua/script_time_openwindows.lua
-- It will be called every minute and will check and compare, for each zone (defined below), the current temperature with previous temperature.
--
-- The following user variables must be set:
-- telegramChatid : the Telegram chat ID where notifications should be sent : see https://www.domoticz.com/wiki/Telegram_Bot
-- telegramToken : the Telegram token : see https://www.domoticz.com/wiki/Telegram_Bot
-- HeatingOn: a variables that assumes the following values
-- 0 => Heating/Cooling system is OFF
-- 1 => Heating is ON
-- 2 => Cooling is ON
--
-- Creasol - https://www.creasol.it/products
debug=1 -- if True, print debug information
domoticzUrl='http://192.168.3.230:8080'
-- zones: array that associate for each zone the name of the temperature device, and max difference for temperature
-- This script automatically create a variable zTemp_ZONENAME that contains the temperature measured before
zones={ --zonename {tempsensor,difference}
['Cucina']={'Temp_Cucina',0.6},
['Bagno']={'Temp_Bagno',0.6},
['Camera']={'Temp_Camera',0.6},
['Camera_Valentina']={'Temp_Camera_Valentina',0.6},
['Camera_Ospiti']={'Temp_Camera_Ospiti',0.6},
['Stireria']={'Temp_Camera',0.6}, --TODO: replace Temp_Camera with Temp_Stireria
}
commandArray={} -- reset commandArray, an associative array that will contain the list of commands for Domoticz.
function telegramNotify(msg)
os.execute('curl --data chat_id='..uservariables['telegramChatid']..' --data-urlencode "text='..msg..'" "https://api.telegram.org/bot'..uservariables['telegramToken']..'/sendMessage" ')
end
function min2hours(mins)
-- convert minutes in hh:mm format
return string.format('%02d:%02d',mins/60,mins%60)
end
function timedifference (s)
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
t1 = os.time()
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = os.difftime (t1, t2)
return difference
end
function checkVar(varname,vartype,value)
-- check if create, if not exist, a variable with defined type and value
-- type=
-- 0=Integer
-- 1=Float
-- 2=String
-- 3=Date in format DD/MM/YYYY
-- 4=Time in format HH:MM
local url
if (uservariables[varname] == nil) then
telegramNotify('Created variable ' .. varname..' = ' .. value)
url=domoticzUrl..'/json.htm?type=command¶m=saveuservariable&vname=' .. varname .. '&vtype=' .. vartype .. '&vvalue=' .. value
-- openurl works, but can open only 1 url per time. If I have 10 variables to initialize, it takes 10 minutes to do that!
-- commandArray['OpenURL']=url
os.execute('curl "'..url..'"')
uservariables[varname] = value;
end
end
if (debug) then print('------------------------- openwindows --------------------------------') end
timenow = os.date("*t")
minutesnow = timenow.min + timenow.hour * 60
checkVar('HeatingOn',0,0) -- 0=heating off, 1=heating on, 2=cooling on
for n,v in pairs(zones) do -- check that temperature setpoint exist
-- n=zone name, v=array with temperature sensor name and max acceptable temperature drop in degrees
checkVar('zTemp_'..n,1,otherdevices[v[1]]) -- if zTemp_Cucina does not exist, create variable and store current temperature
if (otherdevices[v[1]]==nil) then
telegramNotify('Zone '..n..': temperature sensor '..v[1]..' does not exist')
end
end
if (uservariables['HeatingOn']==1) then
-- Heating enabled
-- compare zTemp_ZONE (old temperature) with current temperature
for n,v in pairs(zones) do
-- n=zonename (HeatingSP_n = setpoint temperature)
-- v[1]=tempsensor
-- v[2]=max difference
diffTemp=tonumber(otherdevices[v[1]])-uservariables['zTemp_'..n]
if (diffTemp>=0) then
-- current temperature > old temperature: update old temperature
commandArray['Variable:zTemp_'..n]=otherdevices[v[1]]
else
-- current temperature < old temperature
-- compute gradient (diffTemp/TIME)
gradient=diffTemp*60/timedifference(uservariables_lastupdate['zTemp_'..n]) -- degrees/minute
--if (diffTemp<=-0.2) then
if (debug) then print('Zone='..n..' gradient='..string.format('%0.3f',gradient)..' Temp='..otherdevices[v[1]]..'C diffTemp='..diffTemp) end
if (math.abs(gradient)<(0.2/30)) then -- temperature falls slowly, less than 0.2C on 30 minutes
-- |gradient|=v[2]) then
telegramNotify('Zone '..n..': window open!! Gradient='..string.format('%0.2f',gradient*60)..'K/hour');
commandArray['Variable:zTemp_'..n]=otherdevices[v[1]] -- update zTemp_ZONE temperature
end
end
--end
end
end
elseif (uservariables['HeatingOn']==2) then
-- HeatingOn=2 => Cooling
-- TODO
else
-- HeatingOn=0 => Heating or Cooling = OFF => don't check windows
end
if (debug) then
for i, v in pairs(commandArray) do
print('### ++++++> Device Changes in commandArray: '..i..':'..v)
end
end
::mainEnd::
return commandArray[/code]
- Categoria: Domotics
Introduction
This LUA script can be used to add the following functions to Domoticz:
- power outage detect and emergency lights => turns on Leds (connected to devices supplied by 12V + backup battery) in case of blackout (power failure)
- shows import and export electricity power, through red/green leds on Creasol DomBusTH (this small module has the ability to show 1 or more flashes on the red and green LEDs available in the module itself); red LED flashes 1 time if import power <1kW, 2 times if <2kW, ... green led flashes 1 time if export power <1kW, 2 times if power < 2kW, 3 times if power <3kW, ....)
- in case of high power usage, the script sets heat pump to work at lower level to reduce power consumption, or disconnect loads to prevent power cut. In case there are not any load that can be automatically disconnected, send alert through leds/buzzer/siren, and send alert by Telegram
- automatically enable loads in case of extra power from renewable sources, to increase the own-consuming: for example activate an electric heater if temperature is below a TempSet and available power (from photovoltaic?) is greater than the heater power
Block diagram
Although it seems a bit complicted, this diagram can be divided in the following parts:
- connection to the energy meter (with pulsed output, 1 pulse every Wh, 1000 pulses per kWh)
- power outage detection (in this schema, it's connected to the heat pump power line, because if the power to the heat pump is missing during the winter, it can be a real problem!)
- LEDs to be activated in case of power cut (emergency lights)
- red and green LEDs that show import or export power (1 flash=0-1kW, 2 flashes=1-2kW, 3 flashes=2-3kW, ...): this feature is available on Creasol DomBusTH module
- temperature and humdity monitoring
- relay outputs to activate electric appliances in case of extra-power production (from photovoltaic or other renewable energy source)
- heat pump controlling (to modulate its power consumption)
- buzzer in case that power usage is above certain thresholds, so the electricity meter can lead to a power disconnection
Connecting the energy meter
In the block diagram above the Eastron SDM230 power meter is used, but any power meter with pulse outputs for import/export energy can be used for this purpose.
SDM230 has 2 optoisolated pulse outputs, one that emits 1 pulse every 1Wh imported energy, and another one that emits 1 pulse every 1Wh exported energy.
The result that we want to achieve is to have two devices, in Domoticz, showing the imported and exported power.
Using a DomBus module to interface pulse outputs energy meter
In case of using a DomBus RS485 module to interface the energy meter, this is following procedure to configure two DomBus input ports as counters:
- connect the pulse outputs to any available I/O, for example IO8 and IO9 for DomBus12, IO1 and IO2 for DomBusTH or DomBus23. The SDM230 common terminal block should be connected to GND (0V).
- configure Pulse1 output, on SDM230, as EXP kWh (check the manual to know how to do that); Pulse2 is pre-configured as IMP kWh (measure the energy imported from grid)
- configure the Domoticz device connected to Pulse2: press Edit on that device, and replace in the Description field IN_DIGITAL or IN_TWINBUTTON (the default value) with IN_COUNTER,TYPENAME=kWh and save. DomBus12Please note that kWh is CASE SENSITIVE! Now the device will be automatically moved to the Utility panel and configured as energy meter. Edit it again, write a name (for example PowerMeter_Import), and select Usage type.
- if produced energy sDomBus12hould be measured, configure the Domoticz device connected to Pulse1 as before: press Edit on that device, and replace in the Description field IN_DIGITAL or IN_TWINBUTTON with IN_COUNTER,TYPENAME=kWh and save. Now the device will be automatically moved to the Utility panel and configured as energy meter. Edit it again, write a name (for example PowerMeter_Export), and select Return type.
- In case of both import and export devices are created, it's needed to specify on Import device the Unit number of the Export device, and vice versa. So, select Setup -> Devices and write down the Unit number corresponding to Import (for example 98), and Export device (for example 99), then go to Utility panel, edit Import device and add to the description ,OPPOSITE=99 (Unit of the Export device) and save; edit Export device and add to the description ,OPPOSITE=98 (Unit of the Import device) and save. In this way, when a pulse is received on Import device, the power on Export device will be immediately set to 0, and vice versa, when a pulse is received on Export device, the power on Import device will be set to 0.
Domoticz needs up to 5 minutes before updating the energy counter correctly.
Power outage detection and emergency lights
Use any device you prefer to detect if electricity from grid is available or not. In the diagram above, the voltage from a circuit breaker (heat pump circuit breaker, in the example) is sensed by a optoisolated input.
If a wired-bus is used to connect domotic modules, and this is supplied by a backup-battery power supply (13.6V power supply + lead acid battery, or a UPS), it's possible to connect LEDs to the domotic modules and turn on LEDs in case of power outage (as emergency lights). The same can be done on battery-powered devices that have enough energy capacity.
Show current imported / exported power on red / green leds
Maybe the following function is available only on DomBusTH module, that has a special feature so LEDs can be configured in Domoticz as Selector Switch where 0 means OFF, 10=1 pulse, 20=2 pulses, 30=3 pulses, 40=4 pulses, and so on. Check the video that shows DomBusTH module programmed to show the ventilation status on white led and current exported power on green led (and imported power on red led, of course)!
In this case it's possible to get red LED flashes a number of times corresponding to the current imported power, and similarly green LED flashing a number of times corresponding to the exported power. This can be useful in the kitchen to check the available power from renewable sources, or verify that we're not consuming more power than what is permitted by the electricity meter, without the need to mount large display or tablet to show the current power.
DomBusTH also integrates a white light (usable as emergency light), temperature and relative humidity sensors, 4 I/O (that can be connected to pushbutton switches, buzzer, ...) and 2 open-drain outputs (that can be connected to external relays).
Activating loads and appliances automatically
Using any relay module it's possible to activate some appliances when there is excess energy from renewable sources: in this case it's possible to improve the own-consumption and reduce the needed of energy from the grid.
The script is able automatically enable and disable heaters, heated towel rails, dehumidifiers, ....
Limiting electricity power from grid to avoid power cut
The script has 2 thresholds above which the electric power must be reduced within a certain time. In Italy, the electricity grid permits to get
- nominal power + 10% forever
- nominal power + 27% for max 90 minutes
- more than nominal power till 14 kW for max 2 minutes
Power thresholds and max durations can be defined in the configuration file for the script, so when the imported power is above those thresholds the script try to limit the imported power by regulating, for example, the heat pump and/or swithing off some loads.
If there is nothing else to switch off and imported power level is above one of these thresholds, script is able to activate buzzers, leds, sirens or other systems to notify the building people that they have to reduce power consumption. Also, it can send a notification by Telegram.
Installation
The following list of commands can be just copied and pasted in linux shell to download and install the scripts. For those who use Windows operating system, installation is quite simple: just download and copy 4 files in the domoticz/scripts/lua directory, and edit those files to match the own configuration. Files are available in https://github.com/CreasolTech/domoticz_lua_scripts
#from linux shell, type the following commands (copy and paste): lines starting with # are comments, and can be ignored
#become root
sudo su -
#enter domoticz directory /scripts/lua
cd ~pi/Domoticz/scripts/lua
if [ -d domoticz_lua_scripts ]; then
cd domoticz_lua_scripts
#update domoticz_lua_script local repository
git pull
cd ..
else
which git
if [ $? -ne 0 ]; then
#install git
apt install git
fi
#download domoticz_lua_scripts repository with all scripts
git clone https://github.com/CreasolTech/domoticz_lua_scripts.git
fi
cp -i domoticz_lua_scripts/script_device_power.lua domoticz_lua_scripts/config_power.lua .
if [ ! -r globalvariables.lua ]; then cp domoticz_lua_scripts/globalvariables.lua . ; fi
if [ ! -r globalfunctions.lua ]; then cp domoticz_lua_scripts/globalfunctions.lua . ; fi
#now edit config file
nano config_power.lua
Measuring instant power with Eastron SDM230 connected by ModBus
Used to check power from energy meter (SDM120, SDM230, ...) and performs the following actions
1. Send notification when consumed power is above a threshold (to avoid power outage)
2. Enabe/Disable electric heaters or other appliances, to reduced power consumption from the electric grid
3. Emergency lights: turn ON some LED devices in case of power outage, and turn off when power is restored
4. Show on DomBusTH LEDs red and green the produced/consumed power: red LED flashes 1..N times if power consumption is greater than 1..N kW;
green LED flashes 1..M times if photovoltaic produces up to 1..M kW
Installation
The script is available on github, click here to see the project on GitHub, or click here to get the script
File: scripts/lua/script_device_power.lua
Destination directory: DOMOTICZ_DIR/scripts/lua
To install the script, type the following commands from the Linux shell, ignoring the comments (starting with #). If you don't know how to do, search the web how to connect to your Linux device using putty or another ssh client.
#become root
sudo su -
#install/upgrade curl, a command to fetch files from the web
apt install curl
# go to domoticz directory
cd /home/pi/domoticz
# fetch the script
curl -o scripts/lua/script_device_power.lua https://raw.githubusercontent.com/CreasolTech/domoticz_lua_scripts/master/script_device_power.lua
# now, edit the script modifying the first part with your configuration
nano scripts/lua/script_device_power.lua
- Categoria: Domotics
The following script, written in LUA programming language for Domoticz, was designed to manage 1 or more pushbutton switches in this way.
If the button is pressed for a short time, less than 1 second, toggle output ON/OFF
If the button is pressed for a longer time, switch output OFF
The script should be placed into the folder domoticz/scripts/lua ; filename is important, and must be script_device_DESCRIPTION.lua , for example script_device_pushbuttons.lua
Pushbutton devices must be On/Off or Pushbutton* type, or any other type that return status "On" and "Off" (e.g. type Contact returns value "Open" and "Close").
[code]-- LUA script for Domoticz, used to manage one or more pushbutton switches
-- Written by Creasol, https://creasol.it
--
-- Domoticz passes information to scripts through a number of global tables
--
-- devicechanged contains state and svalues for the device that changed.
-- devicechanged['yourdevicename'] = state
-- devicechanged['svalues'] = svalues string
--
-- otherdevices, otherdevices_lastupdate and otherdevices_svalues are arrays for all devices:
-- otherdevices['yourotherdevicename'] = "On"
-- otherdevices_lastupdate['yourotherdevicename'] = "2015-12-27 14:26:40"
-- otherdevices_svalues['yourotherthermometer'] = string of svalues
--
-- uservariables and uservariables_lastupdate are arrays for all user variables:
-- uservariables['yourvariablename'] = 'Test Value'
-- uservariables_lastupdate['yourvariablename'] = '2015-12-27 11:19:22'
--
-- other useful details are contained in the timeofday table
-- timeofday['Nighttime'] = true or false
-- timeofday['SunriseInMinutes'] = number
-- timeofday['Daytime'] = true or false
-- timeofday['SunsetInMinutes'] = number
-- globalvariables['Security'] = 'Disarmed', 'Armed Home' or 'Armed Away'
--
-- To see examples of commands see: http://www.domoticz.com/wiki/LUA_commands#General
-- To get a list of available values see: http://www.domoticz.com/wiki/LUA_commands#Function_to_dump_all_variables_supplied_to_the_script
--
-- Based on your logic, fill the commandArray with device commands. Device name is case sensitive.
--
debug=1 -- 0 => do not write debug information on log. 1 => write some information to the Domoticz log
commandArray = {}
timeNow=os.time() -- current time in seconds
function timeElapsed(devName)
-- compute number of seconds since last update, for the specified variable name
s=otherdevices_lastupdate[devName]
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
return os.difftime(timeNow, os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds})
end
-- loop through all the changed devices
for devName,devValue in pairs(devicechanged) do
if (devName=='PUSHBUTTON_light_external') then
-- Example: press and release pushbutton in less than 1 second => toggle lights ON/OFF
-- press and release pushbutton for more than 1 second => switch lights OFF
if (debug > 0) then print('EVENT: devname="'..devName..'" and value='..devValue) end
-- 1 short pulse => toggles lights ON/OFF
-- 1 long pulse => lights OFF
if (devValue=='Off') then
-- pushbutton released
-- compute pulse length
pulseLen=timeElapsed(devName)
if (debug>0) then print("EVENT: pushbutton released, pulseLen="..tostring(pulseLen).."s") end
if (pulseLen<=1 and otherdevices['LightOut2']=='Off') then
-- short pulse, and commanded device is OFF => ON
commandArray['LightOut2']='On'
commandArray['LightOut3']='On'
else
-- long pulse, or commanded device was ON
commandArray['LightOut2']='Off'
commandArray['LightOut3']='Off'
end
end
end
end
return commandArray
[/code]
Another LUA script to manage pushbuttons
The following script is very similar to the previous one, but manages more pulse lengths:
in this example,
if pushbutton pulse is 1s or less => turns light1 ON,
if pushbutton pulse 2s => turns light2 ON,
if pushbutton pulse 4s => turns light3 ON
Each output must be configured to be automatically disabled after a certain number of seconds, else the script have to be modified to also turn off the outputs.
[code]-- LUA script for Domoticz, used to manage one or more pushbutton switches
-- Written by Creasol, https://creasol.it
--
-- Domoticz passes information to scripts through a number of global tables
--
-- devicechanged contains state and svalues for the device that changed.
-- devicechanged['yourdevicename'] = state
-- devicechanged['svalues'] = svalues string
--
-- otherdevices, otherdevices_lastupdate and otherdevices_svalues are arrays for all devices:
-- otherdevices['yourotherdevicename'] = "On"
-- otherdevices_lastupdate['yourotherdevicename'] = "2015-12-27 14:26:40"
-- otherdevices_svalues['yourotherthermometer'] = string of svalues
--
-- uservariables and uservariables_lastupdate are arrays for all user variables:
-- uservariables['yourvariablename'] = 'Test Value'
-- uservariables_lastupdate['yourvariablename'] = '2015-12-27 11:19:22'
--
-- other useful details are contained in the timeofday table
-- timeofday['Nighttime'] = true or false
-- timeofday['SunriseInMinutes'] = number
-- timeofday['Daytime'] = true or false
-- timeofday['SunsetInMinutes'] = number
-- globalvariables['Security'] = 'Disarmed', 'Armed Home' or 'Armed Away'
--
-- To see examples of commands see: http://www.domoticz.com/wiki/LUA_commands#General
-- To get a list of available values see: http://www.domoticz.com/wiki/LUA_commands#Function_to_dump_all_variables_supplied_to_the_script
--
-- Based on your logic, fill the commandArray with device commands. Device name is case sensitive.
--
debug=1 -- 0 => do not write debug information on log. 1 => write some information to the Domoticz log
commandArray = {}
timeNow=os.time() -- current time in seconds
function timeElapsed(devName)
-- compute number of seconds since last update, for the specified variable name
s=otherdevices_lastupdate[devName]
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
return os.difftime(timeNow, os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds})
end
-- loop through all the changed devices
for devName,devValue in pairs(devicechanged) do
if (devName=='PUSHBUTTON_light_external') then
-- Example: press and release pushbutton in less than 1 second => toggle lights ON/OFF
-- press and release pushbutton for more than 1 second => switch lights OFF
if (debug > 0) then print('EVENT: devname="'..devName..'" and value='..devValue) end
-- 1 short pulse => toggles lights ON/OFF
-- 1 long pulse => lights OFF
if (devValue=='Off') then
-- pushbutton released
-- compute pulse length
pulseLen=timeElapsed(devName)
if (debug>0) then print("EVENT: pushbutton released, pulseLen="..tostring(pulseLen).."s") end
if (pulseLen<=1) then
-- short pulse
commandArray['LightOut1']='On'
elseif (pulseLen>=2 and pulseLen<=3) then
-- medium pulse, 2s
commandArray['LightOut2']='On'
elseif (pulseLen>=4 and pulseLen<=6) then
-- long pulse, 4s
commandArray['LightOut3']='On'
end
end
end
end
return commandArray[/code]
Need help? join the DomBus channel on Telegram!
- Categoria: Domotics
Extracting a field from a multi-value sensor
Some devices in Domoticz contains mmm
ltiple values, separated by semicolon ';' :
- kWh meters contain both power and energy, for example "950;11658" where 950 is the power
- Temperature/Humidity sensors, for
ultiple values, separated by semicolon ';' :
- kWh meters contain both power and energy, for example "950;11658" where 950 is the power
- Temperature/Humidity sensors, for example "21.3;57" where temperature is 21.3°C and humidity 57%
- Wind sensor, for example "135;ESE;3;9;12.4;12.4" where 3=wind speed*10 and 9 is gust*10 (windspeed=0.3m/s and gust=0.9m/s)
To extract a field from the device string, using a lua script, it's possible to use the following code:
devValue=otherdevices['WindSensor']
--devValue='109;ESE;8;15;123' The 3rd field, "8", contains the wind speed * 10
i=0
for str in devValue:gmatch("[^;]+") do
i=i+1
if (i==3) then -- extract the third field
windSpeed=tonumber(str)/10
break
end
end
print("windSpeed="..windSpeed)
if (windSpeed>5) then
-- close the solar curtain, blinds, ...
-- ToDo...
-- if (otherdevices['devicePosition']=='Open') then
-- commandArray['deviceMotor']='Close for 50 seconds'
-- end
end
ESPEasy sensors stopped working with Domoticz
Since 2023, Domoticz configuration denies by default access to the JSON API using plain http (not encrypted) protocol.
To enable http, select Setup -> Settings -> Security -> API Protection: Allow (enabled)
Add icons to smartphone to enable and disable alarm system
It's very useful to have in the smartphone an icon to enable away alarm when leaving the house, and one to deactivate the alarm system before entering the house.
Domoticz supports many HTTP commands to activate scenes, groups, switches, ... and smartphones have many applications that can be used to call such URLs.
- Install on your smartphone the HTTP Shortcuts app
- Create a new regular shortcut, specifying a name (in the example Alarm Away)
- Specify the URL to call the Alarm Away group/scene (you have to edit that group/scene to get its idx, 13 in the example) writing the right parameters (IP, PORT, idx)
- Enable base autentication, specifying the domoticz username and password
- Choose an icon
- Save, and add the icon to your smartphone home screen.
- Duplicate this icon, edit the new one, change name to Alarm Off, change icon, change URL replacing On with Off , save and add icon to the home screen.
Now you have two icons on the smartphone, one to activate alarm system and one to disable it.
How to change Domoticz graph sampling time
Domoticz, by default, show 3 graphs: a daily graph with 1 sample every 5 minutes, a monthly graph and a yearly graph.
In some cases, 5 minutes is a very huge time if sensors data varies quickly: in these cases it's possible to reduce sampling interval for example to 1 minute (databases with sensors data will be much greater). In other cases, sensors data is very slow, so it's possible to set a longer sampling interval to save size and extend flash memory life.
To set a different sampling interval, it's possible to do as shown in the post https://www.domoticz.com/forum/viewtopic.php?f=47&t=10183&start=20#p129866
Edit the file DOMOTICZ_DIR/www/views/setup.html
Search for "shortlogtable" and add the following before the </table>-tag:
[code]<tr>
<td align="right" style="width:60px"><label><span data-i18n="Interval"></span>: </label></td>
<td><select id="comboshortloginterval" name="ShortLogInterval" style="width:60px" class="combobox ui-corner-all">
<option value="1">1</option>
<option value="5">5</option>
<option value="10">10</option>
<option value="15">15</option>
</select> Minutes
</tr>[/code]
Save it, delete your browser-cache and refresh your browser. I had problems with chrome keeping the old setup page even after deleting the cache, but using incognito mode worked to display the new page.
Finally, enter domoticz -> Setup -> Settings -> Log History and set the History value to 1 minute or longer sampling time.
- Categoria: Domotics
Per ottenere la versione aggiornata di questa pagina, consultare la versione inglese.
Introduzione
I sistemi domotici hanno due obiettivi principali:
- rendere l'edificio intelligente , aggiungendo nuove funzionalità e automazioni
- risparmiare il consumo di energia
ma per sfruttare al meglio queste tecnologie, deve essere FACILE !
Domoticz è un software open source gratuito che funziona come controller di un sistema domotico ed è piuttosto facile da implementare anche da persone con competenze di programmazione minime.
È scritto in C++, richiede pochissime risorse, è multipiattaforma e gestisce una grande quantità di hardware domotico (sensori, attuatori, I/O, ...).
Sebbene si adatti meglio a una piattaforma Linux (ad esempio il controller a scheda singola Raspberry PI, con un consumo energetico inferiore a 3 W, dotato del sistema operativo Linux Raspbian, oppure il Rock Pi S che consuma meno di 0,5 W), funziona anche su Windows e MacOSX.
Professionisti
- Ottimizzato per funzionare con computer con risorse ridotte : 0,5 GB di RAM e una CPU dual-core da 1 GHz sono sufficienti per quasi tutti i sistemi di automazione domestica!
- Utilizza meno di 50 MB di disco, esclusi i backup.
- Scritto in un linguaggio di programmazione di basso livello, C++ : è veloce e leggero .
- Supporta diversi linguaggi di programmazione (python, perl, php, lua) per plugin (utilizzati per implementare nuovo hardware e protocolli) e script (utilizzati per creare automazioni e gestire i dispositivi installati).
- Quasi tutte le configurazioni vengono eseguite tramite WebUI : non c'è bisogno di modificare i file!
- La WebUI può essere personalizzata ed è anche possibile utilizzare Dashticz per implementare una WebUI diversa (controllare l'immagine )
- Molto stabile, aggiornamenti facili e senza preoccupazioni .
- WebUI può essere utilizzato da qualsiasi browser web che supporti HTML5, è responsive quindi funziona bene con PC, tablet e smartphone. Inoltre, alcune APP per Android e iOS sono disponibili, ma non necessarie.
- L'interfaccia utente Web integra anche le planimetrie e le planimetrie delle stanze per mostrare un layout con tutti i sensori/attuatori al suo interno.
Contro
- Mancanza di supporto per alcuni tipi di hardware
- WebUI può sembrare "vecchio stile" e non è così bello come altri sistemi di automazione domestica
Domotica o Assistente Domestico?
Ci sono molti sistemi di automazione domestica gratuiti sul mercato, ad esempio OpenHAB, ioBroker, NodeRED, ... Il sistema più utilizzato è sicuramente Home Assistant, che ha un'interfaccia utente molto bella e supporta quasi tutti gli hardware e protocolli. Il problema principale di Home Assistant è che non ha una soluzione di scripting avanzata per realizzare automazioni complesse e necessita di aggiornamenti continui che a volte portano a incompatibilità e problemi hardware. Per questo motivo suggeriamo di utilizzare Domoticz a chiunque voglia realizzare un vero sistema domotico con molti dispositivi e automazioni.
Alcuni screenshot e video dei pannelli Domoticz, mostrati in un browser per PC
Pannello energetico , che mostra la ricarica delle auto, la pompa di calore, il fotovoltaico, l'energia importata ed esportata e i controlli relativi all'energia/potenza.
I prezzi e i costi orari dell'elettricità , integrati con le previsioni di produzione solare fotovoltaica , sono il modo migliore per gestire carichi come caldaia, pompa di calore, ricarica di veicoli elettrici e accumulatore statico per migliorare l'autoconsumo riducendo la bolletta elettrica .
Pannello del veicolo , che mostra la ricarica dell'auto (utilizzando il nostro modulo DomBusEVSE per realizzare una wallbox fai da te), l'energia di ricarica totale, suddivisa anche in energia fotovoltaica e dalla rete, livello attuale della batteria e autonomia, fattore di potenza di ricarica per misurare l'efficienza, distanza e posizione del veicolo, ...
Pannello della pompa di calore , che mostra il consumo energetico attuale, l'energia fotovoltaica, i setpoint, lo stato, ... Il pannello completo è molto lungo e contiene anche lo stato della valvola, la temperatura e l'umidità delle stanze, ... È possibile notare che la potenza della pompa di calore è gestita automaticamente da un'automazione Domoticz (script) per consumare tutta l'energia dall'energia fotovoltaica .
La previsione della produzione fotovoltaica insieme ai prezzi dell'elettricità permettono di gestire la pompa di calore riducendo l'energia importata e la bolletta elettrica.
Pannello per acqua calda , che utilizza una caldaia con pompa di calore integrata, che mostra alcuni controlli integrati direttamente nella pompa di calore e alcuni sensori esterni.
Centrale antifurto , con 3 modalità di funzionamento, visualizzazione dello stato (per vedere le telecamere IP), sirene, alcune luci, sensori PIR e contatto magnetico.
Planimetrie (grazie a Paolo Patt. per il video)
Cosa puoi fare con Domoticz
- Luci: accensione/spegnimento tramite pulsanti , a un orario specifico ( ad esempio accensione 25 minuti dopo il tramonto e spegnimento 40 minuti prima dell'alba ). Oscuramento e cambio colore .
- Campanello: cattura un'istantanea dalla telecamera IP quando qualcuno suona il campanello e invia l'immagine a una persona o a un gruppo tramite Telegram: sono implementati anche e-mail e molti altri sistemi di notifica.
- Cancello, porta pedonale, porta del garage, portone d'ingresso possono essere aperti da remoto (ad esempio dallo smartphone): quando il fattorino di Amazon suona il campanello e tu sei lontano, puoi vedere la foto su Telegram e poi puoi aprire il cancello per farlo entrare e consegnarti la merce!
- Sensori meteorologici : temperatura esterna, umidità, pressione, pioggia, vento, direzione del vento, .... possono essere monitorati e registrati in grafici
- Monitora la temperatura ambiente, l'umidità relativa, la CO2 e gestisce in modo intelligente il sistema di riscaldamento/raffreddamento/ventilazione
- Monitora il consumo/produzione di energia da/verso la rete elettrica , inviando un avviso quando il consumo di energia raggiunge una soglia oltre la quale si verificherà un'imminente disconnessione dell'alimentazione e attivando/disattivando gli elettrodomestici per ottimizzare l'utilizzo dell'energia.
- Quando è disponibile energia da fonti rinnovabili (ad esempio solare fotovoltaico), è possibile gestire la pompa di calore per consumare la maggior parte dell'energia da fonti rinnovabili
- Monitora il livello del serbatoio dell'acqua piovana utilizzata per l'irrigazione del giardino e dell'orto
- Gestire completamente i sensori di allarme (sensori di contatto magnetico, PIR, radar, ...) e le sirene, per ottenere un sistema antifurto completamente funzionale e personalizzabile
- ...
Supporto hardware
- GPIO RaspberryPI e RockPI
- Moduli DomBus per realizzare un sistema domotico cablato affidabile , con un consumo energetico molto basso , funzionante in caso di interruzione di corrente (batteria di backup) e controller predefinito (similmente a KNX, è possibile definire azioni eseguite dai moduli DomBus senza la necessità di un controller)
- ESP8266, ESP32 e derivati: moduli WiFi economici con diversi I/O in grado di gestire diversi tipi di dispositivi
- Dispositivi wireless RFXcom, Zwave, Enocean a 433/868/915 MHz
- Dispositivi ZigBee, a 2,4 GHz
- diversi dispositivi bus 1wire e I2C
- Philips Hue (lampade a led RGB)
- GPIO e sensori LAN (Denkovi, Lantronix, ...)
- diversi inverter solari
e molti altri dispositivi e protocolli.
Consulta l' articolo che mostra in breve come progettare un sistema domotico utilizzando i moduli DomBus!!
Raspberry PI
Sebbene Domoticz funzioni su numerose piattaforme, tra cui Windows e Mac, una buona soluzione è Raspberry, un hardware per computer monoscheda con MCU ARM quad-core, stabile, economico e che normalmente consuma meno di 3 W.
Solitamente Raspberry è dotato di un sistema operativo Raspbian (Debian GNU/Linux per Raspberry) e, come ogni sistema operativo Linux, supporta in modo sicuro e affidabile molti servizi come web, dhcp, dns, ftp, Samba, mail, ...
RockPI S
Si tratta di un computer a scheda singola molto piccolo con CPU quad-core, 512 MB di RAM e un consumo energetico molto basso: 400 mW normalmente. Una soluzione ideale per Domoticz, se si lavora senza molti script (automazioni) che richiedono molta CPU.
Moduli Domoticz e Creasol DomBus
Siamo un'azienda elettronica produttrice di moduli per sistemi domotici ottimizzati per elevata affidabilità e bassissimi consumi, disponibili con 2 diversi firmware:
- Protocollo proprietario DomBus, funzionante con Domoticz
- Protocollo standard Modbus, compatibile con quasi tutti i sistemi di domotica
Moduli Creasol DomBus e Domoticz
Quale sistema operativo utilizzi per Domoticz?
- Linux (Raspberry PI, Rock PI, NUC, PC, ....)? Puoi installare il plugin Creasol DomBus in due modi:
- utilizzando Python Plugin Manager o Domoticz Plugin Manager , se lo hai installato: si tratta di un plugin Python che ti consente di installare e aggiornare facilmente altri plugin Python.
- recuperando il plugin Creasol DomBus in questo modo:
cd /home/pi/domoticz/plugins #entra nella directory domoticz/plugins
clonazione git https://github.com/CreasolTech/CreasolDomBus
- Windows: nella directory domoticz, accedi (o crea) alla cartella plugins , crea una sottocartella CreasolDomBus e inserisci plugin.py e CreasolDomBusProtocol.py che puoi scaricare da https://github.com/CreasolTech/CreasolDomBus .
Riavvia Domoticz e in Impostazioni -> Hardware troverai un nuovo hardware Creasol DomBus: aggiungi un'istanza, assegna un nome (ad esempio dombus), seleziona la porta seriale collegata al convertitore RS485/USB (o la porta seriale virtuale collegata a un modulo di rete/RS485) e clicca sul pulsante Aggiungi.
Quando colleghi un nuovo modulo DomBus, troverai un nuovo dispositivo nel pannello Domoticz Switches : selezionalo ( pulsante Modifica ) e cambia il suo indirizzo in uno univoco, modificando il campo Descrizione del dispositivo aggiungendo il testo , HWADDR=0x0001 (imposta l'indirizzo a 1, se questo è il primo modulo), o scrivendo un indirizzo a tua scelta. Clicca sul pulsante Salva , quindi ricaricando il pannello Switches (o il pannello Utility, ....) troverai nuovi dispositivi associati a quel modulo.
I moduli allegati successivi saranno mostrati nello stesso modo e, allo stesso modo, dovrai cambiare l'indirizzo predefinito in 0x0002, 0x0003 e così via. Ogni modulo, un indirizzo univoco! Domoticz aggiungerà automaticamente un dispositivo per ogni porta del modulo .
Inoltre, molte porte dei moduli possono essere configurate in modi diversi, ad esempio un ingresso digitale può essere configurato anche come contatore di acqua/gas/energia, doppio pulsante (pulsante SU/GIÙ controllato da una singola porta), sensore di temperatura NTC, ingresso analogico (per misurare una tensione o un valore di resistenza), sensore di distanza, ...
Con Domoticz la configurazione può essere effettuata semplicemente scrivendo nel campo Descrizione del dispositivo .
Inoltre, i moduli DomBus (con protocollo DomBus) supportano i comandi DCMD : similmente a KNX, è possibile impostare una porta per attivare automaticamente diversi dispositivi , ad esempio se un pulsante è stato premuto brevemente, accende la luce (collegata allo stesso modulo o a un altro modulo DomBus), se è stato premuto per 1 secondo accende un altro dispositivo, se è stato premuto per 2 secondi fa qualcos'altro e se è stato premuto per 4 secondi... È chiaro che in questo modo è possibile scrivere automazioni semplici molto molto facilmente, che funzionano anche se il controller principale (Domoticz) è inattivo.
Infine, con i comandi DCMD è anche possibile attivare scene/gruppi Domoticz .
Per sistemi molto complessi è anche possibile utilizzare più adattatori USB/RS485 (o moduli di rete/RS485) per avere bus diversi, ad esempio uno per ogni piano, abilitando un plugin hardware DomBus per ogni bus. In questo modo se un bus si ferma (per manutenzione, ad esempio), gli altri bus continuano a funzionare.
In questo caso i comandi DCMD funzionano solo all'interno dello stesso bus: non è possibile attivare automaticamente dispositivi in un altro bus senza passare attraverso il controller Domoticz.
Non hai mai usato Domoticz prima? Come installare Domoticz
- La soluzione più semplice: acquistare una memoria microSD pronta all'uso con sistema operativo, domotica, firewall, backup oppure un KIT contenente un computer a scheda singola, memoria, alimentatore e altro.
- Seguire le istruzioni su https://wiki.domoticz.com/Main_Page
Si prega di notare che le automazioni domestiche sono una cosa seria! È meglio utilizzare sistemi operativi affidabili basati su Linux, che funziona molto meglio di Windows.
- Categoria: Domotics
How to fix data in the database
Sometimes sensor or counter data registered by Domoticz in the database may be wrong due to bad measure or counters inited from a wrong value.
What to do?
Check the device chart with all values, and use shift+click on the bad values to cancel them from the database.
In case of counters, if you have to change the current energy value (or else), you have to:
1. Stop domoticz (service domoticz stop or other command)
2. Make a backup of domoticz.db database: (cp domoticz.db backups/domoticz_20231216.db or something else)
3. Connect to the database using the command sqlite3 domoticz.db
4. Modify the counter values in Meter_Calendar (or other table) using the following queries:
.tables
select * from Meter where DeviceRowID=1722 order by Date;
update Meter set Value=Value-56000 where DeviceRowID=1722 and Date>='2023-11-28 21:10:00';
update Meter_Calendar set Value=Value-56000 where DeviceRowID=1722 and Date>='2023-11-28 21:10:00';
5. also, you have to modify the last value for that device with the sql query
update DeviceStatus set sValue='6;518227.4281' where ID=1722;
Of course you have to use the right idx value corresponding to your device, and right values and date.
The examples above are only examples.
The step 5 is used to set the current value of the meter: your problem was that you updated the Meter and Meter_Calendar tables, but not the DeviceStatus tables, so when domoticz restarted, it continued to use the bad value.
I hope this can be helpful for you!
How to export database backups in a external USB hard disk
If you're running Domoticz on a single board computer with SD or SSD memory, and you have an external hard disk connected by USB, to prevent the flash memory (that can be written only about 100 thousands times) I suggest to move the DOMOTICZ/backups directory on the external hard disk (that must be mounted at boot time, so it should be placed in /etc/fstab).
The following commands permit to enter DOMOTICZ directory, create a domoticz dir in the external hard disk, move the domoticz backup on the hard disk and create a symbolic link to it:
cd DOMOTICZ
mkdir /mnt/USB/domoticz
mv backups /mnt/USB/domoticz/
ln -s /mnt/USB/domoticz/backups .
How to disable database hourly backup
I also suggest to disable the hourly database backup, because it takes several seconds where automations stop working. To do this it's sufficient to remove the hourly directory and create a file with the same name, so Domoticz will not be able to create hourly directory and will skip the hourly backup:
cd /mnt/USB/domoticz/backups
rm -rf hourly
> hourly
Domoticz: LUA script to create SelfConsumption, SelfSufficiency, TotalUsage, TotalProduction devices
- Categoria: Domotics
The script_time_selfconsumption.lua file, available at https://github.com/CreasolTech/domoticz_lua_scripts , permits to update 5 devices in Domoticz measuring the self-consumption and self-sufficiency of the building, when one or more power sources are available (photovoltaic on the roof, photovoltaic in the garden, wind turbine, ...)
The script will update the following utility meters:
- TotalProduced energy/power: (the array POWERMETER_GENS in config_power.lua contains the list of meters measuring power for each plant)
- SelfConsumption power: totalProduced-exportedPower
- TotalConsumption energy/power: selfConsumption+importedPower
- SelfConsumption percentage: selfConsumption/TotalProduced
- SelfSufficiency percentage: selfConsumption/TotalConsumption
Script installation
Enter the GitHub project https://github.com/CreasolTech/domoticz_lua_scripts and download script_time_selfconsumption.lua config_power.lua, globalfunctions.lua and globalvariables.lua into the DOMOTICZ/scripts/lua directory.
The following variables should be defined in config_power.lua:
PowerMeterImport='PowerMeter Import' -- Meter measuring import power
PowerMeterExport='PowerMeter Export' -- Meter measuring export power
POWERMETER_GENS={'PV_PowerMeter', 'PV_Garden'} -- list of devices measuring power from renewable plants (PV on the roof, PV on the garden, wind, ...)
-- The following 5 devices have to be created manually (Setup -> Hardware -> Create virtual device)
POWERMETER_USAGE='Power_Used' -- Electric+Counter virtual device (to be created manually)
POWERMETER_PROD='Power_Produced' -- Electric+Counter virtual device (to be created manually)
POWERMETER_SELF='Power_SelfConsumption' -- Electric+Counter virtual device (to be created manually)
PERCENTAGE_SELF='Perc_SelfConsumption' -- Percentage virtual device (to be created manually)
PERCENTAGE_SUFF='Perc_SelfSufficiency' -- Percentage virtual device (to be created manually)
Check the domoticz log for any errors, and wait at least 5 minutes to see the new devices charts.
Updating the database domoticz.db
The following operations are NOT RECOMMENDED because CAN DAMAGE THE DATABASE.
If you have months or years of data, and you want to import all data in the new meters, you can get information from the database, save in a CSV file to elaborate with a spreedsheet program, then add them to the database. ALWAYS MAKE A BACKUP OF THE DATABASE before each operation!
In my case, I have two solar photovoltaic systems, a powerImport device and powerExport device measuring the power from grid and power to grid. Domoticz is running in Linux OS. In the following instructions, comments describing each action are rapresented with #text...
cd /home/pi/domoticz #enter domoticz directory
cp domoticz.db /home/backup/domoticz_202407011753.db #make a backup of database
sqlite3 domoticz.db #run sqlite client program
sqlite> .output /tmp/file1.csv
sqlite> SELECT * FROM Meter_Calendar WHERE DeviceRowID=105 ORDER BY Date; #105=idx of first solar meter
sqlite> .output /tmp/file2.csv
sqlite> SELECT * FROM Meter_Calendar WHERE DeviceRowID=1942 ORDER BY Date; #192=idx of second solar meter
Open file1 and file2 with libreoffice or other spreedsheet program, then merge the column by using the same date in the same row, then add a column with the sum of the two energies in each row, and another column with the counter value, as shown in the following picture.
where 2104 is the idx of the new POWERMETER_PROD value (you can get it entering the Utility panel in Domoticz, and clicking on Edit button on that device).
Save the file in /tmp/file3.csv then
sqlite3> .mode csv
sqlite3> .import /tmp/file3.csv Meter_Calendar
sqlite3> UPDATE DeviceStatus SET sValue="0;35732997" WHERE ID=2104;
The second line imports the file data in the existing table with day-by-day data of every meter device, the third line update the meter status with the current counter value. Replace 35732997 with the last couter value in the file3.csv + today energy, in Wh.
Check the POWERMETER_PROD chart: you should see the total produced power in the last days, months or years.
Now, get exported energy data from the PowerMeterExport
device (idx=967 in my case):
sqlite> .output /tmp/fileExport.csv
sqlite> SELECT * FROM Meter_Calendar WHERE DeviceRowID=967 ORDER BY Date;
then open fileExport.csv and compute, for each date, SelfConsumption=ProductionEnergy-ExportedEnergy, and import data with the commands
sqlite> .import /tmp/selfConsumption.csv Meter_Calendar
sqlite> UPDATE DeviceStatus SET sValue="0;13673479" WHERE ID=2100;
where 2100 is the idx of the created POWERMETER_SELF device, and 13673479 is the last counter value + today SelfConsumption energy.
Calculate the selfConsumption_percentage=int(SelfConsumption*100/ProductionEnergy) and export a CSV file with the fields
idx,perc,perc,perc,date
then import in the database with the command
sqlite> .import /tmp/selfConsumption_perc.csv Percentage_Calendar
With percentage device you don't need to update the DeviceStatus table: that's needed only for counters.
Export in a spreedsheet the imported power (from grid), then calculate the TotalUsedEnergy=SelfConsumption+ImportedEnergy, and finally calculate the SelfSufficiency_percentage=int(selfConsumption*100/TotalUsedEnergy); import all data in the same way explained above.
- Categoria: Domotics
Introduzione
Perché questa pagina? In Italia la propaganda per il fossile imperversa: ricordiamo che l'Italia, nonostante muoiano prematuramente oltre 90 mila persone a causa delle polveri sottili, ogni anno versa circa 30 miliardi di euro in sussidi alle fonti energetiche fossili (2022): forse anche per questo c'è una insistente disinformazione che circola nei media e nei social.
Bando quindi alle chiacchiere da bar e veniamo alle auto elettriche!
Critiche ricorrenti ai veicoli elettrici
Dopo 8 anni bisogna cambiare la batteria!
Non è vero: di solito la batteria è garantita 7-8 anni con almeno il 70% di autonomia residua, e questo non significa che debba morire appena scaduta la garanzia. In gennaio 2021, prima di acquistare l'auto elettrica, leggevo di un taxista di Modena che aveva percorso con la propria auto elettrica oltre 400mila km, ed un'altra persona che ne aveva percorsi addirittura 630mila km. Beh, mi auguro di poter cambiare l'auto dopo 18 anni dall'acquisto, anziché tenerla finché avrò esaurito la batteria!
Non ci sono sufficienti colonnine di ricarica
Al momento in cui scrivo questa pagina, secondo https://www.motus-e.org/fake-news/ sul suolo nazionale sono presenti 33 mila punti di ricarica accessibili al pubblico (marzo 2023). Per avere un metro di comparazione, i distributori di benzina in Italia sono circa 21 mila, mentre gli impianti di distribuzione del metano sono fermi a poco più di 1.400 (Dati EAFO). La rete delle infrastrutture per la ricarica pubblica in Italia è peraltro in continuo e costante ampliamento.
Aggiornamento gennaio 2025: sono installate in Italia oltre 64 mila colonnine, per un parco auto elettriche circolante di 300 mila unità circa: una colonnina ogni 5 auto!
Il problema sono le batterie perché usano metalli rari
Informazioni del 2023: mentre i telefoni e piccoli dispositivi attualmente utilizzano batterie Li-NMC (Litio, Nichel Manganese Cobalto) le quali hanno un'elevata densità di potenza (e sono quindi compatte), le auto elettriche si stanno orientando verso la tecnologia LFP (Litio Ferro Fosfato) che hanno una densità minore ma costano anche meno, non contenendo il cobalto. Mentre il Ferro è il metallo più abbondante sulla crosta terrestre, il Litio è il quarto metallo in ordine di abbondanza, quindi sono componenti tutt'altro che rari, tant'e' che lo stesso litio, presente nella quantità di 6-9kg per ogni auto, dopo il picco di costo dd fine 2021 ora sta diminuendo il suo prezzo in quanto sono state aperte nuove fonti di approvvigionamento.
Il problema delle batterie è lo smaltimento
Per le auto è fondamentale che la batteira abbia una elevata efficienza. Ma si stima che dopo 10-15 anni la batteria di un'auto possa diventare un punto critico (autonomia ridotta del 20% rispetto all'autonomia iniziale): in tal caso, oppure nel caso di smaltimento di un'auto, la batteria può essere impiegata come accumulo statico per case o altre strutture. Ad esempio lo stadio di Amsterdam è coperto da pannelli fotovoltaici e impiega numerose batterie delle prime Nissan Leaf rottamate (2012, ...) per l'accumulo di energia.
Dopo il riuso (quindi dopo 20 anni o più) potranno comunque essere riciclate al 95%, ovvero i minerali saranno recuperati interamente per generare nuove batterie o nuovi prodotti.
Qui potrete trovare il video di un agente di commercio altoatesino che ha percorso 300.000 km con la sua e-Golf vedendo l'autonomia scendere del 10%.
Le auto elettriche sono più pesanti ed inquinano di più perché consumano più pneumatici
E' vero che normalmente si ha un consumo superiore di pneumatici, dovuto più che altro al comportamento del guidatore che spesso tende a sfruttare maggiormente l'elevata prestazione del motore elettrico in termini di coppia (accelerazione). Uno studio di Science Direct confronta le emissioni di auto a combustione interna con auto elettriche, stabilendo che la minore emissione di PM10 delle elettriche considerando freni e pneumatici. in quanto queste ultime utilizzano molto raramente i freni privilegiando la frenata rigenerativa (utilizzando il motore elettrico per rallentare l'auto ricaricando la batteria).
Costo chilometrico più alto rispetto al diesel
Ci sono colonnine veloci (150kW o più di potenza) il cui costo a consumo è veramente alto, 0.89€/kWh, ma bisogna essere anche un po' furbi: ci sono le tariffe flat!
Acquisti un "abbonamento" e in un mese hai N kWh di energia che puoi ricaricare a tariffa fissa, a prescindere dal tipo di colonnina. Se li finisci prima del tempo, acquisti un nuovo "abbonamento". Funzionano come le ricaricabili, ma poi si rinnovano ogni mese se non vengono disattivate.
Prendiamo la tariffa più svantaggiosa: 0.40€/kWh.
Con 1kWh si percorrono circa
- 5km in autostrada, a 130km/h => 8€/100km
- 7.5km in extraurbana => 5,35€/100km
Come vedi i costi sono decisamente inferiori rispetto al costo chilometrico per un'auto diesel o ibrida!
Il futuro è l'auto ad idrogeno
L'auto ad idrogeno è un'auto elettrica che, anziché avere la batteria, ha una cella combustibile.
Essendo che il processo di produzione dell'idrogeno "verde" ha un rendimento del 50-60% e il rendimento della cella combustibile è di gran lunga inferiore. Il risultato è che il costo a km di un'auto ad idrogeno è 3 volte quello di un'auto elettrica.
Ma allora perché si parla tanto di idrogeno verde nella tassonomia dell'Europa?
La produzione di idrogeno verde (da fonti rinnovabili) viene attualmente concepita come sistema di stoccaggio di energia nel momento di maggior produzione per l'utilizzo
- nell'industria chimica, ad esempio per la produzione di ammoniaca
- nella produzione di e-fuels, ovvero combustibili sintetici da impiegare in futuro in aerei e navi.
Produzione di idrogeno per la conversione in energia elettrica? NO, non conviene.
Esempio: autobus Solaris Urbino Hydrogen: ha una cella combustibile da 70kW, una batteria al titanato di litio da 29kWh, e con una carica di idrogeno da 37.5kg ha un'autonomia di 350km. Con il costo finale dell'idrogeno a 13.7€/kg (stazione di rifornimento di Bolzano, realizzata con 9.5 milioni di euro di cui 5 milioni di € di fondi europei), il costo per percorrere 350km risulta di 510€, 145€/100km. Il costo dell'idrogeno diminuirà con il tempo.
Facendo un confronto, l'autobus elettrico Iveco E-Way, con batteria da 350kWh, ha un'autonomia di 570km ed un costo di 19€/100km (calcolato con tariffa di ricarica 0.31€/kWh corrispondente ad un abbonamento Enel X-Way).
Allora il futuro sono i biocarburanti!
Solo per soluzioni estreme dove è richiesto un alta concentrazione di energia che le batterie non possono garantire.
Un ettaro di terreno coltivato a ricino per ottenere biocarburante consente di ottenere all'anno 46MWh di energia equivalente. Un ettaro di parco solare fotovoltaico produrrebbe in un anno 625MWh di energia elettrica, quindi la produzione di biocarburante non è conveniente. Fonte
Un altro studio che confronta la produzione di biodiesel (che comunque è un inquinante, producendo durante la combustione ossidi di azoto, benzoapirene e polveri sottili, tutti cancerogeni):
* Con 1mq di suolo posso coltivare colza per produrre biocarburante necessario a percorrere 2km
* Con 1mq di pannello fotovoltaico posso produrre energia elettrica per percorrere 900km
Fonte: https://www.vaielettrico.it/biocarburanti-vs-elettrico/
Fake news sui veicoli elettrici smentiti dal dirigente del Consiglio Nazionale delle Ricerche di Bologna
Due video in cui vengono date informazioni chiare e scientifiche:
https://www.youtube.com/watch?v=iS4eBzMAgQo
https://www.youtube.com/watch?v=hMq_-0rD1YQ
e-fuels, biocarburanti, accumulatori: https://youtu.be/eJN0AQX9sPg
Pericolo incendio su auto elettriche

Costi di esercizio di auto elettriche, ibride, gpl a confronto
I costi si riferiscono ad un'auto di proprietà, ed i costi vengono calcolati in modo standardizzato. Nel caso di auto elettriche, si considera la ricarica fatta alle colonnine pubbliche.
https://www.vaielettrico.it/costi-di-esercizio-a-confronto-elettriche-ibride-gpl/
Informazioni utili
- La potenza si misura in Watt, o migliaia di Watt (1kW=1000W), ... L'energia in Joule, Wh (corrispondente alla potenza di 1W per un'ora di tempo), kWh (corrispondente a 1kW di potenza per la durata di un'ora), ... L'unità di misura kW/h non ha senso e non esiste!
- La capacità della batteria viene in genere misurata in kWh: una batteria da 50kWh ha la possibilità di fornire una potenza di 50kW per un'ora di seguito, prima di scaricarsi completamente, oppure una potenza di 20kW per 2 ore e mezzo (se vai in autostrada a 130km/h probabilmente consumi 26kW, quindi avrai autonomia poco inferiore a 2 ore, ovvero 250km).
Se devo caricare la batteria a 6kW di potenza, il tempo di ricarica dallo 0 al 100% sarà almeno di 50kWh / 6kW = 9h (dividiamo sia le cifre che le unità di misura!).
Analogamente, il tempo di ricarica dal 30% all'80% (metà capacità, ovvero 25kWh) sarà di circa 5 ore. - Al punto precedente ho scritto "almeno", perché il processo di ricarica non ha rendimento al 100%: c'è un'elettronica di controllo da alimentare, una pompa di calore per il raffreddamento della batteria (in estate), perdite sul convertitore AC/DC e PFC, perdite sui cavi... il rendimento nella ricarica varia molto a seconda della potenza (migliora con potenze alte) e potrebbe aggirarsi sull'85-90%. Teniamo quindi presente che per ricaricare l'auto dissipiamo il 10-15% di energia in calore, quindi anche i tempi di ricarica sono il 10-15% superiori rispetto alla formuletta del punto 2.
- Auto ibride e auto elettriche: due mondi molto diversi, e lo vedi sollevando il cofano. Un'auto mild-hybrid, full-hybrid e peggio ancora una plugin-hybrid hanno il cofano strapieno di componenti (che possono rompersi e che richiedono manutenzione periodica). Se apri invece il cofano di un'auto elettrica dentro trovi molto poco e ampi spazi vuoti.
L'auto elettrica non richiede cambi d'olio, filtro aria, filtro carburante. Non ha frizione e spesso non ha il cambio (solo modelli sportivi hanno in genere un cambio automatico a 2 marce). Nell'auto elettrica devi cambiare il filtro abitacolo, ogni 30mila km circa, e i pneumatici. Neanche le pastiglie dei freni si cambiano, in quanto si utilizza quasi sempre la frenata rigenerativa. - Benefici economici di un'auto elettrica: oltre alla riduzione del costo chilometrico, i tagliandi sono praticamente una formalità, non si paga bollo per 5 anni, e dopo i 5 anni si paga 1/4 del bollo calcolato su una "potenza termica" (quella riportata in libretto) bassissima: ad esempio la mia auto ha una potenza di 150kW, ma nel libretto di circolazione è riportata una potenza termica di 29kW. Praticamente dopo i 5 anni pagherò un importo irrisorio di bollo (ma questo è un dato attuale: in futuro le cose possono cambiare!).
- Meglio un accumulatore grande (tanta autonomia, a costo e peso maggiori) o un accumulatore più piccolo (meno autonomia, ma costo e poso inferiore)?
A parte il costo, minor peso significa minor consumo di pneumatici. Inoltre una maggior capacità di batteria implica quasi sempre un maggior tempo di ricarica, quindi quando capiterà di fare un viaggio molto lungo bisognerà fare più soste ma probabilmente più brevi rispetto ad un'auto con autonomia superiore.
Ho pianificato un viaggio di 1100km da Pieve di Soligo (Veneto) a Santa Maria di Leuca (Puglia) attraverso il sito https://www.abetterrouteplanner.com : con Kia Niro (con batteria da 64kWh, 450km autonomia, ricarica a max 77kW) mi basta fare 5 ricariche impiegando 3 ore 21 minuti di ricarica. Con una Peugeot e208 (con batteria da 50kWh, 340km di autonomia, ricarica a max 100kW) devo fare 7 ricariche impiegando solo 2 ore e 55 minuti.
Batterie grandi consentono di avere grandi autonomie, ma richiedono tempi di ricarica più lunghe a parità di potenza.
Quindi il fattore determinante nell'auto è la potenza massima di ricarica, e nei viaggi lunghi conta molto una buona programmazione delle ricariche: la potenza di ricarica è massima quando la batteria è scarica, e man mano che si ricarica la potenza deve necessariamente diminuire per non rovinare la batteria (non si deve superare la tensione massima consentita), quindi la soluzione più intelligente è ricaricare quando la batteria è intorno al 10% terminando la ricarica intorno all'80% o meno. - La ricarica domestica o al lavoro è certamente la soluzione più comoda: quando l'auto è parcheggiata si ricarica.
Il sistema EVSE presente nel sistema di ricarica consente di specificare al caricatore di bordo nell'auto la potenza massima che può assorbire in quel momento.
Si possono utilizzare dei cavi con presa schuko per caricare l'auto a 8-10-16A (da 1.5 a 3kW circa): è la soluzione più economica, lenta e bisogna stare attenti a non oltrepassare il limite di potenza contrattuale per evitare i distacchi, in quanto i cavi di ricarica non hanno un sistema per verificare la potenza prelevata dalla rete.
Si possono usare anche wallbox che misurano la potenza prelevata dalla rete elettrica: in questo modo la wallbox potrà specificare dinamicamente la potenza massima che l'auto potrà prelevare al fine di evitare distacchi e minimizzare il tempo di ricarica, oppure stabilendo quanta potenza al massimo prelevare dalla rete. Ad esempio, se ho il fotovoltaico e stabilisco che la wallbox potrà prelevare al massimo 0 Watt dalla rete, utilizzerò solo energia rinnovabile dal fotovoltaico per caricare l'auto. Se ho il contatore da 5kW e imposto nella wallbox una potenza massima di 5500W, utilizzerò la massima potenza disponibile per la ricarica e questa verrà variata in base ai consumi istantanei della casa (forno, lavatrice, eccetera) per non superare mai la potenza che ho impostato. - Importanza di non caricare a bassa potenza per non sprecare energia: nel seguente video viene mostrato come varia il fattore di potenza quando si ricarica un'auto. I caricatori di bordo lavorano male a bassa potenza, pertanto è bene ricaricare sempre ad almeno 4kW.
- Ricarica pubblica: ci sono due tipi di colonnine, AC (in corrente alternata) e DC (in corrente continua).
Le colonnine di ricarica in AC forniscono una corrente alternata, a 230V monofase o 400V trifase, che verrà convertita in corrente continua dal caricatore a bordo auto (On Board Charger). Come detto nel punto precedente, fornisce anche un segnale di controllo (Control Pilot) attraverso cui specifica la corrente massima di ricarica (segnale PWM 1KHz con duty cycle variabile), cosicché l'OBC nel tempo massimo di 6s dovrà adattare la corrente di ricarica al limite massimo imposto dalla colonnina. Solitamente gli OBC hanno una potenza massima di ricarica pari a 7, 11 o 22 kW.
Per ricaricare la batterie con velocità maggiori serve un caricatore dotato di semiconduttori molto costosi e impianto di raffreddamento forzato: nasce per questo la colonnina di ricarica DC, che ha il sistema di conversione da corrente alternata trifase a corrente continua specifico per caricare la batteria secondo le indicazioni fornite dal Battery Management System presente nell'auto. In sostanza, l'auto comunica alla colonnina DC la percentuale di carica, la tensione massima e la corrente massima di ricarica, che variano in funzione alla temperatura e allo stato di carica della batteria, e seguono un certo profilo di carica, e la colonnina fornisce energia in base a tali parametri. Ci sono colonnine DC a 25, 50, 75, 100, 150, 250, 350kW, che funzionano sia a 350-400V sia a 800V (alcune batterie, per aumentare la velocità di ricarica, lavorano a 800V massimi).
Dal grafico sottoriportato si evince che la velocità (potenza) massima di ricarica si ha quando la batteria è molto scarica, per poi diminuire quando la batteria raggiunge il 75-80%, e questo è uno dei motivi per cui, nei viaggi molto lunghi in cui si devono eseguire più ricariche, conviene eseguire ricariche brevi fino al 70-80% piuttosto che voler raggiungere per forza il 100% di ricarica.
Ricaricando la batteria al 100% inoltre si perde la possibilità per i primi km di sfruttare la frenata rigenerativa, in quanto la batteria non avrebbe la possibilità di accumulare energia essendo già carica completamente. - Esercizi per capire cos'è la potenza e cos'è l'energia.
Esercizio1:
La POTENZA si misura in Watt. Ad esempio, il computer Raspberry PI4 (molto usato in domotica) consuma 2.3W, quando ha un carico di lavoro CPU basso.
Quanta ENERGIA consuma il Raspberry in 1 anno?
Energia=potenza * tempo, quindi 2.3W * (24x365) ore = 2.3*24*365 W*h=20148 Wh ovvero 20.148 kWh
Si moltiplicano i numeri, ma si moltiplicano anche le unità di misura!Esercizio2:
In casa ho una batteria da 15kWh (capacità batteria = energia che può essere stoccata): se ho un esubero di potenza dal fotovoltaico di circa 2kW e la batteria è completamente scarica, quanto tempo mi serve per ricaricarla?Come prima, Energia = Potenza * Tempo => Tempo = Energia/Potenza=15kWh/2kW = (15/2) kWh/kW = 7.5h
In realtà impiegherà un po' di più in quanto il rendimento del sistema non è 100%.
Modalità di pagamento per ricaricare il veicolo elettrico
Vengono elencate le modalità per pagare le ricariche al proprio veicolo, con la premessa che non essendo un esperto potrebbero esserci delle imprecisazioni.
- Attraverso app su smartphone (Nextcharge, Be Charge, Enel X Way, A2A E-Moving, Shell Recharge, EV Way, ...).
Si scarica l'app, si crea un account, si definisce la modalità di pagamento (inserendo i dati di una carta di credito/debito, di solito).
Esiste l'interoperabilità fra i gestori delle colonnine, così dall'app di Enel X Way è possibile ad esempio vedere anche le colonnine di Be Charge, A2A, Hera, eccetera, ma probabilmente non si vedranno le colonnine DriWe o di altri operatori minori.
L'app Nextcharge ha un costo di ricarica generalmente più alta, ma è l'app che vede la maggior parte dei gestori, ed è molto ben fatta. - Attraverso RFID, in formato tessera o portachiavi, che è possibile acquistare dopo aver installato l'app del gestore.
Nextcharge credo fornisca ancora gratuitamente la card RFID dopo l'attivazione del wallet (portafogli virtuale: si carica con 20-50€, poi però ogni anno va ricaricato con almeno 20€ quindi la card o l'app vanno utilizzate!). Altri gestori chiedono un contributo di 5-10€ per avere la card.
La card o portachiavi RFID sono comodissime ed immediate da utilizzare: si passa sulla colonnina per abilitare la ricarica, e la si ripassa per terminare la ricarica. - Plug&Charge: è un sistema in fase di consolidamento che consente alla colonnina di ricarca (mediante un lettore presente nel connettore) di leggere un tag RFID presente sull'auto al fine di identificare il conto associato all'auto da cui prelevare l'importo di ricarica. E' il sistema più semplice e immediato da utilizzare, può funzionare solo su colonnine tethered ovvero che includono il cavo di ricarca, ed al momento funziona su pochissime colonnine e pochissimi tipi di auto.
- Carte di debito o credito: alcune colonnine supportano anche questa modalità, che però risulta alquanto scomoda in quanto è necessario poi specificare anche i propri dati fiscali.
Inoltre vi sono diversi tipi di modalità di pagamento relative ad app e RFID:
- addebito dei costi di ricarica su carta di credito/debito (Enel X Way, Be Charge, ...)
- creazione di un wallet ricaricabile con addebito nel wallet (Nextcharge, Be Charge, ...)
- abbonamento mensile per avere uno sconto sulle tariffe del 10-40% (Be Charge, ...)
- tariffa flat per tot kWh mensili (Enel X Way, A2A, ...). Ad esempio con l'abbonamento A2A E-Moving Medium si paga 29€ per poter caricare fino a 80kWh, ovvero al costo di 0.36€/kWh. Prima della scadenza, la tessera flat può essere chiusa nel caso non si intenda rinnovarla per il mese successivo. Sono sistemi molto utili per il periodo estivo in cui si fanno viaggi lunghi e tante ricariche, essendoci tariffe flat ancora più convenienti per caricare diverse centinaia di kWh da qualsiasi colonnina a tariffe molto convenienti.
Per iniziare consiglierei di scaricare l'app Nextcharge per poter individuare quasi tutte le colonnine presenti e per ricariche saltuarie (in quanto non sono economiche), e A2A E-Moving qualora si faccia viaggi lunghi e si sia interessati a ricariche flat in Italia.
Tariffe di ricarica in Italia applicate dai diversi operatori italiani e stranieri
Consulta il sito web https://tariffev.it
Curiosità
Quanto costa percorrere con l'auto elettrica 15mila km in un anno?
Dipende da quanto si paga l'energia elettrica e come si ricarica. L'immagine fornisce in sintesi il caso reale (non estremo) di ricarica prevalentemente durante il giorno (le giornate in estate sono lunghe, e si può ricaricare anche nel weekend) e disponibilità di un impianto fotovoltaico sul tetto, senza accumulo, il costo nel 2022 per percorrere 15mila km, riscaldare e raffrescare casa, far funzionare lavatrice, lavastoviglie, 2 frigoriferi, 1 congelatore, eccetera, è stato di negativo (ovvero il corrispettivo per la vendita dell'energia è stato superiore alla somma delle bollette elettriche e delle ricariche dell'auto eseguite alle colonnine pubblichedi cui 64€ per la ricarica alle colonnine pubbliche).
L'elettrificazione di casa e della mobilità è certamente un ottimo investimento: oltre alla riduzione dei costi, il beneficio economico è impagabile. Immagina di uscire per una passeggiata e non sentire la puzza di smog dovuto al trasporto e al riscaldamento a legna/pellet!!!
Come riportato nell'immagine, l'impianto fotovoltaico è l'artefice del cambiamento (verso un mondo meno inquinato) e del risparmio, ma hanno contribuito in maniera significativa anche l'auto elettrica e l'impianto domotico, utilizzando il software free Domoticz che attraverso uno script controlla la pompa di calore in modo da privilegiare il consumo nei momenti in cui l'elettricità costa meno e il rendimento risulta migliore.
Aggiunge alcune considerazioni: va benissimo l'impianto fotovoltaico a SUD d'inverno, se si usa la pompa di calore: la maggior parte dei consumi avviene nei mesi di dicembre/gennaio in cui ci sono poche ore di luce ed in cui il sole sorge a sud-est e tramonta a sud-ovest. Al contrario, nei 6 mesi caldi, il sole sorge a est e tramonta a sud: in questo caso il fotovoltaico su due falde rivolte a est e ovest consente di avere produzioni anche di prima mattina e in tardo pomeriggio, quando l'energia da fotovoltaico scarseggia ed i costi risultano più alti, contribuendo quindi sia a stabilizzare la rete sia ad avere una migliore remunerazione evitando il "picco di mezzogiorno" in cui ci sarà presto un eccesso di produzione elettrica.
Il seguente grafico mostra l'andamento del prezzo (linea rossa) e dell'energia richiesta dall'Italia ora per ora, stimata per domani. Normalmente, nei giorni lavorativi, il prezzo sale al mattino (quando c'e' tanta richiesta di energia e ci sono tanti impianti fotovoltaici "stupidi" che impiegano l'energia per ricaricare l'accumulatore), e poi alla sera quando viene meno l'energia dal fotovoltaico; nelle belle giornate di sole, da aprile a ottobre, si può invece osservare un calo dei prezzi nelle ore pomeridiane (quando c'e' tanta produzione fotovoltaica e gli accumulatori sono carichi).
Il seguente grafico mostra l'andamento dei prezzi orari dell'energia in una giornata di weekend soleggiato, sabato 27 maggio 2023: si può notare come l'elevata produzione da fotovoltaico induca una drastica riduzione dei prezzi, a dimostrazione che le energie rinnovabili contribuiscono a ridurre il costo dell'energia.
Sarebbe tuttavia opportuno che l'energia venga pagata dal consumatore in base al PUN orario, come avviene in Danimarca, affinché l'utente sia protagonista della stabilizzazione della rete: nel caso specifico sarebbe infatti opportuno che le auto elettriche vengano caricate quando il PUN è basso ovvero quando c'e' un eccesso di produzione.
Consiglio: nel caso di fotovoltaico rivolto a est e ovest è possibile installare 8kW circa di pannelli fotovoltaici collegati ad un inverter da 6kW (proprio perché non c'e' il picco di produzione). Meglio comunque sarebbe un tracking solare in grado di garantire una produzione quasi costante durante il giorno: maggior informazioni nella pagina in inglese con alcuni esempi sul tracking solare
Quali sono i consumi di una casa con riscaldamento/raffrescamento con pompa di calore e impianto radiante?
Ho fotovoltaico senza accumulo, e non sono contrario all'accumulo a prescindere. Più avanti penso di installare un piccolo accumulo per superare le ore serali in cui il costo è alto (essendo alti i consumi serali).
Sono di Treviso, ho impianto da 7.2kWp sul tetto, su falde a est e ovest, che d'inverno rende come un 4.5kWp a sud.
Riscaldo casa con pompa di calore, e nei mesi critici (dicembre/gennaio) il PV produce circa 4-10kWh/giorno e devo importare circa 30-40kWh al giorno. In questo caso le batterie non servono, soprattutto perché ho la pompa di calore che, grazie all'impianto domotico autocostruito, insegue i consumi del fotovoltaico (se produce molto, aumenta i suoi consumi).
Negli altri periodi importo circa 4-5kWh al giorno: di notte la PDC non funziona, e d'estate raffresco il pavimento di giorno in modo da accenderla solo quando il fotovoltaico produce.
Nel 2022 l'energia elettrica per alimentare e riscaldare casa, e percorrere anche 15mila km con l'auto elettrica, mi è costata meno di zero (ho guadagnato 117€ grazie alla remunerazione dell'energia immessa in rete).
Quindi, per le mie esigenze, posso dire che:
* la maggior parte di energia viene importata d'inverno, e qui l'accumulo non serve a nulla a meno che tu non abbia un fotovoltaico di potenza esagerata che produce a mezzogiorno molto più di quanto consumi la PDC
* se ottimizzi l'uso degli elettrodomestici (accendendoli di giorno) e puoi ricaricare l'auto di giorno, ti basta un accumulo che copra il tuo fabbisogno notturno, che in genere è basso
* se puoi caricare l'auto solo di notte puoi pensare ad un accumulo più grande, ma tieni presente che stoccare e recuperare energia non è un processo senza perdite!
* l'auto elettrica si ricarica bene durante la pausa pranzo in cui la potenza dal fotovoltaico è massima. Nei mesi invernali la ricarico invece di notte.
Comunque sto valutando la possibilità di installare un accumulo da 6-10kWh per migliorare l'autoconsumo da marzo a ottobre, consapevole che i vantaggi non saranno economici bensì di sistema, nel senso che ridurrò l'impatto di casa sui consumi dalla rete.
Energia prodotta dal fotovoltaico sul tetto: Treviso, 2700Wp verso est + 4500Wp verso ovest

Energia importata dalla rete (fotovoltaico 7.2kWp, no accumulo, ampia casa A4 con pompa di calore)

Energia immessa in rete

Articolo pubblicato su VaiElettrico, 2025-01-04
Abito con mia moglie in provincia di Treviso, ho una casa singola di circa 250mq del 1992 che è stata ristrutturata 7 anni fa per avere un migliore isolamento termico (cappotto termico esterno) e per non utilizzare più il gas come fonte primaria di energia termica: ho infatti due pompe di calore, una per il riscaldamento (da 8kWt, consuma al massimo 3kW) ed una per l'acqua calda sanitaria, un impianto fotovoltaico sul tetto da 7.2kWp con inverter da 6kW, ed un contratto energia elettrica 100% rinnovabile con potenza di 5kW (potenza disponibile 5500W, oppure 6350W per max 2 ore ogni 4).
Ho inoltre una Kia eNiro del 2021 con accumulatore da 64kWh netti.
Ho schematizzato nell'immagine l'energia prodotta, importata, autoconsumata, i relativi costi, eccetera.
E' un bilancio provvisorio in cui ho stimato al ribasso il rimborso GSE (che in realtà dovrebbe essere superiore) per l'energia immessa in rete, e l'importo della prossima bolletta relativa all'energia elettrica di dicembre.
Ho inoltre riportato i grafici dei consumi mensili della pompa di calore per il riscaldamento e raffrescamento, e l'energia mensile utilizzata per ricaricare l'auto, suddivisa poi in energia proveniente dal fotovoltaico ed energia proveniente dalla rete.
Si può notare come in Pianura Padana sia molto più alto il fabbisogno energetico in inverno per il riscaldamento domestico, rispetto al raffrescamento estivo.
In questa situazione le ricariche dell'auto in inverno avvengono utilizzando quasi esclusivamente energia dalla rete in quanto tutta l'energia prodotta dal fotovoltaico viene utilizzata nel mio caso dalla pompa di calore.
D'estate invece l'auto risulta un'ottima soluzione non solo per viaggiare in modo economico (l'energia dal sole costa di solito dai 6 ai 12 centesimi al kWh, nel senso che se non ricaricassi l'auto tale energia immessa in rete verrebbe retribuita dal GSE), ma anche per stabilizzare la rete: in particolar nel mese di maggio, quando l'irraggiamento solare è forte e le temperature sono basse, spesso l'energia dagli impianti fotovoltaici tende a superare l'energia consumata, portando l'inverter solare a ridurre la potenza immessa in rete per non oltrepassare la tensione di 253V (230V + 10%): in queste situazioni sarebbe auspicabile che venissero utilizzate le auto come sistema per ridurre la tensione di rete accumulando l'energia che altrimenti sarebbe persa.
Sempre per rimanere in tema, durante l'anno si sono spesso verificati dei periodi in cui il costo orario dell'energia (all'ingrosso) risultava quasi nullo: questa situazione si verificava in particolare nei weekend dei mesi di maggior produzione con temperature miti, oppure in periodo autunnale quando erano in corso importanti perturbazioni nell'Europa centrale con forti produzioni dagli impianti eolici. Anche in questo caso sarebbe auspicabile ricaricare l'auto, per sfruttare l'energia a basso costo, cosiccome sarebbe utile che anche i clienti domestici pagassero l'energia in base al prezzo orario, anziché alle fasce orarie, al fine di migliorare la stabilità della rete consentendo di consumare energia a prezzi agevolati nelle ore in cui è maggiormente disponibile e ridurre i consumi nelle ore di punta (prima mattina e sera).
Le condizioni di prezzi favorevoli saranno sempre più disponibili in futuro, anche se l'Italia sta affrontando con lentezza la transizione energetica rispetto ad altri paesi europei: infatti se in Europa nel 2024 il costo medio dell'energia elettrica è scesa del 16% rispetto al 2023, in Italia osserviamo un progressivo aumento dei prezzi in quanto dipendiamo ancora troppo dal gas. Quando finalmente avremo anche noi una discreta capacità eolica e fotovoltaica, avremo anche noi i prezzi dell'energia negativi o azzerati come succede spesso in altri paesi europei nelle situazioni favorevoli per eolico o fotovoltaico!
Termino con un parere relativo all'accumulo domestico, che ritengo superfluo ed economicamente sconveniente quando la pompa di calore è gestita in modo ottimizzato (inseguendo la produzione del fotovoltaico), raffrescando casa attraverso l'impianto a pavimento, e le ricariche all'auto possono essere fatte anche di giorno. Da aprile a ottobre l'energia importata dalla rete per il funzionamento di casa risulta mediamente inferiore ai 5kWh, corrispondenti a 1.3€ al giorno. Se avessi un accumulo potrei quindi risparmiare 1.3€ * 200 giorni = 260€ a fronte di un mancato introito dalla vendita di energia di 5kWh * 200 giorni * 1.15 (perdite per caricare e scaricare l'accumulo domestico * 0.10€/kWh = 115€, quindi avrei un beneficio di 260-115=145€ all'anno. Ma quanto sarebbe il tempo di rientro per l'installazione di un accumulo statico da 10kWh se il beneficio (sovrastimato) è di 145€ all'anno?
Per il bene dei cittadini della Pianura Padana, auspico in un cambio di mentalità da parte del Governo al fine di consentire l'installazione di nuovi parchi eolici offshore al Nord, installazione di parchi fotovoltaici con tracking per avere una maggior produzione durante le prime ore del giorno e il tardo pomeriggio, ed una maggior coscienza da parte di tutti i cittadini riguardo i temi ambientali: viviamo in uno dei territori più inquinati, cerchiamo di utilizzare le nuove tecnologie quando dobbiamo cambiare caldaia e auto! Serviranno tanti anni, ma quando avremo finalmente smesso di bruciare combustibili fossili e legnosi, potremo finalmente arieggiare casa senza il problema della puzza dovuta alle polveri sottili che ogni anno causa la morte di almeno 60mila italiani.
Spero che le informazioni riportate siano abbastanza comprensibili e possano essere utili a chi vuole valutare i benefici economici (oltre a quelli ambientali!) offerti dal fotovoltaico e dall'auto elettrica.
Consigli: che interventi fare e tempi di rientro
1. se non ti produci energia, la devi acquistare. L’energia elettrica costa molto, perciò l’impianto fotovoltaico si ripaga in pochi anni, grazie anche alla detrazione fiscale.
2. se produci l’energia e poi la disperdi, non hai fatto un grande affare: in particolare la casa va coibentata. Se hai un sottotetto non abitato, isolarlo posando dei pannelli XPS diventa una scelta mooolto conveniente e fai-da-te. Se hai un sottotetto non agibile, c’e’ la soluzione dell’insufflaggio di materiale isolante (palline di carta, o nel caso si abbiano caminetti/stufe a biomassa, fiocchi di lana di roccia o vetro).
3. il cappotto termico costa molto, ma per case datate come la mia è indispensabile per avere un basso consumo energetico d’inverno e poter quindi utilizzare una pompa di calore per il riscaldamento. In alternativa si possono rivestire internamente tutte le pareti.
4. il riscaldamento a pavimento è un altro elemento essenziale… chi acquista una casa che non ha ci pensi: se vuoi togliere il pavimento vecchio, installa anche l’impianto a pavimento. In alternativa si può installare anche un impianto radiante a soffitto, che funziona benissimo d’estate, un po’ meno d’inverno (quando ti siedi a tavola sentirai probabilmente le gambe fredde).
Soprattutto l’impianto radiante a pavimento ti consente di accumulare energia evitando nelle mezze stagioni ed in estate di accendere la pompa di calore di notte (quando il fotovoltaico non produce).
5. Sempre per chi deve ristrutturare casa, consiglio vivamente l’installazione della ventilazione meccanica controllata (VMC), eventualmente con chiller per deumidificare. E’ una soluzione ottima per avere il ricambio d’aria necessario a non avere muffa in casa ed avere aria fresca. D’estate può essere utilizzato per raffrescare e deumidificare l’aria (per cui non serve installare degli split in giro per casa).
Alcune CONSIDERAZIONI SUL FOTOVOLTAICO
1. avere le falde a est e ovest come nel mio caso va benissimo in estate, ma va male in inverno in cui il sole sorge a sud-est e tramonta a sud-ovest
2. per chi intende installare il fotovoltaico, raccomando di installare più pannelli possibili, perché il fabbisogno energetico aumenterà sempre e ampliare l’impianto un domani potrebbe essere molto più costoso che installare subito più pannelli. Chi è in monofase ha il limite di 6kW per l’inverter, e considerando che d’estate fa caldo ed i pannelli rendono meno, chi ha una falda a sud può installare sicuramente moduli per almeno 7.5kWp, chi ha le falde a est e ovest può installare anche 9kWp. Verificate con il vostro tecnico!
3. considerate gli ombreggiamenti che potete avere soprattutto in inverno, con il sole basso: se avete camini, alberi, o l’antenna TV con i pannelli sotto, problemi con piccioni sporcaccioni, valutate la possibilità di installare moduli fotovoltaici con ottimizzatori (solaredge, huawei, tico, …) in modo da avere sempre la massima produzione anche in caso di ombreggiamenti, oppure microinverter con MPPT per ogni ingresso.
4. i tempi sono maturi per lo storage domestico, che potete sempre installare facilmente più avanti se avrete optato per un inverter che supporti l’accumulo.
Scegliete un inverter senza ventola (indice di maggiore efficienza).
5. Non avendo alcuno storage non so bene le caratteristiche dei vari prodotti, ma tenete presente che la conversione DC/DC per caricare la batteria (quindi inverter ibrido in grado di caricare la batteria partendo dalla tensione dei pannelli fotovoltaici) è più efficiente della conversione AC/DC (ricarica batteria a partire dai 230Vac, ovvero quello che fanno gli inverter retrofit e i Tesla Powerwall), quindi in teoria è meglio dotarsi di inverter ibrido per un futuro accoppiamento ad una batteria.
Quanto produce un inseguitore solare a 2 assi?
Questi i risultati comparativi in Veneto, in una giornata autunnale, fra un inseguitore a due assi controllato dal nostro controller DomBusTracker e un impianto fotovoltaico sul tetto, orientato in parte a est e in parte a ovest.
Quanto consuma l'auto elettrica in montagna?
In salita consuma, in discesa ricarica. La disponibilità di una grande batteria consente di poter immagazzinare molta energia, a differenza delle auto ibride o ad idrogeno.
Ad esempio a febbraio 2022 ho fatto un viaggio di piacere sulle Dolomiti venete/trentine. Salito in cima al Passo Pordoi (2239m SLM) lo stato di carica della batteria era 59%. Da li sono sceso a Canazei, Moena, risalito al Passo San Pellegrino, Falcade, Agordo, Trichiana, e risalendo verso il Passo San Boldo, a circa 400m SLM lo stato di carica era ancora al 59%. In sostanza ho percorso 106km sfruttando l'energia accumulata scendendo dal Passo Pordoi.
E' possibile autocostruirsi un sistema di ricarica / wallbox che si integri con la domotica?
Si, bisogna ovviamente essere abbastanza esperti di elettronica/informatica/impianti elettrici.
Ci sono diversi moduli EVSE in commercio che controllano la ricarica del veicolo e si integrano con sistemi domotici attraverso collegamento WiFi, LAN o RS485. Creasol produce un modulo, ad uso sperimentale, che supporta i protocolli DomBus e Modbus RTU, e può essere utilizzato con qualsiasi sistema domotico opensource (Node_RED, HomeAssistant, ioBroker, OpenHAB, Domoticz, ....).
Contratti di fornitura energia elettrica con tariffa basata sul prezzo zonale orario
Questo è quanto fornisce DeepSeek. Da verificare, e sicuramente manca l'offerta 100% rinnovabile Duferco Pianetablu.
In Italia, alcuni fornitori di energia elettrica offrono tariffe "dynamic pricing" o "a prezzo variabile orario", che si basano sul prezzo zonale orario (o sul PUN, Prezzo Unico Nazionale) invece di applicare un prezzo fisso o una media mensile.
Ecco i principali fornitori che propongono tariffe di questo tipo:
1. Illumia – Tariffa "Miglior Prezzo" (ex Next Energy)
-
Come funziona:
-
Prezzo dell'energia allineato al PUN (Prezzo Unico Nazionale) in tempo reale con aggiunta di una componente fissa (spread).
-
Bolletta calcolata sul consumo effettivo nelle diverse fasce orarie (F1, F2, F3).
-
-
Vantaggi:
-
Conveniente se consumi energia nelle ore più economiche (es. di notte o nei weekend).
-
-
Sito: Illumia
2. NeN – Tariffa "Dynamic"
-
Come funziona:
-
Prezzo variabile ogni ora in base al mercato elettrico (PUN + spread).
-
App per monitorare i prezzi in tempo reale e ottimizzare i consumi.
-
-
Vantaggi:
-
Possibilità di risparmiare spostando i consumi nelle ore più convenienti.
-
-
Sito: NeN
3. Wekiwi – Tariffa "Variabile PUN"
-
Come funziona:
-
Prezzo legato al PUN orario o mensile (a scelta del cliente).
-
Opzione con prezzo fisso o variabile con limiti di oscillazione.
-
-
Vantaggi:
-
Flessibilità e trasparenza sui costi.
-
-
Sito: Wekiwi
4. Energia Italia – Tariffa "Index"
-
Come funziona:
-
Prezzo basato sul PUN + un piccolo margine.
-
Aggiornato mensilmente o giornalmente a seconda del piano.
-
-
Vantaggi:
-
Adatto a chi vuole un prezzo di mercato senza fissare un costo a lungo termine.
-
-
Sito: Energia Italia
5. E.ON – Tariffa "EnergyWeb" (in passato)
-
Come funziona:
-
Prezzo variabile in base alla domanda e offerta del mercato.
-
Possibilità di monitorare i consumi via app.
-
-
Attenzione: Non sempre disponibile, meglio verificare l’offerta attuale.
-
Sito: E.ON
6. Octopus Energy (in arrivo in Italia)
-
Novità:
-
In UK offre tariffe "Agile" con prezzi aggiornati ogni 30 minuti.
-
Presto potrebbe lanciare un'offerta simile in Italia.
-
-
Sito: Octopus Energy
Come funzionano queste tariffe?
-
Il prezzo dell’energia cambia ogni ora/giorno/mese in base al mercato elettrico (GME).
-
Se hai un contatore smart, puoi sfruttare i prezzi più bassi (es. di notte o nei weekend).
-
Se invece hai un contatore tradizionale, il fornitore applica una media per fascia oraria (F1, F2, F3).
Conviene?
✔ Sì, se:
-
Hai un contatore smart e puoi spostare i consumi nelle ore più economiche.
-
Vuoi pagare un prezzo trasparente e legato al mercato.
❌ No, se:
-
Preferisci la stabilità di un prezzo fisso.
-
Non vuoi rischiare rialzi improvvisi in caso di crisi energetiche.
Energia rinnovabile in Italia
Collegamenti HVDC
Terna, il gestore dell'infrastruttura di rete di trasmissione italiana ha in cantiere, a partire dal 2023, di installare due reti dorsali HVDC per portare 2GW di potenza dal Sud Italia e isole verso il Nord. Spesa complessiva 11 miliardi di euro [Fonte]. HVDC sono collegamenti ad 500-600kV in corrente continua, quindi utilizzano due cavi conduttori, offrendo una perdita di circa 3% ogni 400km. Richiede delle costose stazioni di conversione AC/DC e DC/AC per la conversione in trifase e il collegamento quindi alla rete HVAC esistente (trifase a 115kV, 220kV o 380kV).
Parchi eolici offshore
Sono installazioni di turbine eoliche al largo della costa, su pali fissati sul fondale (se fondale basso) o su piattaforme galleggianti ancorate al fondale.
I vantaggi delle installazioni offshore sono:
- ridotto impatto visivo: a 20km o più dalla costa si intravedono appena
- maggiore velocità del vento e minor turbolenze, dovute alla superficie piatta
- maggiore disponibilità di vento
Attualmente (2023) hanno un costo (a parità di potenza) superiore rispetto alle installazioni onshore (in terra ferma) dovute al costo della piattaforma galleggiante ed ancoraggio.
Facendo un paragone con il punto precedente, con 9 miliardi di euro sarebbe possibile installare parchi eolici offshore per una capacità di 3GW (magari in alto tirreno o adriatico) da collegare direttamente alla rete elettrica del Nord Italia. Forse sarebbe una soluzione più vantaggiosa rispetto a quella di installare tutto al Sud e dover investire capitali enormi per poi interconnettere il Sud al Nord, dal momento che il Nord attualmente richiede almeno 10GW di potenza rinnovabile.
Produzione annua in relazione alla velocità del vento
Il sito web di Energy Hunters risulta molto ricco di informazioni relative all'eolico.
Interessante è anche la caratteristica degli aerogeneratori, avvero la producibilità annua di energia in funzione della velocità del vento:
La potenza aerodinamica varia con il cubo della velocità, ma ci sono molti aspetti da dover tener presente fra cui la capacità dell'aerogeneratore di variare l'inclinazione della pala per ottimizzare la produzione e mettersi in sicurezza in caso di elevate ventosità.
Fotovoltaico
Efficienza delle diverse tecnologie fotovoltaiche in relazione allo sviluppo (clicca per scaricare PDF ad alta risoluzione).
Biogas, biocarburanti
Alcune informazioni utili sull'efficienza di produzione di biogas e biocarburanti tratti dal video https://youtu.be/f-2qcqxKOy0 :
- 1 ha di mais consente di produrre 15MWh di biometano
- 1 ha di colture zuccherine/amilacee consente di produrre (in climi favorevoli come il Brasile) 6000 L di bioetanolo, ovvero 6.6MWh
- 1 ha di colture oleaginose consente di produrre 1000 kg di biodiesel, corrispondenti a 10MWh di energia
- 1 ha di fotovoltaico consente di installare da 500kWp a 1.5MWp a seconda della tipologia di installazione, con una producibilità che varia da 600MWh a 900MWh in Pianura Padana. In questo caso vi sono altri vantaggi rispetto ai biocarburanti: non si usano pesticidi, fertilizzanti e altri inquinanti, non è richiesta l'irrigazione e consumo di acqua, e viene consentita la coltivazione sotto i pannelli (agrivoltaico) con un ridotto irragiamento (e quindi consumo d'acqua).
- Categoria: Domotics
A very cheap and useful fire alarm system is presented below. The idea is to use simple temperature sensors and get an alert on building internal sirens and Telegram when the temperature in a room increases quickly.
As temperature sensors are commonly used in any room for climatization, no extra sensors are needed.
Fire alarm requirements
- Single board computer with low power consumption, like Rock PI S or Raspberry or Nuc.
- A microSD for Rock PI S or Raspeberry with operating system and Domoticz free open-source software to manage all sensors and automations reliably.
- script_time_fireAlarm.lua file (already installed in the Domoticz microSD shown at previous step)
- temperature sensors
Temperature and humidity sensors for home automation systems
If you want to try our DomBusTH module, it integrates a temperature and relative humidity sensors, as like as RGW led, 4 I/Os, 2 outputs, in a small board that can be placed on a blank cover.
This is the perfect board to be placed in every room where temperature and humidity should be monitored for climate control. Through the 2 outputs it's possible to control 2 relays to open/close a shutter, for example. The 4 I/Os can be connected to alarm sensors (magnetic contact sensors applied to windows/doors, PIRs) or pushbuttons.
Also, using the script below it's possible to realize a fire alarm system that works also with this kind of temperature sensor.
The following video shows the DomBusTH module installed on a blank cover, measuring temperature and relative humidity, showing the current imported (red) or exported (green) power in kW, having a touch sensor used to select two different functions, and 6 I/Os (2 I/Os connected to a piezo buzzer).
Fire alarm script
On https://github.com/CreasolTech/domoticz_lua_scripts it's possible to find two scripts:
- script_time_fireAlarm.lua , the script that check every minute the temperature on each room and verify that it does not increases to fast
- config_fireAlarm.lua , the configuration file where it's possible to list all zones, defining the temperature device name and temperature increase rate.
When the temperature in a room increases, in 1 minute, more than the value specified for that room, a notification is sent to a Telegram group (or channel) and, optionally, one or more devices can be activated: for example it can activate the internal siren for few seconds, and the light in bedroom during the night.
- Categoria: Domotics
Seleziona la lingua inglese per leggere la versione aggiornata di questo articolo!
Introduzione
In questo articolo viene illustrato come gestire la pompa di calore e il sistema di ventilazione (HVAC) con il software open source Domoticz installato su un Rock PI S o Raspberry PI (ma qualsiasi altro hardware andrà bene), per utilizzare al meglio l'energia da fonti rinnovabili (in questo caso impianto fotovoltaico ) riducendo la bolletta elettrica .
Innanzitutto, un edificio intelligente non dovrebbe avere termostati per regolare la temperatura ambiente , perché di solito non sono intelligenti come un controller domotico. È preferibile avere un sensore di temperatura (e umidità) in alcune stanze e modificare la temperatura dell'acqua in uscita per ottenere il massimo comfort e il consumo energetico necessario .
Controllare un edificio con impianto radiante con pompa di calore e fotovoltaico sul tetto è un po' complesso, perché bisogna tenere conto di diversi elementi:
-
temperatura esterna minima e massima
-
temperature ambiente (e diff= differenza dal setpoint)
-
variazione di diff con il tempo (derivata di diff sul tempo)
-
potenza attuale dalla rete (se negativa, è disponibile una potenza extra dal solare fotovoltaico, ed è meglio utilizzarla aumentando la potenza della pompa di calore)
-
costo dell'elettricità, per aumentare i consumi quando l'energia elettrica è più economica e ridurre la potenza durante le ore di punta (solitamente dalle 7 alle 9 del mattino e dalle 18 alle 21 di sera) per contribuire alla stabilità della rete elettrica!
- previsione dell'energia solare, quindi è possibile ridurre la potenza della pompa di calore al mattino o alla sera nel caso in cui ci sia abbastanza energia dal fotovoltaico per compensare il tempo di spegnimento della pompa di calore.
L'obiettivo è quello di ottenere una temperatura confortevole in tutte le stanze, magari riducendo la temperatura quando le stanze non vengono utilizzate e surriscaldando l'edificio durante l'inverno, quando è disponibile energia extra dal fotovoltaico: se il setpoint è 21°C ma è disponibile energia extra dal fotovoltaico, il setpoint può essere aumentato dinamicamente a 21,5 o 22°C, ad esempio.
Per questo motivo in alcune stanze si preferiscono i sensori di temperatura/umidità ai termostati manuali!
Questa è una scheda molto compatta, DomBusTH , che può essere utilizzata con Domoticz, Home Assistant, ..., con un sensore di temperatura e umidità , un sensore touch (che funge da pulsante multifunzione), LED rosso+verde+bianco (per le notifiche), 4 ingressi (sensori di allarme, pulsanti, ...) e 2 uscite (che possono essere collegate a un relè esterno, ad esempio per azionare una tapparella SU/GIÙ). Questa è solo una pubblicità per il nostro prodotto, ma è possibile utilizzare qualsiasi sensore di temperatura per questo scopo, ovviamente!
Domoticz supporta diversi linguaggi di scripting e in questo caso è stato scelto lo script LUA perché è molto chiaro e quindi facile da imparare, usare e personalizzare.
In GitHub https://github.com/CreasolTech/domoticz_lua_scripts è possibile trovare l'esempio script_time_heatpump_emmeti.lua per controllare EMMETI Mirai SMI EH1018DC tramite Modbus, impostando la temperatura dell'acqua in uscita e la potenza del compressore. Lo script è davvero complicato perché personalizzato per le esigenze di un edificio specifico, quindi si consiglia di iniziare con alcune semplici regole per realizzare un'automazione, quindi adattare e migliorare le regole per ottenere il comportamento desiderato.
Di che cosa hai bisogno?
- un computer a scheda singola (come Raspberry PI, Rock PI) o NUC o un altro mini-PC , con almeno 1 porta USB (che può essere espansa con un hub USB, se necessario)
- Sistema operativo Linux + software Domoticz. Puoi anche trovare la scheda SD con sistema operativo + software già installati e pronti all'uso: controlla https://store.creasol.it/19-kit per alcuni kit .
- adattatore USB/RS485 economico per collegare la pompa di calore tramite RS485. In alternativa è possibile utilizzare un modulo WiFi-RJ45/RS485.
- adattatore USB/RS485 economico, o modulo WiFi-RJ45/RS485, per collegare tutti i moduli DomBus tramite bus RS485, se necessario.
- sensori di temperatura
- specifiche per i registri Modbus della pompa di calore, un po' di pazienza e alcune competenze per realizzare un'automazione per il controllo della pompa di calore .
Perché Domoticz?
Puoi usare altri sistemi, come Home Assistant, Node-RED, OpenHAB, ... La scelta di Domoticz è buona perché è semplice, stabile e consente di realizzare facilmente automazioni complesse programmando in LUA. Altri sistemi di automazione domestica non sono così versatili, ma possono essere usati ugualmente con alcune limitazioni.
Controllo della pompa di calore tramite ModBus
La pompa di calore ha un ingresso per selezionare metà potenza o piena potenza : viene utilizzata principalmente durante la notte per ridurre il rumore, limitando la frequenza del compressore e della ventola a circa il 50% (la frequenza/potenza del compressore può essere selezionata da 0 a 100%).
Poiché è possibile ridurre la frequenza del compressore, è possibile utilizzare questa funzione per ridurre la potenza della pompa di calore.
La temperatura dell'acqua è una buona soluzione per massimizzare il comfort della casa, mentre la frequenza del compressore è perfetta per controllare la potenza utilizzata.
Di default la pompa di calore ha un algoritmo per calcolare la temperatura dell'acqua in uscita in base alla temperatura esterna attuale e per regolare la frequenza (potenza) del compressore proporzionalmente alla differenza tra la temperatura calcolata e la temperatura attuale dell'acqua.
L'idea è quella di implementare un migliore controllo della temperatura dell'acqua in uscita basato su :
- differenza tra il setpoint della stanza e la temperatura attuale diffTemp
- derivata di diffTemp (è importante sapere se la differenza tra setpoint e temperatura sta diminuendo o aumentando!)
- temperatura esterna minima (massima in estate)
- potenza attuale dall'impianto fotovoltaico (per migliorare l'autoconsumo)
- potenza di picco della rete elettrica , per ridurre il consumo di energia nelle ore di punta (al mattino presto e nel tardo pomeriggio): questo serve solo ad aiutare la rete elettrica ad evitare picchi di potenza e prezzi elevati dell'energia
- previsione energia fotovoltaica : se sufficientemente alta, è possibile limitare la potenza durante la notte e le ore di punta, aumentando la potenza durante il giorno. Se l'energia da fotovoltaico sarà insufficiente, è meglio mantenere la pompa di calore a bassa potenza durante le ore di punta, ma tenerla accesa.
L'algoritmo di controllo è implementato in uno script LUA che calcola il valore corretto della temperatura dell'acqua in uscita e della frequenza del compressore (potenza) , inviando tali parametri tramite Modbus (RS485) alla pompa di calore utilizzando il comando mbpoll o tramite un plugin per il controllo della pompa di calore, se disponibile.
La pompa di calore RS485 è collegata al controller domotico (in questo caso RaspberryPI) tramite un adattatore RS485/USB; inoltre, il modulo DomBus31 viene utilizzato per controllare gli ingressi della pompa di calore (termostato acceso/spento, temperatura serpentina/radiante, riscaldamento/raffreddamento e potenza piena/metà potenza.
In realtà, la pompa di calore è sempre configurata in "modalità notturna" e lo script lua controlla entrambi
- temperatura del fluido in uscita necessaria per avere il giusto comfort in casa
- percentuale di potenza del compressore , per regolare la potenza
Durante la notte, sia la temperatura del fluido che la potenza vengono ridotte per limitare il consumo di energia e il rumore del ventilatore/compressore.
Durante il giorno aumentano sia la temperatura del fluido che la potenza (maggiore temperatura => maggiore efficienza), ad eccezione delle ore di punta del mattino e della sera in cui è buona norma ridurre i consumi per una migliore stabilità della rete elettrica, e anche per risparmiare.
Se c'è una produzione extra da fotovoltaico (energia esportata alla rete), la temperatura del fluido e la potenza vengono aumentate per consumare tutta l'energia disponibile da fotovoltaico. Inoltre, i setpoint della stanza vengono automaticamente aumentati in caso di potenza extra da fotovoltaico, per ridurre la potenza consumata la sera o la notte.
I file script_time_heatpump_emmeti.lua e config_heatpump_emmeti.lua sono disponibili su Github https://github.com/CreasolTech/domoticz_lua_scripts
Previsioni sui costi dell'energia elettrica e dell'energia fotovoltaica
Nella stessa pagina GitHub è possibile trovare script_time_entsoe.lua che calcola il prezzo e il costo dell'elettricità ora per ora , il prezzo medio dell'elettricità , la previsione oraria dell'energia solare e la previsione giornaliera totale dell'energia .
Il prezzo dell'elettricità viene calcolato per la zona selezionata (ad esempio Nord Italia, Danimarca2, ...) e il costo orario dell'energia viene calcolato specificando 3 parametri aggiuntivi, a seconda del fornitore.
Per la previsione dell'energia solare, è possibile specificare orientamento/declinazione/kWp per uno o più sistemi, quindi avendo pannelli solari posizionati con orientamenti diversi è possibile calcolare l'energia oraria per tutte le stringhe. Sfortunatamente gli inseguitori solari non sono gestiti da questa API di previsione.
Lo script_time_entsoe.lua produce 4 variabili contenenti valori orari separati da punto e virgola:
- prezzo orario + medio dell'elettricità oggi
- prezzo orario + medio dell'elettricità domani
- energia fotovoltaica oraria + totale oggi
- energia fotovoltaica oraria + totale domani
Includendo gli script globalvariables.lua e globalfunctions.lua è possibile utilizzare le funzioni:
- tonumber( getItemFromCSV(uservariables['entsoe_today'], ';', timeNow.hour) ) per ottenere il prezzo medio attuale dell'elettricità
- tonumber( getItemFromCSV(uservariables['entsoe_today'], ';', 24) ) per ottenere il prezzo medio attuale dell'elettricità
- tonumber( getItemFromCSV(uservariables['pv_today'], ';', 24) ) per ottenere l'energia totale prevista dal fotovoltaico, oggi
- tonumber( getItemFromCSV(uservariables['pv_tomorrow'], ';', 24) ) per ottenere l'energia totale prevista dal fotovoltaico, domani
Con Domoticz è possibile scrivere automazioni complesse che tengono conto di tutti i parametri, consentendo di risparmiare denaro aumentando l'autoconsumo e riducendo il consumo di energia nelle ore di punta in cui il costo dell'elettricità è più alto. Inoltre, in questo modo è possibile migliorare la flessibilità energetica , aiutando la rete elettrica riducendo il consumo (o l'esportazione di energia) quando la sua disponibilità è bassa (durante le ore di punta).
Plugin Domoticz per la gestione della pompa di calore Emmeti Mirai SMI
Un plugin per Domoticz che gestisce le pompe di calore prodotte da Emmeti è disponibile su https://github.com/CreasolTech/domoticz-emmeti-mirai
- Categoria: Domotics
Conversione di un semplice campanello esistente in un campanello intelligente con Domoticz
Lo scopo di questo documento è illustrare come configurare e collegare il controller Domoticz/Raspberry per ottenere un'istantanea sulla nostra app Telegram quando qualcuno suona il campanello.
La tensione a 12 V CA utilizzata per alimentare il campanello o il ronzio è collegata a un ingresso optoisolato sul modulo DomBus23 , quindi quando il campanello/ronzio viene alimentato, viene inviato un trigger a Domoticz che attiva uno script per catturare un'immagine dalla telecamera IP e inviarla a un canale o gruppo Telegram , in modo che i membri della famiglia possano ricevere la foto sui loro smartphone non appena qualcuno preme il pulsante del campanello .
Per ottenere la versione più aggiornata, consultare la versione inglese di questa pagina.
Esempio hardware utilizzando un modulo DomBus
DomBus23 è dotato di numerosi ingressi e uscite e può essere utilizzato per svolgere altre funzioni, come ad esempio l'apertura di un cancello pedonale o di un portone d'ingresso (dispone di 2 uscite a relè), gestire una luce di cortesia con striscia led con funzione dimmer (dispone di un mosfet da 30V 12A), ....
Se il campanello utilizza un'alimentazione a 230 V CA o 110 V CA, è possibile collegare il cicalino/buzzer all'ingresso optoisolato IN3, che supporta tensioni elevate.
I moduli DomBus sono progettati per avere un consumo energetico molto basso, inferiore a 10mW, e ottenere una connessione molto affidabile al controller domotico tramite bus RS485 (semplice cavo schermato con 4 fili, 2 per i dati e 2 per l'alimentazione a 12V). Utilizzando un alimentatore a 12V con batteria di backup al piombo, è possibile far funzionare il sistema anche in caso di interruzione di corrente.
Configurazione software
Si presuppone che Domoticz sia già installato su un computer, come Raspberry PI o un altro computer a scheda singola, oppure su un PC/Mac.
I moduli DomBus sono collegati al computer domotico tramite un adattatore USB/RS485 e un alimentatore da 12V.
Selezionare il dispositivo di input IN1 sul pannello Domoticz Switches e specificare lo script da attivare quando suona il campanello.
Scarica gli script sendsnapshot.sh e telegramSendText.sh da GitHub e inseriscili nella directory DOMOTICZ/scripts.
Modificare quei file per impostare i parametri IPCam e Telegram.
Istantanea da una telecamera Reolink
Abilita il servizio HTTP, porta 80, sulla tua telecamera Reolink, crea un utente che possa solo visualizzare la telecamera (chiamalo viewer o in un altro modo) e usa il seguente URL per scaricare un'istantanea jpeg:
http://192.168.XY/cgi-bin/api.cgi?cmd=Snap&channel=0&user=viewer&password=PASSWORD'
dove 192.168.XY è il numero IP della telecamera, viewer è il nome dell'utente creato con la PASSWORD associata.
Sostituisci channel=0 con channel=1 se hai una doppia telecamera, come Reolink TrackMix, e vuoi vedere il secondo canale.
Come interrogare la telecamera ONVIF per ottenere l'URI del flusso video e dello snapshot
Alcune pessime telecamere IP ONVIF cinesi non hanno un URI snapshot: molto male, ma possiamo generare uno snapshot dal flusso video, usando ffmpeg!!
ONVIF è un protocollo standard per interrogare le telecamere IP ONVIF, quindi è possibile ottenere le caratteristiche della telecamera IP inviando alcune query utilizzando il sistema SOAP.
Un ottimo tutorial per rilevare l'URI di video e snapshot della tua telecamera ONVIF può essere trovato su http://me-ol-blog.blogspot.com/2017/07/getting-still-image-urluri-of-ipcam-or.html
Come ottenere un token Telegram e un chat_id, necessari per inviare messaggi/immagini tramite Telegram
Telegram è un sistema di messaggistica istantanea molto potente, simile a WhatsApp, ma molto migliore perché open source, multipiattaforma (non solo per smartphone... Telegram Desktop funziona su Linux, Mac, Windows!) e altamente personalizzabile tramite la sua API.
Le seguenti istruzioni possono essere utilizzate per ottenere una foto su Telegram quando qualcuno preme il pulsante del campanello.
Di seguito le istruzioni dettagliate per creare un BOT su Telegram e un canale tramite cui inviare notifiche a te e ad altre persone:
- ovviamente devi avere Telegram installato sul tuo smartphone, e anche Telegram Desktop sul tuo PC/Mac/Linux: puoi scaricarlo da https://desktop.telegram.org/
- cerca BotFather nella tua lista dei contatti, selezionalo e avvialo
- tipo /newbot
- digita un nome per questo bot, ad esempio domApi
- digita un nome utente che termina con "bot", ad esempio domApiUserbot
- a questo punto, BotFather ti restituirà una chiave API (sotto un esempio in grassetto) che dovrai memorizzare da qualche parte:
784324329:EETRNJU3jQEGWQdjNv3llb4bnDSDREGuuL - Ora, utilizzando il tuo smartphone, crea un nuovo canale (non gruppo: canale!), seleziona un nome per esso (ad esempio Domoticz), impostalo come pubblico e specifica un collegamento per esso (deve essere univoco), ad esempio t.me/dom123abc
Tieni presente che solo il proprietario del canale può configurare il canale come pubblico!
Aggiungi membri a questo canale: il tuo partner, i tuoi figli, tutti coloro che dovrebbero ricevere le notifiche domotiche - Entra nel canale e aggiungi un nuovo amministratore: seleziona il bot che hai appena creato nei passaggi 3-6 (cerca domApiUserbot o il nome utente digitato nel passaggio 5)
- Aggiungi a quel canale tutti gli altri utenti che vuoi, se hai bisogno di inviare immagini/notifiche a quegli utenti.
- Apri il seguente URL dal tuo browser (sostituisci la chiave API con la tua e channellink con la tua):
Italiano: https://api.telegram.org/bot 784324329:EETRNJU3jQEGWQdjNv3llb4bnDSDREGuuuL /sendMessage?chat_id=@ dom123abc &text=test - Otterrai un output come quello nell'immagine seguente: memorizza da qualche parte l'ID ( -1001194779203 , in questo esempio): questo è l'ID del tuo canale, dove domoticz deve inviare le notifiche, e devi scriverlo (con il segno meno, se esiste) nello script sendsnapshot.sh qui sotto (variabile TELEGRAMCHATID).
- Da Telegram sul tuo smartphone, configura il canale creato impostandolo come tipo di canale Privato.
- Su Domoticz, vai su Interruttori, seleziona l'ingresso del pulsante del campanello, Modifica e scrivi nella casella di testo "Su azione" script://sendsnapshot.sh : in questo modo, ogni volta che qualcuno preme il pulsante del campanello, Domoticz eseguirà lo script sendsnapshot.sh che catturerà uno snapshot dall'IPCam e lo invierà al canale Telegram, così ogni utente che hai inserito in quel canale riceverà la foto delle persone che hanno suonato il campanello.
- Categoria: Domotics
Si prega di consultare la versione inglese per ottenere la pagina più aggiornata con le istruzioni di installazione corrette!
Flessibilità del sistema di alimentazione
Secondo l'Agenzia Internazionale per l'Energia, la flessibilità di un sistema energetico si riferisce alla "misura in cui un sistema energetico può modificare la produzione o il consumo di elettricità in risposta alla variabilità, prevista o meno".
In altre parole, tutti gli utenti sono invitati a consumare più energia quando è disponibile, risparmiando energia quando non lo è . Questo è un bene soprattutto per gli elettrodomestici che possono essere attivati manualmente, come lavatrici e lavastoviglie , e molto di più per i dispositivi che sono in grado di accumulare energia, come pompe di calore, caldaie, veicoli elettrici .
Per gli utenti italiani sono disponibili i seguenti canali Telegram attraverso cui ricevere ogni giorno il grafico con i prezzi dell'energia elettrica: è un sistema molto più comodo rispetto al collegamento al GME (mercatoelettrico). Inoltre, la tabella sottoriportata indica il link al file da scaricare quotidianamente, dopo le 15.10, contenente i prezzi orari e il prezzo medio del giorno successivo: in questo modo può essere facile creare delle automazioni nella propria domotica al fine di gestire i carichi in modo intelligente, implementando la flessibilità energetica.
- https://t.me/PrezzoZonaleNord per il Nord Italia
- https://t.me/PrezzoZonaleCentroNord per il Centro Nord Italia
- https://t.me/PrezzoZonaleCentroSud per il Centro Sud Italia
- https://t.me/PrezzoZonaleSud per il Sud Italia
- https://t.me/PrezzoZonaleCalabria per la Calabria
- https://t.me/PrezzoZonaleSicilia per la Sicilia
- https://t.me/PrezzoZonaleSardegna per la Sardegna
Per gli utenti europei che utilizzano il sistema di domotica gratuito Domoticz , è possibile installare lo script descritto di seguito, che ottiene automaticamente i prezzi orari dell'elettricità per la loro zona, calcola il prezzo reale dell'energia elettrica in base alla tariffa del proprio fornitore, e fornisce inoltre le previsioni di produzione di energia solare nel caso in cui dispongano di uno o più impianti solari fotovoltaici.
Nuovo su Domoticz? Dai un'occhiata a questa pagina!
Prezzi dell'elettricità dal portale Entso-e (per i paesi europei)
Il portale Entso-e UE consente di conoscere il prezzo dell'elettricità del giorno prima per i paesi e le sottozone europee, utile per chi vuole risparmiare denaro e contribuire alla stabilizzazione della rete elettrica ricaricando l'auto elettrica quando il prezzo dell'elettricità è basso e controllando la pompa di calore e le caldaie per ridurre i consumi quando il prezzo dell'elettricità è alto.
Lo script LUA_time_entsoe.lua per Domoticz, disponibile in https://github.com/CreasolTech/domoticz_lua_scripts , consente di
- definisci la tua zona di offerta (ad esempio Germania, Paesi Bassi, Italia settentrionale, ...)
- ricevi ogni giorno, nel pomeriggio, i prezzi del giorno successivo, ora per ora
- salva i prezzi orari dell'elettricità in una variabile utente (valori separati da ";") con il prezzo medio alla fine (totale 25 valori)
- aggiornare un contatore generale in modo da poter avere un grafico giornaliero, settimanale, mensile e annuale con la potenza dei grafici e dei report Domoticz.
- calcolare il costo reale dell'energia, come una funzione lineare Costo=(Prezzo+spread)*MULTIPLY_FACTOR+OFFSET, e aggiornare un conteggio generale con quel costo orario
Perché una variabile? Perché è facilmente accessibile da qualsiasi script/automazione per decidere quando attivare i carichi e come controllare la pompa di calore, la caldaia, la ricarica dell'auto elettrica, ...
Ad esempio, se la pompa di calore consente di impostare la potenza massima, è possibile impostare la potenza massima della pompa di calore proporzionale a prezzo_medio/prezzo_corrente o, ancora meglio, a (prezzo_medio/prezzo_corrente)² .
Installazione
cd DOMOTICZ/scripts/lua
git clone https://github.com/CreasolTech/domoticz_lua_scripts
# verrà creata una nuova cartella denominata domoticz_lua_scripts, all'interno di tutti i file
cd domoticz_lua_scripts
# copia i file
cp script_time_entsoe.lua globalvariables.lua globalfunctions.lua ..
cd ..
globalvariables.lua contiene la configurazione utente: nota che molte variabili al suo interno sono utilizzate da altri script, quindi puoi modificare solo ciò di cui hai realmente bisogno
globalfunctions.lua contiene diverse funzioni utili che possono essere chiamate dagli script
script_time_entsoe.lua contiene alcuni parametri di configurazione, nella parte superiore: i parametri possono essere spostati in globalvariables.lua se necessario, in questo modo sarà possibile aggiornare lo script senza la necessità di riconfigurarlo. Inoltre, lo script contiene tutti i comandi per recuperare i dati da Entso-e e creare le variabili, i grafici, ...
Per aggiornare lo script, cd nella directory domoticz_lua_scripts ed eseguire il comando git pull quindi cp script_time_entsoe.lua ..
Previsione della produzione di energia solare fotovoltaica
Lo stesso script sopra riportato può anche recuperare le previsioni di produzione di energia solare per uno o più impianti fotovoltaici, combinando insieme l'energia per ottenere una previsione accurata della produzione di energia.
La previsione può essere utile ad esempio per decidere se tenere accesa la pompa di calore/caldaia durante le ore di punta (quando il prezzo dell'elettricità è alto) oppure spegnerla perché nelle ore successive avremo una buona produzione solare.
Lo stesso vale per la ricarica delle auto elettriche: un'automazione può decidere se ritardare la ricarica perché prevediamo un'enorme produzione fotovoltaica nelle prossime ore.
Lo script permette di definire uno o più sistemi fotovoltaici, definendo per ogni stringa i kWp e l'orientamento , in modo da ottenere una previsione accurata : il sistema tiene conto delle previsioni meteo per la località selezionata (coordinate).
Lo script scrive due variabili utente , contenenti le previsioni di energia oraria e totale per oggi e domani .

- Categoria: Domotics
Introduction
DomBus modules use RS485 serial bus to communicate: with a 4 wires shielded cable (common alarm cable with 2*0.50mm² + 2*0.22mm² wires inside) it's possible to carry both data and 12Vdc power supply. RS485 can work with up to 1km of cable, using the terminating 100-150 Ohm resistors on the ends of the bus : you can find the terminating resistor in each DomBus module, and it should be enabled through the PCB jumper in the two furthest modules.
DomBus modules are really low power consumption, less than 10mW with no outputs active, so it's possible to supply dozens of modules with no problem. Also, DomBus31 module that has 8 relays, consumes only 600mW when all relays are ON. We believe that power optimization is important: many wifi modules consumes more than 1Watt each, but 1W means more than 8 kWh/year for each WiFi module!
How to build the home automation system
Choose a reliable power supply for the bus: we suggest to use a 13.5V power supply unit with lead-acid battery charge feature. Power supply should be strong enough to supply domotic bus, network switches and routers, IPCams and NVR, ... , so the whole system can work even in case of power outage.
Choose a low power domotic controller: for small system you can use Rock PI S , which consumes only 0.4W, or Raspberry PI that is powerful (more ram, higher CPU speed) that consumes 2.3W. Kits with ready to use operating system and software are available from store.creasol.it
Choose a reliable power supply for the domotic controller, if used: the best solution is a a DC/DC converter with Type-C or MicroUSB connector, supplied by the 13.5V power source, so the domotic controller is protected from blackout.
Connect the domotic bus data to a RS485/USB adapter, and supply wires to the 13.5V power supply through a fuse. Use RS485 cables or, alternatively, common alarm shielded cables: 2x0.22mm² for data and 2x0.5mm² for Vbus supply. Connect the shield to GND only on one side.
In any room where you have to measure temperature and humidity, place a DomBusTH module: it is very compact and can be mounted on a blank cover with a 3-4mm hole in the center. It also has red/green leds (that can be used for notifications, like alarm on/off, import/export power, ...), white led (that can be used for notifications and as blackout emergency light), 1x analog input to monitor Vbus, 4x I/Os (that can be connected to switches, pushbuttons, dual buttons, buzzer, energy/gas/water meters with pulsed output, alarm sensors, ...) and 2x open-drain outputs (that can be connected to the DomRelay2 module to get 2 relay outputs to command lights, roller shutter motors, appliances, ...).
If you need to interface a gate or garage door, you can use DomBus23 module, that has 2x relay outputs (to send open/close/pedestrian commands), 2x low voltage optoisolated inputs (to be connected to photocell power supply or 12/24V light indicating the gate state), 1x 115/230V optoisolated input (to be connected to 230V flash lamp, if needed to get status from this output, or can be used to monitor power outages). Also, DomBus23 has 1x 12-24V 10A mosfet output (can be used to supply a 12/24V led stripe, with dimming function), 2x analog outputs 0-10V (can be used to regulate the heat pump power, valve, or other appliances with 0-10V input, as like as other led dimming modules), and 2x I/Os.
If you need several inputs for alarm sensors (magnetic contact sensors and PIRs), you can use the compact DomBus12 module that has 7x I/Os (configured as digital inputs, analog inputs, twinbuttons, counters, buzzer outputs, ...) + 2x open-drain outputs (that can be connected to external DomRelay2 module to get 2 relay outputs, or can be configured as digital inputs through PCB jumpers to have totally 9 inputs).
If you want to make a homemade alarm system and need more inputs and also some outputs, you can use DomBus37 module that has 12x low voltage inputs, 3 AC inputs (100-250Vac) and 3 relays outputs.
- If you need several relay outputs, you can use DomBus31 module that has 6x relays with 5A 250V SPST capability and 2x relays with 10A 250V SPDT capability (terminal block with both normally-open and normally-closed outputs). This is very low power consumption module, that consumes less than 500mW with all 8 relays ON!
If you need more relays, we have DomBus36 module that has 12 relay outputs in 3 groups: 1 common + 4 relays for each group, to get easy and quick wiring!
Use DomBusEVSE module to charge the electric car: you can select how much power to get from the grid, from 0% (use only photovoltaic power) to 100% (use all available power) preventing overloads and disconnections.
- Any energy, gas or water meter with pulsed output can be connected to DomBus12, DomBus23, DomBus32, DomBus34 and DomBusTH I/Os.
- Up to 4 Modbus energy meters type DDS238-2 ZN/S can be connected to DomBus34 module and DomBusEVSE module, to measure imported/exported power and energy, voltage, frequency and power factor.
Use DomBus33 module to manage a light system that uses pushbutton switches that activate step-by-step relays: DomBus33 permits to know the status of the light and control the step-by-step relay coils to toggle, switch on and switch off lights, with the ability to have a button to switch all lights off (or a simple automation that switch off lights when alarm is activated in AWAY mode).
If you're renovating your house don't forget to:
- install magnetic contact sensors on windows, doors, blinds, external and internal sirens, external PIRs or RF radars: using Domoticz it's possible to build a complete alarm system with full notifications (text, pictures, small videos) in Telegram
- install at least one IP cam oriented to the main gate , so you can receive a picture in your smartphone (Telegram) when somebody push the door bell button,
- do not install thermostats to control room temperature: it's much better to install temperature sensors in each room (DomBusTH module) and let Domoticz controls the heater or heat pump : in this way it's possible to overheat (in Winter) or overcool (in Summer) the house when extra power is available from photovoltaic
For any questions please contact us by DomBus Telegram group https://t.me/DomBus , or by email to
What building automation controller?
DomBus modules are provided with two protocols of your choice:
- DomBus protocol, very powerful multimaster protocol that works only with Domoticz controller and permit to have DCMD functions, commands exchanged between modules that permit to get simple automations that works wihtout the need of the domotic controller, like KNX.
In this case you have to install the Creasol DomBus plugin, by using the Python Plugin Manager or downloading it from GitHub - Modbus RTU standard protocol that works with almost any home automation system, like Home Assistant, OpenHAB, Node-RED, ...
In this case you have to install the Modbus integration. More info at the https://www.creasol.it/HomeAssistant page
Some application notes
Let's start!
If you have a Creasol domotic kit, you already have a Single Board Computer (Raspberry, Rock PI, ...) used as domotic controller within the operating system, Domoticz and DomBus already installed and ready to be used, else you have to check documentation to install the operating system and Domoticz on your device.
Connect one DomBus module to the controller, by using a RS485/USB adapter: DomBus modules are usually supplied at 13.5V: in Domoticz, enter the Switches panel and find the last device, named for example dombus - [ff51.1] OUT1 . ff51 is the default address for this module: change module address to get all module ports visible!
To change the module address, click Edit and add to its Description field HWADDR=0x0001 for example, where 0x0001 is the address (in hex format) assigned to that module. Module address must be unique! Click on Save button, refresh the page and all ports for that module will be available. Configure port name and type by click on Edit button, modifying the Name and Description.
For example, to configure a port as digital input, write IN_DIGITAL in the Description field (replacing existing port configuration, like IN_TWINBUTTON or IN_ANALOG .....). Check the module documentation to know, for each port, the supported configurations.
Check the complete alarm system using Domoticz to know how to name PIR/Contact/Sirens devices if you'd like to use our free scripts to realize a complete burglar alarm system with notifications by Telegram, short video when alarm sensors activate, lights randomly ON during the night in away modes, ...
- Categoria: Domotics
Breve lista di controllo per realizzare da soli una stazione di ricarica utilizzando il modulo Creasol DomBusEVSE
Seguendo le istruzioni riportate di seguito è possibile realizzare una stazione di ricarica per veicoli elettrici che controlli il consumo di energia elettrica per evitare sovraccarichi, disconnessioni e anche per utilizzare solo energia proveniente dal fotovoltaico. Il modulo DomBusEVSE, una volta programmato, può funzionare da solo, in modalità stand-alone, senza la necessità di un controller domotico .
- Assicurati di sapere cosa stai facendo: devi avere conoscenze sulla dissipazione di potenza e sui sistemi elettrici . Devi essere un elettrotecnico per realizzare da solo una wallbox!
- È inoltre necessario avere alcune conoscenze informatiche e sapere cosa sono i sistemi domotici e il protocollo Modbus .
- Il modulo DomBusEVSE è il controller EVSE che permette di comunicare con il caricabatterie di bordo del tuo veicolo, per la ricarica AC, monofase e trifase : scegli la versione DomBusEVSE adatta alle tue esigenze:
- con protocollo proprietario DomBus , funzionante con Domoticz ,
- con protocollo standard Modbus funzionante con Home Assistant , Node-RED , OpenHAB e molti altri sistemi di automazione domestica.
- Di seguito sono riportati gli schemi per il cablaggio monofase e trifase : sono necessari almeno un interruttore differenziale (protezione) e un contattore 2P o 4P, il cavo EV e l'adattatore RS485/USB (o RS485/TCP). I componenti sono disponibili nel nostro store , disponibili anche in KIT , ma essendo standard li potete trovare ovunque.
- È preferibile utilizzare cavi da 10mm² per 32A e cavi da 6mm² per scatola a muro da 16A, per ridurre al minimo la dissipazione di potenza sui cavi. I collegamenti devono essere controllati periodicamente per garantire che le viti siano ben serrate in modo che i terminali non si surriscaldino dopo 15 minuti o più alla massima potenza di carica!
- Se disponi di un sistema domotico con contatore di energia di rete collegato al controller domotico, che misura la potenza di rete (negativo nel caso in cui tale potenza viene esportata in rete), non hai bisogno di un altro contatore collegato al modulo EVSE: basta effettuare una semplice automazione che invia periodicamente la corrente di rete al modulo EVSE (ogni 1-6s).
- Un misuratore di potenza/energia che misuri la potenza/energia di ricarica del veicolo elettrico non è strettamente necessario, ma consigliato. DomBusEVSE supporta DDS238-2 ZN/s (monofase) e DTS238-4 ZN/S (trifase).
- I bus RS485 richiedono almeno 1 resistenza di terminazione (100-150 Ohm), e molto meglio una resistenza a ciascuna estremità del bus: per il bus EVSE-domotico, è possibile abilitare la resistenza cortocircuitando il ponticello Rb PCB. Per i contatori di energia EVSE, la resistenza è già abilitata all'interno del modulo EVSE.
Ulteriori informazioni:
- Informazioni sul modulo DomBusEVSE
- Negozio Creasol con alcuni prodotti per veicoli elettrici
- HomeAssistant: Configurazione di DomBusEVSE
- HomeAssistant: Utilizzo dei moduli DomBus con HA
- Node-RED: Configurazione di DomBusEVSE
- Domoticz: Configurazione di DomBusEVSE
Schema della stazione di ricarica per veicoli elettrici wallbox monofase fatta in casa
Schema della stazione di ricarica per veicoli elettrici wallbox trifase fatta in casa
Dashboard Node-RED per la tua wallbox fatta in casa utilizzando il modulo DomBusEVSE
Cruscotto Home Assistant per la tua wallbox utilizzando il modulo DomBusEVSE
- Categoria: Domotics
Utilizzo di un sensore di flusso d'acqua con moduli DomBus
I sensori di flusso d'acqua sono utili per misurare il consumo di acqua fredda e calda . Alcuni sensori del flusso d'acqua si basano su un sensore Hall per misurare la rotazione del rotore interno, generando impulsi fino a 100-200 Hz.
I sensori di flusso d'acqua Hall non sono sensori sensibili, soprattutto se realizzati in ferro come quello mostrato in figura, quindi suggeriamo di scegliere misuratori con la migliore sensibilità, ad esempio 1-30 l/min, utilizzando materiale in ottone : fare attenzione che se il flusso la velocità è inferiore a 1 litro al minuto, il sensore emetterà 0 impulsi!
I moduli DomBus sono in grado di funzionare con sensori ad alta velocità, generando fino a 500 impulsi/secondo , sono ottimizzati per un consumo energetico molto basso e solitamente hanno molte porte versatili che possono essere configurate come ingressi, uscite, contatori, sensori, ...
L'immagine sotto mostra come DomBus37 è stato collegato ad alcuni sensori di temperatura, sensori di allarme, sensore di flusso d'acqua e contatori di potenza/energia.
Utilizzo del misuratore di portata d'acqua, sensori di temperatura, contatori di energia con DomBus37 e Domoticz
Quando si utilizzano i moduli DomBus con Domoticz, (in questo caso, modulo DomBus37 programmato con protocollo DomBus), è necessario configurare:
- Sensori di temperatura NTC (10k a 25°C, B=3950) come IN_ANALOG,FUNCTION=3950 ;
- il misuratore di portata dell'acqua è configurato come IN_COUNTER,A=0,0025 (400 impulsi per litro) con parametro divisore=1000 per convertire da litri a m³;
- contatori di potenza/energia (DDS238-2) come IN_COUNTER,TYPENAME=kWh,DIVIDER=2000
- Categoria: Domotics
This page shows how to make a new fresh image with Raspbian+Domoticz+firewall+backup. Raspbian + Domoticz, updated on 2022-06-10
If you prefer to purchase a high quality SD already programmed, visit our shop.
Writing an image for Raspberry
We're proposing a quick solution to install a pre-configured image of Raspbian for Raspberry PI3 or PI4, completed with latest Domoticz software and configured to preserve MicroSD flash device (flash cannot be safely written more than 10000 times) and exporting a weekly backup that can easily restored in case of problems.
This image was tested on both Raspberry PI3 and Raspberry PI4 hardware, and uses the last Raspbian Buster distribution.
Flashing this image in a microSD, you are immediately ready to configure your Domoticz devices from the web interface.
Image is available at http://dl.creasol.it/raspberry_domoticz_0x12345678.fsa and can be installed from linux or another raspberry using the raspberry_domoticz.sh script; Windows users can use putty to connect their raspberry by SSH protocol, and winscp or filezilla to transfer files between their windows PC and raspberry. Linux users can use their PC to make the copies.
Features
- Works with both Raspberry PI4 and Raspberry PI3
- Raspbian Buster + a recent version of Domoticz
- Optimized to reduce writing on flash: /tmp and /var/log are in ramfs, not SD, and swap is disabled. Domoticz temporary files are written in /tmp, not in SD, extending in this way the memory life
- Firewall with iptables/netfilter, that can be configured editing /usr/local/sbin/myfirewallpi.sh
- Backup that automatically create an incremental backup of files changed; one day per week do a full backup and one day per month do a image creation; backup can be easily exported to an attached USB hard disk or NAS (FTP or CIFS).
- Domoticz is partially configured with some devices and with Creasol Dombus plugin already installed (Domoticz plugin to use Creasol DomBus devices attached to the Raspberry by a RS485 serial bus).
Extracting the image to a microSD
Connect the microSD to a Linux computer or to Raspberry (using a USB memory reader).
Run the following commands to download the raspberry image from our website and extract it on the SD. Windows users can connect to their raspberry console using putty
[code]#become root
sudo su -
#download the image creation/restore script
apt update
apt -y install curl
curl -o /usr/local/sbin/raspberry_domoticz.sh http://dl.creasol.it/raspberry_domoticz.sh
chmod 700 /usr/local/sbin/raspberry_domoticz.sh
#donwload the image
cd /
curl -o /raspberry_domoticz_0x12345678.fsa http://dl.creasol.it/raspberry_domoticz_0x12345678.fsa
#and now start the raspberry_domoticz.sh script
raspberry_domoticz.sh
[/code]
then the raspberry_domoticz.sh script will guide you to write the image /raspberry_domoticz_0x12345678.fsa on a microSD connected to domoticz by a SD memory USB reader.
This is the output of raspberry_domoticz.sh script, in bold the text written by the user:
Would you like to create an image of the SD [SD => IMAGE] (Y/n/ctrl-c)
n (no, don't need to create an image, I need to extract an image!)
Would you like to write an image to new SD [IMAGE => SD] (Y/n/ctrl-c)
y (yes! extract an image to SD)
========== List of attached devices: ==========
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 1.9G 0 disk
`-sda1 8:1 1 1.9G 0 part
mmcblk0 179:0 0 58.3G 0 disk
|-mmcblk0p1 179:1 0 400M 0 part /boot
|-mmcblk0p2 179:2 0 4.9G 0 part /
`-mmcblk0p3 179:3 0 24.4G 0 part
Write the name of USB device where image have been placed (for example sda1)
mmcblk0p2 (write the name of device corresponding with root filesystem, where the image was downloaded, or the device containing the image, for example a usb drive)
========== List of files in the selected device ==========
total 508712
....
-rwxr-xr-x 1 root root 520823743 Feb 26 17:39 raspberry_domoticz_0x12345678.fsa
drwx------ 4 root root 4096 Feb 26 17:37 root
...
Write the image filename
raspberry_domoticz_0x12345678.fsa
========== List of attached devices: ==========
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 31.1G 0 disk
`-sda1 8:1 1 31.1G 0 part
mmcblk0 179:0 0 58.3G 0 disk
|-mmcblk0p1 179:1 0 400M 0 part /boot
|-mmcblk0p2 179:2 0 4.9G 0 part /mnt/img
`-mmcblk0p3 179:3 0 24.4G 0 part
Write the name of FLASH device to be written (example sdb)
sda (disk device connected to raspberry or PC, with the microSD card)
If you want to translate texts of raspberry_domoticz.sh in a different language, just modify the script adding the corresponding lines text[LANG,NUMBER] : it's very intuitive. Please send to
Access and configuring Raspberry with the programmed image
These are the default credentials for this image:
linux user: pi , password: arangingenni
linux user:root , password: geriandallse
domoticz user: domoticz , password: creasol
It's recommended to change these default passwords!!
Starting raspberry with this image, it will get network configuration from your DHCP server (router), so you can connect it by the browser at url like http://192.168.1.123:8080 (check your dhcp server to get the IP address assigned to raspberry, or do a network scan of your LAN). If you connect raspberry from 192.168.*.* or 172.16.*.* or 10.*.*.* networks, no authentication is required.
Also, ssh service is enabled, so you can enter secure shell (using ssh, putty or any other ssh client) as user pi or root.
How to create an image from Raspberry SD
We've written the bash script raspberry_domoticz.sh (see above) that permits to save a copy of Raspberry memory to a USB drive, and also create new SD with the content of a saved image.
This is useful because:
- flash memory cannot be written forever: normally each flash cell can be written up to 10000-100000 times. The proposed image is optimized to limit SD writes.
- it's always a good idea to have a backup of the running raspberry, so in case of problem it's possible to restore system from an old image
- maybe you need to clone an existing SD and keep images on your PC or NAS
Features:
- images are compressed... it's stupid to have a 16GB image for a 16GB almost-empty SD !!
- images can be restored on different SD sizes, so it's possible to use the same image to write SD card with 32GB size or 8 GB size as well
- creating and restoring an image is really fast, in comparison to other systems
Unfortunally, this system does not work in Windows, but... who are still using windows at these days? Everything is moving to Linux! Android is Linux. Rasbian is Linux. Your routers, access points, TV most probably use Linux operating system! ;-)
Click to download the raspberry_domoticz.sh script, save it to a executable directory on your linux system (e.g. /usr/local/sbin ) and give it the execute permissions.
Run raspberry_domoticz.sh and follow the instructions to create a compressed image from raspberry SD. It works also in live mode, directly from the working linux system, with a high probability of success.
Do you want more? Presentation of the highly reliable DomBus
Frequently Asked Questions FAQ
Some useful commands
ps ax |grep domoticz : lists all active processes showing only the ones with name domoticz
netstat -lnp |grep domoticz : shows the TCP/UDP ports used by domoticz (normally it uses the port 8080)
lsusb : lists devices connected to USB. lsusb -v shows details on USB devices
How to configure raspberry GPIOs
With this raspbian image, GPIOs can be configured editing /etc/rc.local file and setting the needed gpio as out (if output), in if input, or both if bidirectional.
[code]#/etc/rc.local file
#setting gpio using wiringpi tool:
#syntax: gpio export GPIONUMBER out|in|both to set as output, input or I/O
gpio export 24 out # Set as output.
gpio export 23 out
gpio export 22 out
gpio export 27 out
gpio export 18 out
gpio export 17 out
gpio export 25 out #lightOut2
gpio export 8 out #lightOut3
gpio export 7 out #lightOut4
gpio export 12 out #lightOut1[/code]
After edited, type /etc/rc.local to reload the script.
How to update the Creasol DomBus plugin to the latest version?
Just type, from root shell, the command creasoldombus_update.sh
How to configure a static IP for the Raspbian ethernet interface?
Edit the file /etc/dhcpcd.conf ( nano /etc/dhcpcd.conf ) and add the following lines at the end:
interface eth0
static ip_address=192.168.1.250/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8
and save with ctrl-x.
The raspberry cannot be connected by ssh (22 port) or http (8080 port)
Assure that LAN cable is connected to raspberry, and that a DHCP server can assign IP parameters to it.
There's a firewall script installed, /usr/local/sbin/myfirewallpi.sh , that needs that eth0 interface is already configured by DHCP or static IP.
How much does Raspberry PI4 consumes?
As home automation systems were borned to reduce building environmental footprint, it's important to know if a Raspberry is a good hardware for a domotic controller or not, in terms of CPU power, stability, and also energy consumption.
Searching in the www it's possible to find only few articles describing the power consumption of a Raspberry PI, so the best way is to measure the power consumption in practice.
This is the hardware under test, a Raspberry PI4 with 1 GB of ram, connected to LAN and supplied by a DC power supply at 5V
Below, the value of current and voltage with Raspbian O/S measured when
1. at the left, with no any load (very low CPU usage), raspberry power consumption = 5V*0.42A=2.1W normal
2. at the right, with 100% load on the 4 cores, raspberry power consumption = 5V*0.63A=3.15W peak
Firewall configuration
How to enable the IP number that you want to access your raspberry/domoticz from outside?
Edit the firewall script with command nano /usr/local/sbin/myfirewallpi.sh and modify the ADMIN_SOURCE variable adding the IP addresses (or networks) you want to enable:
ADMIN_SOURCE='80.86.145.56/29 149.13.157.0/24 37.0.0.0/8'
where /24 means that the last number in IP address can be any from 0 to 255, and /8 means that only the first number is checked while the remaing 3 numbers can be any from 0 to 255.
Save file with CTRL-s and CTRL-x , then run the script typing /usr/local/sbin/myfirewallpi.sh
How to enable incoming connections to the web server in Raspberry?
Modify the firewall script with command nano /usr/local/sbin/myfirewallpi.sh , and add port 80 (http) or 443 (https) to the variable TCP_SERVICES_IN_wan
then save script (CTRL-s and CTRL-x) and run the firewall script with command /usr/local/sbin/myfirewallpi.sh
- Categoria: Domotics
Introduction
NodeMCU v3 is a very useful and powerful controller based on ESP8266 microcontroller with 2.4GHz WiFi, GPIO ports, analog input, I2C bus, UART and 1wire ports, equipped with a dual-in-line strip male connector.
It's a very cheap open-source platform, a bit expensive in terms of current consumption (normally 80mA @5V = 400mW), but very appreciated in home automations and Internet of Things.
Using the ESPEasy firmware, it's possible to combine this card with Domoticz/raspberry home automation controller.
Creasol has designed the DomESP1 board that permits to easily supply the NodeMCU board by a switching mode regulator, and connect inputs, outputs, I2C and 1wire sensors/devices (e.g. DS18B20 thermal and other humidity sensors) by terminal blocks. The board, as shown in the picture, has 4 relay outputs with 5A 250V switching capaibility, and all circuitry to manage I2C bus, 1wire bus, ....
A LED on every input and output permits to check the status of the board and found any problem on wire connections or firmware configuration: LEDs are enabled by pressing the button Test .
The LEDs enable feature and the switching mode power supply lead to a full control of inputs/outputs with an optimized power consumption.
It's possible to purchase:
- the plain DomESP1 board: the client should purchase and program by himself the ESP8266 module, 900 mil header pitch;
- the DomESP1 board, with the ESP8266 module already programmed with the latest ESPEasy firmware.
Installing firmware on NodeMCU board and first configuration
- On Linux, install esptool: for Debian/Ubuntu/similar, run the command
apt update; apt install esptool - Download ESPEasy version 2.0.0 from https://www.letscontrolit.com/wiki/index.php/ESPEasy#Loading_firmware or clicking on https://github.com/letscontrolit/ESPEasy/releases selecting the last version available, and uncompress the zip archive: inside the bin directory you can find several images, read the README.txt to find out which image is for you. For LoLin modules with 4M of ram, a good image is bin/ESP_Easy_mega-20190813_test_core_242_ESP8266_4M.bin
- Connect the NodeMCU board to the PC using a microUSB cable
- Run the command to load the firmware:
on Linux you should install esptool and execute, from the shell,
/usr/bin/esptool --baud 115200 --port /dev/ttyUSB0 write_flash 0 ESPEasy_R120_4096.bin
on Windows or Mac, please read the instructions within the ESPEasy package
You should see on the console the following result:
esptool.py v2.5.0
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: b4:e6:2d:36:e7:d1
Enabling default SPI flash mode...
Configuring flash size...
Auto-detected Flash size: 4MB
Erasing flash...
Took 1.30s to erase flash block
Wrote 411648 bytes at 0x00000000 in 39.8 seconds (82.7 kbit/s)...Leaving...
Hard resetting via RTS pin... - Enable WiFi on a smartphone or PC, and connect to the SSID ESP_0 using the password configesp
- Set the SSID of the WiFi network where the device will be connected, and associated WiFi password, then click on Connect button.
- At this point, the device will be associated to the selected WiFi network with the given SSID an password.
- Scan the network to find the IP address of the device, and connect to it using a browser: http://DEVICE_IP_ADDRESS
- Configure the main parameters:
- Set the GPIO default configuration:
- Configure devices (e.g. temperature sensors):
- If the two blue LEDs on the NodeMCU board are annoying you, you can remove them, of course: in this case you avoid extra power consumption for useless LEDs.
- Categoria: Domotics
introduzione
Abbiamo scritto un plug-in per Domoticz che comunica con i cloud Kia e Hyundai ricevendo informazioni dall'auto e consentendo anche all'utente di impostare alcuni parametri dell'auto (limiti di carica elettrica AC e DC, temperatura del clima, clima di avvio/arresto, ricarica di avvio/arresto, ....)
Istruzioni di installazione e ulteriori informazioni su https://www.domoticz.com/wiki/Vehicles_Hyundai_Kia
Vuoi creare la tua SMART WALLBOX?
Segui le istruzioni su https://www.creasol.it/EVSE per costruire da solo una Stazione di Ricarica Intelligente per ricaricare la tua auto, furgone o altro veicolo elettrico!!
Ricaricare l'auto elettrica utilizzando un modulo DomBusEVSE
Si tratta di una soluzione avanzata che utilizza il modulo EVSE (Electric Vehicle Supply Equipment) DomBusEVSE realizzato da Creasol , in Italia:
- rileva la connessione e la disconnessione della spina, avvia e interrompe la ricarica
- rileva allarmi dal veicolo e mancanza di alimentazione di rete
- interfaccia un contatore di energia bidirezionale per conoscere in tempo reale la potenza importata o esportata dalla rete e un altro contatore di energia per misurare la potenza e l'energia fornita al veicolo
- funziona in modalità stand-alone (non necessita di controller domotico) o gestita (corrente di carica selezionata dal controller domotico) con la seguente modalità di ricarica: OFF : ricarica disabilitata SOLAR : utilizza solo energia da impianto rinnovabile (potenza da rete = 0) 25% : max 25% di potenza disponibile da rete 50% : max 50% di potenza da rete 75% : max 75% di potenza da rete 100% : utilizza tutta la potenza disponibile da rete GESTITO: valore corrente impostato dal controllore domotico (automazione script per addebito personalizzato)
- operando in modalità GESTITA è possibile 1. impostare facilmente il livello minimo e massimo della batteria 2. impostare facilmente la corrente di carica massima 3. quando il livello della batteria è inferiore al minimo, caricare alla potenza massima consentita dal contatore elettrico (in Italia, alterna 90 minuti alla massima potenza + 27% e 90 minuti alla massima potenza + 10%, non è possibile caricare più velocemente! L'impianto elettrico deve essere controllato attentamente quando si utilizza la massima potenza, per evitare surriscaldamenti e incendi!!) 4. quando la batteria il livello è compreso tra il minimo e il massimo, caricare utilizzando solo energia da energia rinnovabile da fotovoltaico
Video che mostra la ricarica dei veicoli elettrici da parte di Domoticz
Prerequisiti e schema di collegamento
- veicolo elettrico con connessione cloud, per conoscere lo stato di carica della batteria (non obbligatorio, ma consigliato se utilizzato all'interno di un impianto domotico)
- Modulo Creasol DomBusEVSE
- contatore di energia bidirezionale, per il calcolo della potenza attuale importata ed esportata (opzionale, in caso di impianto fotovoltaico/eolico)
- interruttore automatico con protezione differenziale (blocco corrente residua) tipo B
- Contattore 2P (monofase) o 4P (trifase) per abilitare/disabilitare la ricarica
- Cavo EV 32A con spina di tipo 2 o tipo 1 su un lato
Clicca per vedere lo schema di collegamento per realizzare un caricabatterie per auto elettrica intelligente utilizzando il modulo DomBusEVSE!
Avvertenze
L'auto elettrica non è un aspirapolvere, che resta attaccato alla presa di corrente per 30 minuti!
Tieni presente che la dissipazione di potenza sui connettori (e sui cavi) viene calcolata come P=RI² dove R è la resistenza del connettore/filo e I² è il quadrato della corrente di carica.
Di conseguenza, quando la corrente di carica è elevata, è necessario controllare il sistema per evitare che collegamenti e cavi si surriscaldino e si brucino .
I nostri moduli domotici per Domoticz, Home Assistant, Node-RED, OpenHAB, ...
Siamo un'azienda italiana che progetta e produce dispositivi elettronici per sistemi di Domotica, fornendo un supporto completo.
Pensiamo che i moduli domotici debbano essere affidabili (collegati al bus, per evitare interferenze RF) e consumi molto bassi (normalmente 10-15mW ciascuno; il modulo con 12 relè consuma meno di 750mW con tutti i relè accesi: fare un confronto con altri dispositivi!)
Un edificio è intelligente solo se aumenta il comfort e riduce i consumi!
Consulta l'elenco dei nostri prodotti domotici su
https://www.creasol.it/domotica
https://store.creasol.it/domotica
Per qualsiasi supporto, entra nel gruppo Telegram DomBus
- Categoria: Domotics
Chiunque utilizzi un veicolo elettrico desidera ricaricare l'auto in modo intelligente :
- prevenire i sovraccarichi
- utilizzando solo energia da fotovoltaico , dalla primavera all'autunno
- massimizzazione del fattore di potenza per ottenere la massima efficienza di carica
- controllo e monitoraggio della ricarica tramite smartphone/tablet/PC
- integrando la wallbox nel sistema domotico , per ottenere un efficiente bilanciamento del carico e accumulare energia nell'auto quando il prezzo dell'energia è più basso.
DomBusEVSE è un modulo di ricarica disponibile con 2 protocolli:
- Protocollo DomBus (proprietario) per Domoticz
- Protocollo Modbus (standard) per Home Assistant , Node-RED , OpenHAB , ....
Funziona anche in modalità stand-alone , nel caso in cui il controller domotico sia offline.
Requisiti hardware per realizzare una stazione di ricarica fai da te per veicoli elettrici
Realizzare una stazione di ricarica fatta in casa è piuttosto semplice, ma è necessario conoscere i sistemi elettrici e le potenze: le sessioni di ricarica sono solitamente lunghe e bisogna fare attenzione a non surriscaldare connessioni e cavi.
Il modulo EVSE funziona in questo modo: misura la potenza prelevata dalla rete elettrica, invia all'auto un segnale PWM per impostare la massima potenza/corrente di carica tramite il filo Control Pilot e legge lo stato del veicolo tramite lo stesso filo.
Per realizzare una stazione di ricarica fatta in casa sono necessari i seguenti elementi (con link al nostro negozio, ma come dispositivi standard possono essere acquistati ovunque):
- DomBusEVSE , ovvero il regolatore di ricarica
- Protezioni: si consiglia un interruttore differenziale di tipo B (2P per monofase o 4P per trifase)
- Contattore , per abilitare l'alimentazione di rete (2P per monofase o 4P per trifase)
- Cavo EV
- Misuratore di potenza per misurare la potenza, l'energia, la tensione, il fattore di potenza del veicolo elettrico (facoltativo ma consigliato)
- Contatore di energia bidirezionale da posizionare nel quadro elettrico generale per misurare l'energia scambiata con la rete.
Se nell'impianto domotico è già presente un contatore per la misurazione della potenza di rete , non è necessario aggiungerne uno nuovo per realizzare la wallbox: è sufficiente una semplice automazione che invii il valore della potenza di rete al modulo DomBusEVSE.
Il misuratore di potenza per misurare tensione/potenza/energia/fattore di potenza/... EV è opzionale, ma consigliato. Può essere collegato alla porta DomBusEVSE, o al controller domotico, come preferisci.
Ulteriori informazioni su come realizzare la wallbox sono disponibili nella pagina DomBusEVSE .
Dettagli del firmware DomBusEVSE
Per maggiori informazioni sul funzionamento del modulo EVSE, consultare la pagina DomBusEVSE .
Hai bisogno di ulteriore supporto? Visita
Per supporto interattivo, contattateci tramite Telegram o Whatsapp.
Integrazione di DomBusEVSE in Home Assistant
Installare l'integrazione Modbus .
Recupera i file di configurazione dalla pagina github dedicata a DomBusEVSE e Home Assistant e mettili nella directory HA config. Puoi vedere i file di configurazione per diversi moduli, quindi devi abilitare ciò di cui hai bisogno e disabilitare il resto.
Se conosci l'inglese, ti preghiamo di controllare questa pagina in lingua inglese perché altre lingue potrebbero essere confuse dalla traduzione indesiderata dei nomi di alcuni parametri.
Tieni presente che:
- questo EVSE può essere configurato in " Modalità gestita " (un'automazione può impostare periodicamente il valore della corrente di carica, da 6 a MAXCURRENT): in questo modo l'EVSE diventa stupido e lascia che l'automazione esterna gestisca la carica e il bilanciamento attraverso diversi EVSE collegati allo stesso impianto elettrico.
- normalmente EVSE non è configurato in "Managed mode", ma può essere configurato in Off (non caricare), Solar (Grid power = 0), 25% (usa Grid power = 25% di MAXPOWER), 50% (usa il 50% di MAXPOWER), 75% e 100% (usa MAXPOWER dalla rete). Per funzionare correttamente, devi:
- collegare un misuratore di potenza supportato (DDS238-2 ZN/S per monofase, DTS238-4 ZN/S o DTS238-7 ZN/S per trifase) programmato con slave-address=3 e connesso alla porta Modbus aggiuntiva dell'EVSE
- se hai già un contatore di potenza/energia collegato al sistema domotico, usa una semplice automazione per scrivere la potenza attuale (in Watt) scaricata dalla rete (negativa se proveniente dalla rete) nell'entità Grid Power. Un esempio è disponibile nel file dombus/dombusevse/dombusevse_automations.yaml La potenza della rete dovrebbe essere scritta ogni 2-6 secondi durante la sessione di ricarica.
Per ulteriore supporto, entra nel gruppo Telegram DomBus .
Wallbox monofase fatta in casa
Wallbox intelligente trifase fatta in casa
Wallbox fai da te realizzata da SCiunczyk , con capacità di commutazione monofase-trifase e adattatore WiFi/Modbus
Il progetto, che utilizza il nostro modulo EVSE connesso tramite convertitore WiFi/RS485 fatto in casa con firmware ESP32 + ESPHome, è descritto nella pagina GitHub https://github.com/SCiunczyk/wallbox-diy e consente di caricare un veicolo elettrico utilizzando alimentazione monofase (bassa potenza, da 1 kW a 7 kW, generalmente utilizzata in modalità solare) e trifase (utilizzata per caricare il veicolo a piena velocità, da 4 kW a 22 kW).
Grazie a Slawomir per aver condiviso informazioni sulla sua wallbox intelligentissima!
Maggiori informazioni su https://www.creasol.it/EVSE
- Categoria: Domotics
We'd like to describe some solutions to measure the energy consumed and produced by the building using Domoticz home automation system and energy meters like DDS238 and SDM120, SDM230 (single phase), SDM630 (threephase).
Having information about the used/produced power is useful to correctly manage loads (or heating/cooling system, electric vehicle charging, ....) in the right way, maximizing the own-produced energy from photovoltaic plant.
Solution 1: interfacing any energy meter with pulsed output using a DomBus module
This solution works with any kind of energy meter with pulsed output.
Normally, energy meters have 1 or 2 pulsed opto-insulated outputs to send 1000, 1666 or 2000 pulsed every kWh imported and exported.
If DomBus modules are used in the home automation system, it's easy to configure one or two input ports as IN_COUNTER to measure the imported/exported power and energy.
The following schema shows a system using DomBus module, but what it's interested in this case is that it shows a Eastron SDM230 energy meter, with 2 pulsed outputs connected to the I/O ports IO8 and IO9 of module DomBus12 (but DomBus23, DomBus33 and DomBusTH can be used as well). This is a reliable solution: if Domoticz controller is stopped, DomBus module continues counting pulses up to 64k (equivalent to 32-64kWh) and when Domoticz resumes, the energy counter is restored correctly without loosing pulses.
Using DomBus12, DomBus23, DomBusTH, DomBus32 or DomBus37 it's very easy to read the pulses from energy meters, compute the instant power and get two devices in Domoticz that show the usage and return power, usage and return total energy and graphs. Below the instructions that refer to Eastron SDM230 energy meter: similar procedure for any other energy meter with pulse outputs, like DDS238 energy meter.
- connect the pulse outputs to any available I/O, for example IO8 and IO9 for DomBus12, IO1 and IO2 for DomBusTH or DomBus23 or DomBus32 or DomBus37. The SDM230 common terminal block should be connected to GND (0V). Other energy meters may have output S0+ that should be connected to the DomBus I/O and S0- to GND.
- configure Pulse1 output, on SDM230, as EXP kWh (check the manual to know how to do that); Pulse2 is pre-configured as IMP kWh (measure the energy imported from grid)
- configure the Domoticz device connected to Pulse2: press Edit on that device, and replace in the Description field IN_DIGITAL or IN_TWINBUTTON (the default value) with IN_COUNTER,TYPENAME=kWh and save. Please note that kWh is CASE SENSITIVE!
Now the device will be automatically moved to the Utility panel and configured as energy meter. Edit it again, write a name (for example PowerMeter_Import), and select Usage type. - if produced energy should be measured, configure the Domoticz device connected to Pulse1 as before: press Edit on that device, and replace in the Description field IN_DIGITAL or IN_TWINBUTTON with IN_COUNTER,TYPENAME=kWh,DIVIDER=2000 (where divider number correspond to the pulses/kWh of your meter) and save.
Now the device will be automatically moved to the Utility panel and configured as energy meter. Edit it again, write a name (for example PowerMeter_Export), and select Return type. - In case of both import and export devices are created, it's needed to specify on Import device the Unit number of the Export device, and vice versa. So, select Setup -> Devices and write down the Unit number corresponding to Import (for example 98), and Export device (for example 99), then go to Utility panel, edit Import device and add to the description ,OPPOSITE=99 (Unit of the Export device) and save; edit Export device and add to the description ,OPPOSITE=98 (Unit of the Import device) and save. In this way, when a pulse is received on Import device, the power on Export device will be immediately set to 0, and vice versa, when a pulse is received on Export device, the power on Import device will be set to 0.
Domoticz needs up to 5 minutes before updating the energy counter correctly.
Check the youtube video that shows the instant power shown on the web browser (Domoticz panel) every 2 seconds.
Solution 2 - Using DDS238-2 ZN/S (single phase) or DTS238-7 ZN/S (three phases) Modbus energy meters with DomBus modules
It's possible to connect up to 4 DDS238-2 ZN/S energy meters to a single DomBusEVSE module. DDS238-2 ZN/S have 2 terminal blocks with A and B signals (RS485 Modbus), so it's possible to connect together up to 4 energy meters to the A/B terminal block of DomBusEVSE module: in this way it's possible to measure, for each meter, import/export power, energy, voltage, frequency and power factor.
Values are updated every 5 seconds.
DomBusEVSE is a module designed to control an electric vehicle charging (Mode-3 EV charging station / wallbox). It supports up to 4 energy meters, single and three phases, providing imported energy and power, exported energy and power, active power (negative if power is fed to the grid), voltage, frequency and power factor.
DomBus34 is a module. It supports up to 4 energy meters, single and three phases, providing imported energy and power, exported energy and power, active power (negative if power is fed to the grid), voltage, frequency and power factor.
TODO: connection schema
Solution 3 - Using ESP8266 module (NodeMCU, Wemos, ...) with Eastron energy meters with ModBus RS485 interface
The energy meter is connected between the first circuit breaker and the circuit breakers used for each zone: in this way it measure the used/produced power globally.
Please choose the energy meter model that integrates the RS485/Modbus interface, so it's possible to connect to ESP8266 board through a RS485 to TLL converter so ESPEasy can read power (positive if used, negative if produced), voltage and other variables.
Lua scripts
Some LUA scripts for Domoticz are available, to manage the house power: in the Winter, they activates electric heaters automatically when exported power (from photovoltaic plant on the roof?) is greater than electric heater power. Similarly, any kind of device can be configured (e.g. dehymidifiers / dryers).
It also send an alert when power usage is above the max available power, to prevent disconnections from the electric grid (overcurrent protection).
Scripts are available in github, https://github.com/CreasolTech/domoticz_lua_scripts

- Categoria: Domotics
La famiglia di tee-inverter WVC-2000 (WVC-1600, WVC-2400, WVC-2800) è molto bella e dal prezzo contenuto, disponibile in due versioni: con ricetrasmettitore sub-1GHz (richiede un DTU per gestire quel protocollo e convertire in WiFi ) e WiFi, collegandosi alla rete di sensori "Cloud Intelligence".
Ad ogni modo, consigliamo vivamente di saltare questo prodotto perché:
- non è sicuro : scollegandolo dalla rete (interruzione di corrente o spegnimento dell'RCBO), la tensione prodotta salta a 285V, poi scende, in 30 secondi, a 248V e rimane a 248V fino al tramonto! Questo non è sicuro, l'inverter deve verificare la presenza di 230 V e interrompere la produzione in caso di interruzione di corrente per evitare scosse elettriche.
- inverter a bassissima efficienza : poiché l'inverter invia le telemetrie di alimentazione CC e CA a Cloud Intelligence, è più facile calcolare il rapporto tra potenza CA e potenza CC ed è inferiore a 0,92 (perdita dell'8%). Infatti, con soli 600W di potenza in uscita e 30°C di temperatura ambiente, la temperatura dell'inverter sale a 58°C e questo non va bene
- Algoritmo MPPT molto scadente : confrontando la potenza CA prodotta dai pannelli da 830 Wp che utilizzano questo inverter e un altro sistema fotovoltaico che utilizza l'inverter SolarEdge, l'efficienza complessiva di questo inverter è 0,815 rispetto a quella di SolarEdge.
- elevata corrente di dispersione : è obbligatorio collegare il telaio dell'inverter alla terra di protezione a causa della corrente di dispersione prodotta, molto probabilmente, dagli alti condensatori collegati a terra nel filtro EMI.
Scopri la nostra gamma di moduli domotici per Smart Home!
Caricabatterie per veicoli elettrici intelligente fai-da-te
Il seguente video mostra il modulo smart EVSE che può essere utilizzato per caricare l'auto elettrica.
Moduli DomBus per Domoticz, Home Assistant, Node-RED, OpenHAB, ...
Il seguente video mostra una presentazione di alcuni moduli domotici progettati e prodotti da Creasol per ottenere un sistema domotico affidabile, facile e dai consumi ottimizzati.
- Categoria: Domotics
PLEASE CHECK THE ENGLISH VERSION TO GET THE UPDATED VERSION OF THIS PAGE!The following application note shows how to measure the level of rainwater (or other liquid) inside a tank, using a waterproof ultrasonic distance sensor JSN-SR04T.
This solution works perfectly with Domoticz home automation system, a complete, free and open source software for domotic applications, using DomBus modules programmed with DomBus firmware.
Also, using the DomBus modules with Modbus firmware, works also with Home Assistant, Node_RED, OpenHAB and other domotic systems supporting the standard Modbus protocol.
The following graph displays the measured level of rainwater inside a tank: level decreases when water is used (during garden irrigation, for example) and increases during rains; below the connection diagrams of the ultrasonic distance sensor to the DomBus12 module .
The following DomBus modules support the ultrasonic distance sensor:
- DomBusTH, with DomBus or Modbus firmware: 6 I/Os module with RGB leds, touch sensor and temperature/humidity sensors, supporting up to 5 distance sensors (IO1, IO2, IO3, IO5, IO6) + 1 trigger output (IO4) controlling all sensors (short the o4 PCB jumper to set IO4 port as output).
- DomBus12, with DomBus or Modbus firmware: 9 I/Os module, supporting up to 6 distance sensors (IO1, IO2, IO3, IO4, IO5, IO6) + 1 trigger output (IO7) controlling all sensors (all triggers connected to IO7, that should be set as output by shorting the RO7 PCB jumper).
- DomBus23, with DomBus or Modbus firmware: versatile module with different types of ports, supporting 1 distance sensor (IO1) + 1 trigger output (IO2) controlling the sensor: IO2 have to be set as output by shorting the RO2 PCB jumper.
- DomBus32, with DomBus or Modbus firmware: 3 relay + 3 AC inputs + 5 I/O modules, supporting 4 distance sensors (IO1, IO2, IO3, IO4) + 1 trigger output (IO5) controlling all sensors: IO5 have to be set as output by shorting the RO5 PCB jumper.
- DomBus33, with DomBus or Modbus firmware: 3 relay + 3 AC inputs + 5 I/O modules designed for lighting systems, supporting 4 distance sensors (IO1, IO2, IO3, IO4) + 1 trigger output (IO5) controlling all sensors: IO5 have to be set as output by shorting the RO5 PCB jumper.
- DomBus33, with DomBus or Modbus firmware: 3 relay + 3 AC inputs + 5 I/O modules designed for lighting systems, supporting 4 distance sensors (IO1, IO2, IO3, IO4) + 1 trigger output (IO5) controlling all sensors: IO5 have to be set as output by shorting the RO5 PCB jumper.
Documentation for JSN-SR04T waterproof distance sensor
Click to get the JSN-SR04T distance sensor datasheet
Operating voltage | 5 V (it works at 3.3V too) |
Operating current | 30 mA |
Quiescent current | 4-5 mA |
Frequency | 40 kHz |
Measuring range | 25-450 cm |
Resolution | 2 mm |
Measuring angle | 30 degrees |
Sensor dimensions | 23.5 x 20 mm with 2.5 m long cable |
PCB dimensions | 41 x 28.5 mm (to be protected by humidity!) |
Using DomBusTH module to control up to 5 distance sensors
- Connect the 5V power supply and GND to the distance sensor boards (they works also with 3.3V).
- Connect IO1, IO2, IO3, IO5 or IO6 to the "echo" sensor output. In case of IO5 (that is factory configured to works as open-drain output), to use it as input port connected to the "echo" output, you have to open R05 (with a cutter) and short the RO5 (with a solder iron) PCB jumpers. The same for IO6.
- Connect IO4 to the "trigger" sensor input. Also, short the "O4" pcb jumper to use this I/O port as output.
- Configure (by software) IO4 (trigger) and IOx (echo) as DISTANCE (normally these ports are factory configured as digital inputs or outputs). Using Domoticz, just write in the description field of the sensor devices (both trigger and echo ports) the string ",DISTANCE" to set the port as distance sensor. In case of Modbus, program the address 255+portnumber to the value 13, corresponding to the DISTANCE sensor type.
The module returns the distance in millimiters, and is updated every 15s.
Using DomBus12 module to control up to 6 distance sensors
- Connect the 5V power supply and GND to the distance sensor boards (they works also with 3.3V).
- Connect IO1, IO2, IO3, IO4, IO5 or IO6 to the "echo" sensor output. In case of IO5 (that is factory configured to works as open-drain output), to use it as input port connected to the "echo" output, you have to open R05 (with a cutter) and short the RO5 (with a solder iron) PCB jumpers. The same for IO6.
- Connect IO7 to the "trigger" sensor input. Also, short the "RO7" pcb jumper to use this I/O as output.
- Configure (by software) IO7 (trigger) and IOx (echo) as DISTANCE (normally these ports are factory configured as digital inputs or outputs). Using Domoticz, just write in the description field of the sensor devices (both trigger and echo ports) the string ",DISTANCE" to set the port as distance sensor. In case of Modbus, program the address 255+portnumber to the value 13, corresponding to the DISTANCE sensor type.
The module returns the distance in mm, and is updated every 15s.
Domoticz configuration
- Configure the trigger output as DISTANCE:
go to Switches panel, select the trigger device (IO4 for DomBusTH, IO7 for DomBus12, IO2 for DomBus23, IO5 for DomBus32/33), and write DISTANCE in the Description field, then exit.
The trigger port now can be optionally disabled from Domoticz, by enter Setup -> Devices panel, and clicking in the blue arrow to remove this device from the list - Configure the echo sensor output port, by selecting the corresponding Domoticz device (for example IO1), the writing in the Description field DISTANCE,A=-0.1,B=165
A and B are parameters used to convert the sensor output (distance in mm) to the desired unit format. In the example above, if the sensor output is 400mm and distance from sensor to the tank bottom is 165cm, the value displayed in Domoticz will be
value=400mm*(-0.1)+165=165-40=125cm corresponding to the tank level (total high=165cm, distance from sensor to fluid level=40cm, level=125cm)
Alternatively, setting DISTANCE,A=0.1,B=0 it's possible to get back the distance in cm (A divide the sensor output (in mm) by 10).
Modbus configuration
- Configure the trigger output as DISTANCE:
check in the module webpage the Modbus address for the trigger port, for example for DomBus12 IO7 the Modbus register address is 6;
configure that port as DISTANCE ( set register address 256+6=262 to value 13 ) - Configure the sensor output port as DISTANCE:
check in the module webpage the Modbus address for the sensor port, for example the Modbus address of DomBus12 IO1 is 0;
configure that port as DISTANCE ( set register address 256+0=256 to value 13 )
Every 15 seconds the distance value will be refreshed and can be read from the port address (reading address 0, in the example above).
- Categoria: Domotics
In this page some information about photovoltaic systems and renewable energy
Something about solar photovoltaic systems
To charge the eVehicle, and most important to supply the heat pump in the winter, you should have solar photovoltaic system, but where? On the roof or on the garden? What inclination and orientation for the panels?
In the summer there are no problems at all... the day is long and we always have an over-production. But in the autumn and winter?
The following tables and graphs show a simulation of a 2.7kWp photovoltaic system in 5 configurations and 2 dates (Autumn and Winter), for the Northern Italy, using data from the very useful European website https://ec.europa.eu/jrc/en/pvgis
Simulation using data from 20 September 2016
The following table shows the simulation for the begin of Autumn:
The first column shows the time of the day (GMT+1, not DayLight Saving time!), then second column a simulation for the panels on the roof, oriented to EAST with inclination of only 15 degrees from the horizontal line - blue track.
The third column shows the simulation for panels oriented to south direction, 15 degrees inclination - red track.
The forth column shows the simulation for panels oriented to south direction, vertically (90 degrees) - yellow track.
The fifth column shows the simulation of panels in south direction and 70 degrees inclination - green track.
Finally, the sixth column show the performance of a simple solar tracker with vertical axis that can rotate from east toward south and west, with panel inclination 70 degrees - orange track.
It's possible to see that best performances can be achived using a solar tracker... since from Sunrise, the tracking system lead to a very high power that permits to start heat pump without using power from the grid.
Simulation using data from 1 January 2016
In this case, the solar tracking system does not help to improve the power, because the Sun in the Winter rise from south-east and fall to south-west.
Fotovoltaico in Italia, Scambio Sul Posto, remunerazione
Lo Scambio Sul Posto (SSP) è un meccanismo attraverso cui il Gestore dei Sistemi Energetici (GSE) remunera l'energia esportata in rete dai cittadini dotati di impianto solare fotovoltaico.
Spesso si sente dire che "è meglio consumare tutta l'energia prodotta", oppure "accumularla in batterie, perché il GSE non paga nulla". Ma è davvero così?
Se un impianto è dimensionato bene, è maggiore l'energia autoconsumata dell'energia esportata: in tal caso l'energia esportata viene pagata dal GSE in questo modo:
- suddivisione della produzione nelle fasce orarie F1, F2, F3
- per ciascuna fascia, viene moltiplicata l'energia mensile esportata in tale fascia per il Prezzo Unico Nazionale (PUN) medio mensile relativo a tale fascia oraria moltiplicata aumentata del 5% circa
Quindi, il GSE rimborsa, con lo Scambio Sul Posto: ( Export_F1 * PUN_F1 * 1.05 ) + ( Export_F2 * PUN_F2 * 1.05 ) + ( Export_F3 * PUN_F3 * 1.05 ).
Nell'area cliente del portale GSE è possibile vedere i calcoli eseguiti dal GSE sull'energia esportata e autoconsumata. Ad esempio a dicembre 2021 il PUN_F1 era di 0.32€/kWh, probabilmente ben al di sopra del prezzo di acquisto dell'energia elettrica (0.16€/kWh incluse tasse e contributi vari).
Normalmente, chi ha un impianto fotovoltaico esporta di giorno (quando il PUN + alto) e consuma di notte (quando il PUN è inferiore): il risultato è che conviene esportare l'energia anziché accumularla!
Dal punto di vista della remunerazione non cambia molto, tuttavia è preferibile cercar di esportare energia nelle fasce orarie in cui c'e' maggior richiesta: per questo vale la pena consultare, periodicamente, il Gestore Mercati Elettrici https://www.mercatoelettrico.org/it/
Nell'immagine si vede l'andamento del PUN, ora per ora, per l'8 settembre 2022: il PUN medio giornaliero risulta di 0.50€/kWh (500€/MWh) con punta di 0.70€/kWh alle 9 e 0.55€/kWh alle 20.
Il risultato che si evince è che l'accumulatore, per uso residenziale, ha senso SOLO per chi ha usufruito del Superbonus 110% (lo Stato ha finanziato tutto l'impianto, quindi non è giustamente prevista la remunerazione dell'energia esportata), a chi ha una potenza contrattuale troppo bassa per far funzionare gli elettrodomestici di casa (in tal caso l'accumulatore previene il distacco per superamento della potenza massima contrattuale) e a chi è disponibile a spendere per avere energia anche in caso di blackout. Negli altri casi è un costo che non sarà mai ripagato, tantopiù che il processo di ricarica della batteria e di conversione in alternata non hanno efficienza 100%, ma avviene sempre con perdita di energia.
Import / Export power and energy monitoring
Monitoring can be done by using the free and high-reliable home automation system controller Domoticz , one energy meter with pulsed output (like Eastron SDM-230) and a DomBus module (like DomBus12, DomBus23 or DomBusTH).
ToDo: schema
Domoticz collects data permitting to display charts comparing exported/imported energy month-by-month across several years.
The following chart shows the produced energy using a photovoltaic system, 7.2kWp on the roof, east and west orientation, in the last 3 years.
The following charts show the imported energy:
The following charts show the exported energy (energy sourced to the electric grid):
Comparison of photoltaic system: panels oriented to East and West, and panels oriented to South
The following graphs refers two different solar systems, mounted on roof in the North of Italy:
1) 2.7kWp oriented to East + 4.5kWp oriented to West (totally 7.2kWp)
2) 6kWp oriented to South
From the graphs it's clear
- in the Summer daily production is the same (44kWp for the first solution with 7.2kWp, 37kWp for the second with 6kWp)
- in the Winter, daily production of the second solution (panels oriented to South) performs more than double of the first solution (panels oriented to East and West).
Electric vehicles
Interested on electric vehicles? We have a page about electric cars with several FAQ, in Italian language.
Want to charge the electric car using our domotic module? Check https://www.creasol.it/EVSE
- Categoria: Domotics
In our store we have several kits already equipped with software to start your home automation system using Domoticz software, a free open-source software written in C++, fast and reliable.
Software update is always a problem with Home Assistant? Try Domoticz, and you'll start loving the Domoticz beta version with auto-upgrade feature, and its stability!
Yes, Home Assistant looks very nice and have tons of integration, but is sometimes complicated to get rid of continuous upgrades with integrations that stop working: if you want a domotic system managing hundreds of devices in a Raspberry PI or even in a Rock PI hardware, Domoticz is much better, because it's fast, low memory usage and reliable.
Our kits uses Linux operating system, because Windows is 100% unsuitable for stable home automation systems that are able to manage lights, heat pump, alarm sensors, energy monitoring and load balancing to optimize own consumption when using photovoltaic on the roof. They have a web UI that is sufficient to manage almost everything: you can access to the Domoticz UI by Smartphone using a browser, app and HTTP shortcuts icons to activate single devices or scenes.
Click to list of all kits available in our store!
- Rock Pi S mini kit: small form factor computer with metal case, high endurance MicroSD with Domoticz already installed and equipped with DomBus plugin.
- Rock PI S kit with DomBus23 module to get 1 led stripe dimmer, 2 relay outputs, 1 230Vac input, 2 12/24V inputs, 2 I/Os and 2 analog outputs 0-10V: it can be used to regulate a 12/24V led strip, open a gate or garage door with smartphone, control lights or other loads, ....
- Rock PI S kit with some parts to make a Smart single-phase wallbox: same as before, adding 1 DomBusEVSE (control EVSE module to make a wallbox), 1 contactor 40A, 2 energy meters, 1 12V power supply + 1 power supply 5V to supply Rock PI S.
- Rock PI S kit with DomBus34 and 1 energy meter to keep account of power and energy consumed by the house with nice charts, activating loads (heaters, dehumidifers, ...) when power from electricity grid goes negative (solar photovoltaic is producing) and monitoring of 230V mains to critical appliances (fridges, heat pump, ...).
- and much more.
Support is available through the Telegram channel DomBus (English language) and DomBus_it (Italian language)
How to use custom icons with Domoticz?
To get a better user interface and floorplan with proper icons, it's possible to check the web page https://www.domoticz.com/wiki/Custom_icons_for_webinterface where are listed two Domoticz icons galleries.
- Categoria: Domotics
We produce some reliable and optimized modules that can be used with Domoticz, Home Assistant, OpenHAB, Node-RED and any home automation system controller supporting Modbus protocol.
Our modules can be connected to the domotic controller by RS485 bus: with a cheap and thin 4-wire shielded cable (2x0.50 + 2x0.22mm², commonly used for alarm systems), it's possible to carry both data and power (12 or 24V) to all modules. Using a 12Vdc power supply with backup battery, your domotic system will work even in case of power outage!
DomBus modules, with DomBus protocol, are plug&play: just connect it to the bus and Domoticz will find it, adding only a single module port. Select that device, change address (by writing the new address in Domoticz switch description), then you'll find all module ports in Domoticz.
Each port can be easily configured (as input or output, analog or digital, buzzer/counter/pushbutton, ...) by clicking Edit on the Domoticz switch and writing the configuration on the Description field.
Also, DomBus modules support the possibility to send commands (DCMD) to other DomBus modules (or to itself) when an event occur, to activate one or more outputs automatically, without the need to have a command from Domoticz. In many cases, it's easier to configure DCMD commands instead of programming Domoticz by scripts or blocky! Also, this feature works even when Domoticz is OFF, with a very low latency.
DomBus37 - 12 inputs, 3 AC inputs, 3 SPST relay outputs
Module developed for alarm system, to control one or more sirens, check for 230V voltage detecting power outages, and 12 inputs to interface pushbuttons, alarm sensors, ...
DomBus36: 12 relays module
Din rail module with relays grouped in 3 blocks with a single common (line, neutral, GND, V+, ...) to simplify wiring. Very very low power consumption: only 750mW with ALL 12 relays ON!
DomBus33 - Module with 3 relays, 3 AC inputs, 5 I/Os/DomBus33
Module developed to control 3 existing lights using 230V pushbuttons and step-by-step relay. It permits to control those lights also by the domotic controller (smartphone, tablet, ...) and create automations to turn OFF all lights when exiting the house, for example, or turn ON lights after sunset and turn OFF before sunrise.
DomBus31 - Module with 8 relays, 6 NO relays 250V 5A + 2 NO/NC relays 250V 10A
This module includes 6 relays with 250V 5A capability, and 2 relays with 250V 10A capability. The module consumes less than 10mW in stand-by and less than 500mW with all relays ON!
Please note that some products in the market consumes more than 2W with only 4 relays ON, or even 12W with 8 relays ON!!
It can be mounted on a din rail, as well as in wall boxes.
DomBus23 - Module with 2 relays 250V 5A, with many other functions
This is a very powerful module with many functions. Behind the 2 relay outputs, it includes a 250V optoisolated input, 2x 12/24V optoisolated inputs, 2x IOs, 2 analog outputs 0-10V, optionally 2 open-drain outputs (that can be connected to external relay or DomRelay2 module, shown on the right: in this case you can get totally 4 relays!), and 1 Led stripe dimmer output (with mosfet already included).
Power consumption: less than 10mW in stand-by. Dimmer capability: 12A 30V.
The following application notes shows how DomBus23 can be used to control up to 3 led stripes (1 led strip controlled directly, using the internal high power mosfet, and 2 external led controller by its 0-10V outputs), and how to interface a gate opener or garage door opener.
DomBus12 - 9 I/O compact module within 2 open-drain outputs that can be used to drive 2 external relays
This is a very compact module designed to interface low voltage inputs, for example magnetic contact sensors, PIRs, pushbuttons, ...
It includes 2 open-drain outputs suitable to control external relays. In the right side, the DomRelay2 module that has just 2 relays (12V coil, 250V 5A switching capability) that can be controlled by open-drain or open-collector outputs.
I/Os can be configured in many different ways, including digital and analog input, "twinbutton" mode (controls 2 pushbuttons with a single I/O), buzzer, counter (can be connected to a energy meter to get the imported and exported power/energy, or gas meter, water meter, ...).
DomBusTH - Temperature + humidity sensor, red/green/white leds, 4 inputs and 2 open-drain outputs
This board is designed to be applied to a blank cover with a 3-4mm hole in the center: it can be used to
- measure room temperature and relative humidity
- send notifications by red and green leds
- emergency light, by white led (in case of blackout)
- interface up to 4 pushbuttons or 4 double buttons (totally 8 buttons)
- control a piezo buzzer
- control external relays (even using the DomRelay2 board).
The following application note shows how it's possible to use this module in a bedroom, to control for example a roller shutter motor, a up/down pushbutton, a pushbutton to activate/disable alarm system, sense the temperature and relative humidity, use the LEDs included in the board for notifications (alarm ON and OFF, for example) and as emergency light (in case of power outage).