Blitzwolf BW SHP2 WiFi Socket with Tasmota via MQTT

Dear all,

I would like to share my setup for the Blitzwolf Socket (Tasmota flashed).

(For newer versions please select “Gosund SP1 v23” as Tasmota Module Type in the Web-Config GUI)

mosquitto.things

Thing topic bwshp2_1234 "Blitzwolf SHP2 #1 (blitzwolf-1234)" @ "MQTT" {
	  Channels:
	    Type switch : BW_1234_powerswitch    	"Blitzwolf SHP2 #1: Power Switch" 			[ stateTopic="tasmota/blitzwolf-1234/stat/POWER", commandTopic="tasmota/blitzwolf-1234/cmnd/POWER", on="ON", off="OFF" ]
	    Type switch : BW_1234_powerswitchres 	"Blitzwolf SHP2 #1: Switch State" 			[ stateTopic="tasmota/blitzwolf-1234/stat/RESULT", transformationPattern="JSONPATH:$.POWER",on="ON",off="OFF"]
	    Type string : BW_1234_time          	"Blitzwolf SHP2 #1: Time"             		[ stateTopic="tasmota/blitzwolf-1234/tele/STATE", transformationPattern="JSONPATH:$.Time" ]
	    Type string : BW_1234_uptime        	"Blitzwolf SHP2 #1: Uptime"           		[ stateTopic="tasmota/blitzwolf-1234/tele/STATE", transformationPattern="JSONPATH:$.Uptime" ]
	    Type number : BW_1234_vcc           	"Blitzwolf SHP2 #1: VCC"              		[ stateTopic="tasmota/blitzwolf-1234/tele/STATE", transformationPattern="JSONPATH:$.Vcc"  ]
	    Type string : BW_1234_ap       			"Blitzwolf SHP2 #1: Wifi AP"          		[ stateTopic="tasmota/blitzwolf-1234/tele/STATE", transformationPattern="JSONPATH:$.Wifi.AP" ]
	    Type string : BW_1234_ssid     			"Blitzwolf SHP2 #1: Wifi SSID"        		[ stateTopic="tasmota/blitzwolf-1234/tele/STATE", transformationPattern="JSONPATH:$.Wifi.SSId" ]
	    Type string : BW_1234_channel  			"Blitzwolf SHP2 #1: Wifi Channel"     		[ stateTopic="tasmota/blitzwolf-1234/tele/STATE", transformationPattern="JSONPATH:$.Wifi.Channel" ]
	    Type number : BW_1234_rssi     			"Blitzwolf SHP2 #1: Wifi RSSI"        		[ stateTopic="tasmota/blitzwolf-1234/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI" ]
	    Type string : BW_1234_sensortime    	"Blitzwolf SHP2 #1: Sensor Time"      		[ stateTopic="tasmota/blitzwolf-1234/tele/SENSOR", transformationPattern="JSONPATH:$.Time" ]
	    Type string : BW_1234_starttime  		"Blitzwolf SHP2 #1: Start Time"  			[ stateTopic="tasmota/blitzwolf-1234/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.TotalStartTime" ]
	    Type number : BW_1234_total      		"Blitzwolf SHP2 #1: Total"       			[ stateTopic="tasmota/blitzwolf-1234/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Total" ]
	    Type number : BW_1234_yesterday    		"Blitzwolf SHP2 #1: Yesterday"       		[ stateTopic="tasmota/blitzwolf-1234/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday" ]
		Type number : BW_1234_today    			"Blitzwolf SHP2 #1: Today"       			[ stateTopic="tasmota/blitzwolf-1234/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today" ]
		Type number : BW_1234_period    		"Blitzwolf SHP2 #1: Period"       			[ stateTopic="tasmota/blitzwolf-1234/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Period" ]
		Type number : BW_1234_apparent    		"Blitzwolf SHP2 #1: Apparent Power"       	[ stateTopic="tasmota/blitzwolf-1234/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ApparentPower" ]
		Type number : BW_1234_reactive    		"Blitzwolf SHP2 #1: Reactive Power"       	[ stateTopic="tasmota/blitzwolf-1234/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ReactivePower" ]
		Type number : BW_1234_factor    		"Blitzwolf SHP2 #1: Factor"       			[ stateTopic="tasmota/blitzwolf-1234/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Factor" ]

		Type number : BW_1234_power   			"Blitzwolf SHP2 #1: Power"       			[ stateTopic="tasmota/blitzwolf-1234/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power" ]
		Type number : BW_1234_voltage    		"Blitzwolf SHP2 #1: Voltage"     			[ stateTopic="tasmota/blitzwolf-1234/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage" ]
		Type number : BW_1234_current    		"Blitzwolf SHP2 #1: Current"     			[ stateTopic="tasmota/blitzwolf-1234/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current" ]

	    Type string : BW_1234_devicestate   	"Blitzwolf SHP2 #1: Device State"     		[ stateTopic="tasmota/blitzwolf-1234/tele/LWT" ]
	} 

blitzwolf.items

// Blitzwolf BW-SHP2 #1 (1234)                                                       
Switch BW1_Switch 		  	"Blitzwolf#1: Switch 1" 	     	{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_powerswitch" }
Switch BW1_State 		  	"Blitzwolf#1: State 1"          	{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_powerswitchres"}
Number BW1_Vcc 		    	"Blitzwolf#1: VCC  [%s]" 		 	{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_vcc" }
String BW1_WifiAp 			"Blitzwolf#1: Wifi AP  [%s]" 	 	{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_ap" }
String BW1_WifiSsid 	  	"Blitzwolf#1: Wifi SSID  [%s]" 		{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_ssid" }
String BW1_WifiChannel 		"Blitzwolf#1: Wifi Channel [%s]"	{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_channel" }
Number BW1_WifiRssi 	  	"Blitzwolf#1: Wifi RSSI  [%s]" 		{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_rssi" }
String BW1_Uptime 		  	"Blitzwolf#1: Uptime" 		     	{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_uptime" }
String BW1_Time 		    "Blitzwolf#1: Time" 		     	{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_time" }
String BW1_DeviceState 		"Blitzwolf#1: Device State"     	{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_devicestate" }
String BW1_SensorTime 		"Blitzwolf#1: Sensor Time"      	{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_sensortime" }
String BW1_startTime 		"Blitzwolf#1: Start Time"  			{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_starttime" }
Number BW1_Total 	  		"Blitzwolf#1: Total [%.3f kWh]"     { channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_total" }
Number BW1_Yesterday 	  	"Blitzwolf#1: Yesterday [%.3f kWh]" { channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_yesterday" }
Number BW1_Today 	  	    "Blitzwolf#1: Today [%.3f kWh]"     { channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_today" }
Number BW1_Period 	  		"Blitzwolf#1: Period"       	    { channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_period" }
Number BW1_Apparent 	  	"Blitzwolf#1: Apparent"       		{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_apparent" }
Number BW1_Reactive 	  	"Blitzwolf#1: Reactive"       		{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_reactive" }
Number BW1_Factor 	  		"Blitzwolf#1: Factor [%.1f]"       	{ channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_factor" }
Number BW1_Power            "Blitzwolf#1: Power [%.3f W]"       { channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_power" }
Number BW1_Voltage   		"Blitzwolf#1: Voltage [%.1f V]"     { channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_voltage" }
Number BW1_Current 	  		"Blitzwolf#1: Current [%.3f A]"     { channel="mqtt:topic:mosquitto:bwshp2_1234:BW_1234_current" }
2 Likes

just used your template, thanks for it.

i dont have mosquitto but should it not be

from

Thing topic bwshp2_1234 "Blitzwolf SHP2 #1 (blitzwolf-1234)" @ "MQTT"

to

Thing topic bwshp2_1234 "Blitzwolf SHP2 #1" (blitzwolf-1234) @ "MQTT"
 (blitzwolf-1234) is representing the Bridge used

also
Thing topic bwshp2_1234

should have this format
<bindingId>:<thingTypeId>:<thingId>

resulting
Thing mqtt:topic:bwshp2_1234

Here the modified for embedded mqtt broker as i am using right now

THING:

Thing mqtt:topic:bwshp6_1 "Blitzwolf SHP6 #1" (mqtt:systemBroker:embedded-mqtt-broker) @ "MQTT" {
	  Channels:
	    Type switch : BW_1_powerswitch    	"Blitzwolf SHP6 #1: Power Switch" 			[ stateTopic="stat/BlitzWolf-1/POWER", commandTopic="cmnd/BlitzWolf-1/POWER", on="ON", off="OFF" ]
	    Type switch : BW_1_powerswitchres 	"Blitzwolf SHP6 #1: Switch State" 			[ stateTopic="stat/BlitzWolf-1/RESULT", transformationPattern="JSONPATH:$.POWER",on="ON",off="OFF"]
	    Type string : BW_1_time          	"Blitzwolf SHP6 #1: Time"             		[ stateTopic="tele/BlitzWolf-1/STATE", transformationPattern="JSONPATH:$.Time" ]
	    Type string : BW_1_uptime        	"Blitzwolf SHP6 #1: Uptime"           		[ stateTopic="tele/BlitzWolf-1/STATE", transformationPattern="JSONPATH:$.Uptime" ]
	    Type string : BW_1_ap       		"Blitzwolf SHP6 #1: Wifi AP"          		[ stateTopic="tele/BlitzWolf-1/STATE", transformationPattern="JSONPATH:$.Wifi.AP" ]
	    Type string : BW_1_ssid     		"Blitzwolf SHP6 #1: Wifi SSID"        		[ stateTopic="tele/BlitzWolf-1/STATE", transformationPattern="JSONPATH:$.Wifi.SSId" ]
	    Type string : BW_1_channel  		"Blitzwolf SHP6 #1: Wifi Channel"     		[ stateTopic="tele/BlitzWolf-1/STATE", transformationPattern="JSONPATH:$.Wifi.Channel" ]
	    Type number : BW_1_rssi     		"Blitzwolf SHP6 #1: Wifi RSSI"        		[ stateTopic="tele/BlitzWolf-1/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI" ]
	    Type string : BW_1_sensortime    	"Blitzwolf SHP6 #1: Sensor Time"      		[ stateTopic="tele/BlitzWolf-1/SENSOR", transformationPattern="JSONPATH:$.Time" ]
	    Type string : BW_1_starttime  		"Blitzwolf SHP6 #1: Start Time"  			[ stateTopic="tele/BlitzWolf-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.TotalStartTime" ]
	    Type number : BW_1_total      		"Blitzwolf SHP6 #1: Total"       			[ stateTopic="tele/BlitzWolf-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Total" ]
	    Type number : BW_1_yesterday    	"Blitzwolf SHP6 #1: Yesterday"       		[ stateTopic="tele/BlitzWolf-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday" ]
		Type number : BW_1_today    		"Blitzwolf SHP6 #1: Today"       			[ stateTopic="tele/BlitzWolf-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today" ]
		Type number : BW_1_period    		"Blitzwolf SHP6 #1: Period"       			[ stateTopic="tele/BlitzWolf-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Period" ]
		Type number : BW_1_apparent    		"Blitzwolf SHP6 #1: Apparent Power"       	[ stateTopic="tele/BlitzWolf-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ApparentPower" ]
		Type number : BW_1_reactive    		"Blitzwolf SHP6 #1: Reactive Power"       	[ stateTopic="tele/BlitzWolf-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ReactivePower" ]
		Type number : BW_1_factor    		"Blitzwolf SHP6 #1: Factor"       			[ stateTopic="tele/BlitzWolf-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Factor" ]

		Type number : BW_1_power   			"Blitzwolf SHP6 #1: Power"       			[ stateTopic="tele/BlitzWolf-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power" ]
		Type number : BW_1_voltage    		"Blitzwolf SHP6 #1: Voltage"     			[ stateTopic="tele/BlitzWolf-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage" ]
		Type number : BW_1_current    		"Blitzwolf SHP6 #1: Current"     			[ stateTopic="tele/BlitzWolf-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current" ]

	    Type string : BW_1_devicestate   	"Blitzwolf SHP6 #1: Device State"     		[ stateTopic="tele/BlitzWolf-1/LWT" ]
	} 

ITEMS

Switch BW1_Switch 		  	"BW_1: Switch 1" 	        (gBW1)    	{ channel="mqtt:topic:bwshp6_1:BW_1_powerswitch" }
Switch BW1_State 		  	"BW_1: State 1"             (gBW1)	    { channel="mqtt:topic:bwshp6_1:BW_1_powerswitchres"}
String BW1_WifiAp 			"BW_1: Wifi AP  [%s]" 	    (gBW1)	    { channel="mqtt:topic:bwshp6_1:BW_1_ap" }
String BW1_WifiSsid 	  	"BW_1: Wifi SSID  [%s]"     (gBW1)		{ channel="mqtt:topic:bwshp6_1:BW_1_ssid" }
String BW1_WifiChannel 		"BW_1: Wifi Channel [%s]"   (gBW1)	    { channel="mqtt:topic:bwshp6_1:BW_1_channel" }
Number BW1_WifiRssi 	  	"BW_1: Wifi RSSI  [%s]"     (gBW1)		{ channel="mqtt:topic:bwshp6_1:BW_1_rssi" }
String BW1_Uptime 		  	"BW_1: Uptime" 		     	(gBW1)      { channel="mqtt:topic:bwshp6_1:BW_1_uptime" }
String BW1_Time 		    "BW_1: Time" 		     	(gBW1)      { channel="mqtt:topic:bwshp6_1:BW_1_time" }
String BW1_DeviceState 		"BW_1: Device State"     	(gBW1)      { channel="mqtt:topic:bwshp6_1:BW_1_devicestate" }
String BW1_SensorTime 		"BW_1: Sensor Time"         (gBW1)	    { channel="mqtt:topic:bwshp6_1:BW_1_sensortime" }
String BW1_startTime 		"BW_1: Start Time"  	    (gBW1)		{ channel="mqtt:topic:bwshp6_1:BW_1_starttime" }
Number BW1_Total 	  		"BW_1: Total [%.3f kWh]"    (gBW1)      { channel="mqtt:topic:bwshp6_1:BW_1_total" }
Number BW1_Yesterday 	  	"BW_1: Yesterday [%.3f kWh]"(gBW1)      { channel="mqtt:topic:bwshp6_1:BW_1_yesterday" }
Number BW1_Today 	  	    "BW_1: Today [%.3f kWh]"    (gBW1)      { channel="mqtt:topic:bwshp6_1:BW_1_today" }
Number BW1_Period 	  		"BW_1: Period"       	    (gBW1)      { channel="mqtt:topic:bwshp6_1:BW_1_period" }
Number BW1_Apparent 	  	"BW_1: Apparent"       	    (gBW1)	    { channel="mqtt:topic:bwshp6_1:BW_1_apparent" }
Number BW1_Reactive 	  	"BW_1: Reactive"       	    (gBW1)	    { channel="mqtt:topic:bwshp6_1:BW_1_reactive" }
Number BW1_Factor 	  		"BW_1: Factor [%.1f]"       (gBW1)    	{ channel="mqtt:topic:bwshp6_1:BW_1_factor" }
Number BW1_Power            "BW_1: Power [%.1f W]"      (gBW1)      { channel="mqtt:topic:bwshp6_1:BW_1_power" }
Number BW1_Voltage   		"BW_1: Voltage [%.1f V]"    (gBW1)      { channel="mqtt:topic:bwshp6_1:BW_1_voltage" }
Number BW1_Current 	  		"BW_1: Current [%.3f A]"    (gBW1)      { channel="mqtt:topic:bwshp6_1:BW_1_current" }

Maybe it depends on the oH and MQTT versions you use.

Currently, I run oH2.5.1 / openhabian on a RasPI3 with MQTT broker installed via oH console (sudo openhabian-config -> optional components / Mosquitto

Same config by me, only the MQTT Broker i use is the embedded one.

By using your template i got errors on VSCode and on the LOG(frontail)
Therefor i posted my version if someone gets same issues when using embedded broker

Thanks for sharing!

My code works without errors - thats odd …