Tasmota ed il misuratore di energia SDM220

Riprendo parzialmente il contenuto di questo articolo:

Decido di provare ad usare il Geekcreit 2 Ch modificato, al quale ho già collegato il modulo RS485, per leggere i dati di un misuratore SDM220.

Firmware

Occorre caricare il firmware già precompilato, nella versinoe Tasmota Sensors. Io ho usato il software Tasmotizer quindi, dopo avere collegato l’interfaccia seriale USB ai pin +V, GND, Tx ed Rx, mi è bastato scegliere la porta ed il firmware dai menu a tendina.

Una volta caricato Tasmota, questa è la configurazione da impostare:

Nella scheda Console di Tasmota inoltre bisogna dare i seguenti comandi:

rule1 on Power1#Boot do baudrate 2400 endon
rule on

ed il misuratore SDM220 deve essere impostato alla velocità di 2400 baud.

Nota: la password di default del misuratore SDM220 è “1000”.

Queste sono altri comandi, che ho dato via console, che ho usato per adeguare il modulo alle mie esigenze:

PowerOnState 0
PulseTime1 5
PulseTime2 5
Webbutton1 Portoncino
Webbutton2 Cancello

E questo è il risultato:

OPENHAB:

Questa è la configurazione che uso per Openhab. Ovviamente occorre un broker MQTT attivo e dentro Tasmota bisogna impostare l’indirizzo IP e la porta del broker.

File mqtt.things

Bridge mqtt:broker:mosquitto "Mosquitto" [ host="192.168.1.111", port=1883, secure=false, username="", password="", clientID="openHAB" ]
{
        Thing topic energy_SDM220 "Misuratore Energia SDM220" @ "Soggiorno" {
    Channels:
        Type switch : power1     "Relé 1"                  [ stateTopic="stat/tasmota-SDM220/POWER1", commandTopic="cmnd/tasmota-SDM220/POWER1" ]
		Type switch : power2     "Relé 2"                  [ stateTopic="stat/tasmota-SDM220/POWER2", commandTopic="cmnd/tasmota-SDM220/POWER2" ]
		Type string  : reachable "Reachable"              [ stateTopic="tele/tasmota-SDM220/LWT" ]
        Type datetime : timestamp "Timestamp"              [ stateTopic="tele/tasmota-SDM220/SENSOR", transformationPattern="JSONPATH:$.Time"]
        Type number : powerload "Power load"             [ stateTopic="tele/tasmota-SDM220/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ApparentPower"]
        Type number : voltage   "Line voltage"           [ stateTopic="tele/tasmota-SDM220/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="tele/tasmota-SDM220/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : totalToday     "Total energy today"     [ stateTopic="tele/tasmota-SDM220/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalYest "Total energy yesterday" [ stateTopic="tele/tasmota-SDM220/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : totalExported "Export" [ stateTopic="tele/tasmota-SDM220/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ExportActive"]
		Type number : totalImported "Import" [ stateTopic="tele/tasmota-SDM220/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ImportActive"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="tele/tasmota-SDM220/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
		Type string : WifiDowntime  [stateTopic="tele/tasmota-SDM220/STATE", transformationPattern="JSONPATH:$.Wifi.Downtime"]
        Type number : LoadAvg       [stateTopic="tele/tasmota-SDM220/STATE", transformationPattern="JSONPATH:$.LoadAvg"]
        Type string : Uptime        [stateTopic="tele/tasmota-SDM220/STATE", transformationPattern="JSONPATH:$.Uptime"]
	}


}

Parte del mio file default.items

Group Elettricita     (Home)
Group SDM220     (Home)
Group Grafico_energia   (Home)
Group Esterno              "Esterno"   <garden>   (Home)

//Misuratore di energia SDM220 - TASMOTA MQTT su Geekreit 2CH
Number SDM220_potenza_istantanea "Power [%.1f W]" <energy> (Elettricita, SDM220, Grafico_energia) {channel="mqtt:topic:mosquitto:energy_SDM220:powerload" }
Number SDM220_Today "Oggi [%.1f kWh]" <line> (Elettricita, SDM220)     {channel="mqtt:topic:mosquitto:energy_SDM220:totalToday" }
Number SDM220_Yesterday "Ieri [%.1f kWh]" <line> (Elettricita, SDM220, Grafico_consumo_giornaliero)    {channel="mqtt:topic:mosquitto:energy_SDM220:totalYest" }
Number SDM220_Total_Imported "Totale Importato [%.1f kWh]" <returnpipe> (Elettricita, SDM220)   {channel="mqtt:topic:mosquitto:energy_SDM220:totalImported" }
Number SDM220_Total_Exported "Totale Esportato [%.1f kWh]" <flowpipe> (Elettricita, SDM220)   {channel="mqtt:topic:mosquitto:energy_SDM220:totalExported" }
Number SDM220_Voltage "Tensione [%.1f V]" <energy> (Elettricita, SDM220)     {channel="mqtt:topic:mosquitto:energy_SDM220:voltage" }
Number SDM220_RSSI "RSSI [%d %%]" <network> (Elettricita, SDM220) {channel="mqtt:topic:mosquitto:energy_SDM220:rssi" }
String SDM220_Reachable "Modulo in rete" (Elettricita, SDM220) {channel="mqtt:topic:mosquitto:energy_SDM220:reachable" }
String SDM220_WifiDowntime "WifiDowntime" <time> (Elettricita, SDM220) {channel="mqtt:topic:mosquitto:energy_SDM220:WifiDowntime" }
Number SDM220_LoadAvg "LoadAvg" <pie> (Elettricita, SDM220)   {channel="mqtt:topic:mosquitto:energy_SDM220:LoadAvg" }
String SDM220_Uptime "Uptime" <time>  (Elettricita, SDM220)   {channel="mqtt:topic:mosquitto:energy_SDM220:Uptime" }
DateTime SDM220_Aggiornamento "Time [%1$td/%1$tm - %1$tH:%1$tM:%1$tS]" <time> (Elettricita, SDM220)   {channel="mqtt:topic:mosquitto:energy_SDM220:timestamp" }

Switch   portoncino         "Portoncino"          <light>         (Esterno)         ["Switchable"]   {channel="mqtt:topic:mosquitto:energy_SDM220:power1"}
Switch   cancello         "Cancello"          <light>         (Esterno)         ["Switchable"]   {channel="mqtt:topic:mosquitto:energy_SDM220:power2"}

Parte del mio file default.sitemap

 Text label="Misuratore di energia - SDM220 " icon="energy" {
		Text item=SDM220_potenza_istantanea label="SDM220 Potenza istantanea  [%.1f W]"
		Text item=SDM220_Total_Imported label="Totale importata [%.1f kWh]"
		Text item=SDM220_Total_Exported label="Totale esportata [%.1f kWh]"
		Text item=SDM220_Today label="Totale importata Oggi [%.1f kWh]"
		Text item=SDM220_Yesterday label="Totale importata Ieri [%.1f kWh]"
		
		Text item=SDM220_Aggiornamento label="Aggiornato: [%1$td.%1$tm.%1$tY %1$tk:%1$tM:%1$tS]"
		Group item=SDM220 label="Dati completi nodo" icon="settings"
 }

E questo è il risultato in Openhab:

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

wp-puzzle.com logo

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.