logo elektroda
logo elektroda
X
logo elektroda

TOMZN 63A BL0942 Breaker Configuration with Meter Using Tuya and BK7231N Module NOT WORKING

tadeu1 90 3
ADVERTISEMENT
  • #1 21821633
    tadeu1
    Level 5  
    I need help to configure a breaker TOMZN 63A with meter (BL0942)



    ----------
    JSON
    ----------
    {
    	"bt1_pin":"17",
    	"led1_pin":"9",
    	"rl1_drvtime":"60",
    	"net_trig":"2",
    	"rl_on1_pin":"24",
    	"jv":"1.0.1",
    	"netled1_lv":"0",
    	"netled_reuse":"0",
    	"bt1_type":"0",
    	"temp_fun_en":"0",
    	"online_time":"10",
    	"nety_led":"1",
    	"rl_off1_pin":"26",
    	"over_cur":"63000",
    	"wide_vol":"0",
    	"bt1_lv":"0",
    	"reset_t":"5",
    	"netled1_pin":"15",
    	"chip_type":"3",
    	"rl_on1_lv":"1",
    	"lose_vol":"75",
    	"over_vol":"265",
    	"module":"CBU",
    	"ch_cddpid1":"9",
    	"ch1_stat":"2",
    	"led1_lv":"0",
    	"rl1_type":"1",
    	"ch_num":"1",
    	"ele_fun_en":"1",
    	"rl_off1_lv":"1",
    	"netn_led":"0",
    	"vol_def":"0",
    	"ch_dpid1":"1",
    	"crc":"20"
    }
    
    


    ----------
    TEXT
    ----------
    Device configuration, as extracted from Tuya:
    - Button (channel 1) on P17
    - LED (channel 1) on P9
    - Bridge Relay On (channel 1) on P24
    - Bridge Relay Off (channel 1) on P26
    - WiFi LED on P15
    Device seems to be using CBU module, which is using BK7231N.
    And the Tuya section starts, as usual, at 2023424 (0x1EE000)




    ----------
    CONFIG
    ----------
    I leave LED_n to be red when turn on
    I leave WifiLED_n to be blue when wifi is connected

    
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Full Device Name Here",
      "model": "enter short model name here",
      "chip": "BK7231N",
      "board": "TODO",
      "flags": "0",
      "keywords": [
        "TODO",
        "TODO",
        "TODO"
      ],
      "pins": {
        "9": "LED_n;1",
        "15": "WifiLED_n;0",
        "17": "Btn;1",
        "24": "BridgeFWD;1",
        "26": "BridgeREV;1"
      },
      "command": "",
      "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }
    


    I have this DpID
    
    {
    	"1": "switch",
    	"9": "Countdown",
    	"17": "Energy Charge",
    	"18": "power",
    	"20": "voltage",
    	"21": "Test Result Bit",
    	"22": "Voltage Calibration Coefficient",
    	"23": "Current Calibration Coefficient",
    	"24": "Power Calibration Coefficient",
    	"25": "Electricity Calibration Coefficient",
    	"26": "Fault Alarm",
    	"38": "Power-on status",
    	"40": "Indicator status setting",
    	"41": "Maintenance Lock",
    	"42": "Loop timer",
    	"48": "Alarm Threshold Settings"
    }
    


    The query Data from Tuya
    
    {
    	"result": {
    		"model": {
    			"modelId": "f4sn3o",
    			"services": [
    				{
    					"name": "Default Service",
    					"code": "",
    					"description": "",
    					"actions": [],
    					"events": [],
    					"properties": [
    						{
    							"abilityId": 1,
    							"accessMode": "rw",
    							"code": "switch_1",
    							"name": "switch",
    							"description": "",
    							"extensions": {
    								"iconName": "icon-dp_power2",
    								"attribute": "645"
    							},
    							"typeSpec": {
    								"type": "bool"
    							}
    						},
    						{
    							"abilityId": 9,
    							"accessMode": "rw",
    							"code": "countdown_1",
    							"name": "Countdown",
    							"description": "",
    							"extensions": {
    								"iconName": "icon-dp_time2",
    								"attribute": "740"
    							},
    							"typeSpec": {
    								"type": "value",
    								"min": 0,
    								"max": 86400,
    								"scale": 0,
    								"step": 1,
    								"unit": "s"
    							}
    						},
    						{
    							"abilityId": 17,
    							"accessMode": "ro",
    							"code": "add_ele",
    							"name": "Energy Charge",
    							"description": "If there are high current specifications requiring hardware adaptation, the upper limit value can be manually modified; other configurations should not be changed.",
    							"extensions": {
    								"attribute": "1728"
    							},
    							"typeSpec": {
    								"type": "value",
    								"min": 0,
    								"max": 50000,
    								"scale": 3,
    								"step": 100
    							}
    						},
    						{
    							"abilityId": 18,
    							"accessMode": "ro",
    							"code": "cur_current",
    							"name": "power",
    							"description": "The default reference open-source solution recommends using a rated current specification of no more than 63A. If there are high current specification application requirements, it is necessary to debug and modify the sampling resistor matching and a suitable current transformer, and edit and adjust the upper limit configuration of this DP value. Do not change other configurations.",
    							"extensions": {
    								"attribute": "1728"
    							},
    							"typeSpec": {
    								"type": "value",
    								"min": 0,
    								"max": 99999,
    								"scale": 1,
    								"step": 1,
    								"unit": "W"
    							}
    						},
    						{
    							"abilityId": 20,
    							"accessMode": "ro",
    							"code": "cur_voltage",
    							"name": "voltage",
    							"description": "",
    							"extensions": {
    								"attribute": "704"
    							},
    							"typeSpec": {
    								"type": "value",
    								"min": 0,
    								"max": 5000,
    								"scale": 1,
    								"step": 1,
    								"unit": "V"
    							}
    						},
    						{
    							"abilityId": 21,
    							"accessMode": "ro",
    							"code": "test_bit",
    							"name": "Test Result Bit",
    							"description": "",
    							"extensions": {
    								"attribute": "736"
    							},
    							"typeSpec": {
    								"type": "value",
    								"min": 0,
    								"max": 5,
    								"scale": 0,
    								"step": 1
    							}
    						},
    						{
    							"abilityId": 22,
    							"accessMode": "ro",
    							"code": "voltage_coe",
    							"name": "Voltage Calibration Coefficient",
    							"description": "",
    							"extensions": {
    								"attribute": "736"
    							},
    							"typeSpec": {
    								"type": "value",
    								"min": 0,
    								"max": 1000000,
    								"scale": 0,
    								"step": 1
    							}
    						},
    						{
    							"abilityId": 23,
    							"accessMode": "ro",
    							"code": "electric_coe",
    							"name": "Current Calibration Coefficient",
    							"description": "",
    							"extensions": {
    								"attribute": "736"
    							},
    							"typeSpec": {
    								"type": "value",
    								"min": 0,
    								"max": 1000000,
    								"scale": 0,
    								"step": 1
    							}
    						},
    						{
    							"abilityId": 24,
    							"accessMode": "ro",
    							"code": "power_coe",
    							"name": "Power Calibration Coefficient",
    							"description": "",
    							"extensions": {
    								"attribute": "736"
    							},
    							"typeSpec": {
    								"type": "value",
    								"min": 0,
    								"max": 1000000,
    								"scale": 0,
    								"step": 1
    							}
    						},
    						{
    							"abilityId": 25,
    							"accessMode": "ro",
    							"code": "electricity_coe",
    							"name": "Electricity Calibration Coefficient",
    							"description": "",
    							"extensions": {
    								"attribute": "736"
    							},
    							"typeSpec": {
    								"type": "value",
    								"min": 0,
    								"max": 1000000,
    								"scale": 0,
    								"step": 1
    							}
    						},
    						{
    							"abilityId": 26,
    							"accessMode": "ro",
    							"code": "fault",
    							"name": "Fault Alarm",
    							"description": "Standard list, actual faults triggered according to product capabilities.",
    							"extensions": {
    								"iconName": "icon-baojing",
    								"attribute": "128"
    							},
    							"typeSpec": {
    								"type": "bitmap",
    								"maxlen": 13,
    								"label": [
    									"ov_cr",
    									"ov_vol",
    									"ov_pwr",
    									"ls_cr",
    									"ls_vol",
    									"ls_pow",
    									"short_circuit_alarm",
    									"overload_alarm",
    									"leakagecurr_alarm",
    									"self_test_alarm",
    									"high_temp",
    									"unbalance_alarm",
    									"miss_phase_alarm"
    								]
    							}
    						},
    						{
    							"abilityId": 38,
    							"accessMode": "rw",
    							"code": "relay_status",
    							"name": "Power-on status",
    							"description": "",
    							"extensions": {
    								"iconName": "icon-zhuangtai",
    								"attribute": "736"
    							},
    							"typeSpec": {
    								"type": "enum",
    								"range": ["off", "on", "memory"]
    							}
    						},
    						{
    							"abilityId": 40,
    							"accessMode": "rw",
    							"code": "light_mode",
    							"name": "Indicator status setting",
    							"description": "",
    							"extensions": {
    								"iconName": "tcl_function_light",
    								"attribute": "224"
    							},
    							"typeSpec": {
    								"type": "enum",
    								"range": ["relay", "pos", "none", "on"]
    							}
    						},
    						{
    							"abilityId": 41,
    							"accessMode": "rw",
    							"code": "child_lock",
    							"name": "Maintenance Lock",
    							"description": "",
    							"extensions": {
    								"iconName": "icon-dp_power2",
    								"attribute": "132"
    							},
    							"typeSpec": {
    								"type": "bool"
    							}
    						},
    						{
    							"abilityId": 42,
    							"accessMode": "rw",
    							"code": "cycle_time",
    							"name": "Loop timer",
    							"description": "Maximum 10 timer functions. Each 10 bytes represents channel, weekday, start/end times and on/off durations.",
    							"extensions": {
    								"iconName": "icon-dp_time3"
    							},
    							"typeSpec": {
    								"type": "string",
    								"maxlen": 255
    							}
    						},
    						{
    							"abilityId": 48,
    							"accessMode": "rw",
    							"code": "alarm_set_1",
    							"name": "Alarm Threshold Settings",
    							"description": "Supported by firmware version 106 and above. HEX format, big-endian, alarm configuration structure.",
    							"typeSpec": {
    								"type": "string"
    							}
    						}
    					]
    				}
    			]
    		}
    	}
    }
    


    -------------------------------
    Standard Instruction Set
    -------------------------------
    switch	Boolean	
    
    "{true,false}"
    
    countdown_1	Integer	
    
    {
      "unit": "s",
      "min": 0,
      "max": 86400,
      "scale": 0,
      "step": 1
    }
    
    relay_status	Enum	
    
    {
      "range": [
        "power_off",
        "power_on",
        "last"
      ]
    }
    
    light_mode	Enum	
    
    {
      "range": [
        "relay",
        "pos",
        "none",
        "on"
      ]
    }
    
    child_lock	Boolean	
    
    "{true,false}"
    
    cycle_time	String	
    
    {
      "maxlen": 255
    }
    
    alarm_set_1	Raw	
    
    {}



    I try to use this autoexec
    
    // TOMNZ 63A
    
    // Clear all previous definitions
    //clearIO
    
    // LAST POWER STATE 0 = no / 1 = on / -1 last
    setChannel 1 1
    
    
    // clear flags
    //flags 0
    
    
    // START DRIVERS
    startDriver TuyaMCU
    // BL0942
    startDriver BL0942
    // NTP BRAZIL
    startDriver ntp
    ntp_setServer a.st1.ntp.br 
    ntp_timeZoneOfs -3:00 
    
    waitFor MQTTState 1
    //tuyaMcu_defWiFiState 4
    
    //FLAG
    SetFlag 10 1 // [MQTT] Broadcast self state on MQTT connect
    SetFlag 30 1 // [MQTT] Enable Tasmota TELE etc publishes (for ioBroker etc)
    SetFlag 38 1 //[Power] Set power and current to zero if all relays are open
    SetFlag 46 1 // [TuyaMCU] Store raw data
    
    
    // Main Relay - id 1 "switch_1" -> Ch 1 (rw)
    linkTuyaMCUOutputToChannel 1 bool 1
    setChannelType 1 toggle
    setChannelLabel 1 "Circuit Breaker Switch"
    
    // Countdown timer - id 9 "countdown_1" -> Ch 2 (rw)
    linkTuyaMCUOutputToChannel 9 val 2
    setChannelType 2 TextField
    setChannelLabel 2 "Countdown Timer [s]"
    
    // Total Energy - id 17 "add_ele" -> Ch 3 (ro)
    linkTuyaMCUOutputToChannel 17 val 3
    setChannelType 3 EnergyTotal_kWh_div100
    setChannelLabel 3 "Total Energy"
    
    // Current - id 18 "cur_current" -> Ch 4 (ro)
    linkTuyaMCUOutputToChannel 18 val 4
    setChannelType 4 Current_div1000
    setChannelLabel 4 "Current"
    
    // Power - id 19 "cur_power" -> Ch 5 (ro)
    linkTuyaMCUOutputToChannel 19 val 5
    setChannelType 5 Power
    setChannelLabel 5 "Power"
    
    // Voltage - id 20 "cur_voltage" -> Ch 6 (ro)
    linkTuyaMCUOutputToChannel 20 val 6
    setChannelType 6 Voltage_div10
    setChannelLabel 6 "Voltage"
    
    // Test Bit - id 21 "test_bit" -> Ch 7 (ro)
    linkTuyaMCUOutputToChannel 21 val 7
    setChannelType 7 ReadOnly
    setChannelLabel 7 "Test Result Bit"
    
    // Fault Alarm - id 26 "fault" -> Ch 8 (ro)
    linkTuyaMCUOutputToChannel 26 raw 8
    setChannelType 8 ReadOnly
    setChannelLabel 8 "Fault Alarm"
    
    // Relay Power-on State - id 38 "relay_status" -> Ch 9 (rw)
    linkTuyaMCUOutputToChannel 38 raw 9
    setChannelType 9 Enum
    setChannelLabel 9 "Power-on State"
    
    // Indicator Mode - id 40 "light_mode" -> Ch 10 (rw)
    linkTuyaMCUOutputToChannel 40 raw 10
    setChannelType 10 Enum
    setChannelLabel 10 "Indicator Mode"
    
    // Child Lock - id 41 "child_lock" -> Ch 11 (rw)
    linkTuyaMCUOutputToChannel 41 bool 11
    setChannelType 11 toggle
    setChannelLabel 11 "Child Lock"
    
    // Loop Timer - id 42 "cycle_time" -> Ch 12 (rw)
    linkTuyaMCUOutputToChannel 42 raw 12
    setChannelType 12 TextField
    setChannelLabel 12 "Loop Timer"
    
    // Alarm Settings 1 - id 48 "alarm_set_1" -> Ch 13 (rw)
    linkTuyaMCUOutputToChannel 48 raw 13
    setChannelType 13 ReadOnly
    setChannelLabel 13 "Alarm Settings 1"
    
    // Query all states on boot
    tuyaMcu_sendQueryState
    


    But I get 0 for values
    Also is it possible to show all items (values sensors etc) from tuya in the web page?
    like this post
    https://www.elektroda.com/rtvforum/topic4157607.html



    Control panel with Circuit Breaker Switch and Child Lock buttons and electrical values



    WiFi circuit breaker from TOMZN with product box showing features and models TOMZN switch with power button and Wi-Fi symbol on a white background TOMZN circuit breaker and packaging on a light-colored surface


    attached original fw
  • ADVERTISEMENT
  • #2 21821649
    tadeu1
    Level 5  
    also in the log, I get this

    
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 67 09 00 FF 94 33 AA D9 00 13 FF FF 06 00 00 EE 40 00 20 01 00 33 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 60 09 00 75 91 33 A9 D9 00 18 FF FF 06 00 00 E6 40 00 00 01 00 EB 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 84 09 00 6F 96 33 64 DA 00 FD FE FF 06 00 00 EE 40 00 20 01 00 00 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 73 09 00 DD 90 33 0D D9 00 0B FF FF 06 00 00 EE 40 00 00 01 00 12 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 9C 09 00 57 8D 33 CA D9 00 EF FE FF 06 00 00 EE 40 00 20 01 00 B2 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 85 09 00 42 8A 33 C7 DA 00 E4 FE FF 06 00 00 EE 40 00 20 01 00 EE 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 83 09 00 DF 92 33 D0 DA 00 05 FF FF 06 00 00 EE 40 00 20 01 00 20 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 8A 09 00 D6 9B 33 DF DB 00 F1 FE FF 06 00 00 F6 40 00 20 01 00 16 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 85 09 00 37 9C 33 AE DB 00 DB FE FF 06 00 00 EE 40 00 20 01 00 08 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 7F 09 00 EF 9B 33 A1 DB 00 EA FE FF 06 00 00 EE 40 00 20 01 00 55 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 68 09 00 0A 9E 33 92 DB 00 19 FF FF 06 00 00 F6 40 00 20 01 00 25 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 6F 09 00 C2 A1 33 9D DD 00 23 FF FF 06 00 00 EE 40 00 00 01 00 74 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 9C 09 00 3C A3 33 2B DB 00 07 FF FF 06 00 00 EE 40 00 20 01 00 3B 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 92 09 00 DA A3 33 BF DC 00 F9 FE FF 06 00 00 F6 40 00 00 01 00 39 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 91 09 00 A6 A5 33 85 DD 00 03 FF FF 06 00 00 F6 40 00 20 01 00 7A 
    Info:TuyaMCU:Consumed 23 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 55 B1 09 00 89 A2 33 5B DB 00 E3 FE FF 06 00 00 EE 40 00 20 01 00 CF 
    
    


    Added after 25 [minutes]:

    Also I get work just using this
    that is the first time BL needs Bridge to turn on the light.
    just BL the light wont turn on

    
    // TOMNZ 63A
    
    
    // LAST POWER STATE 0 = no / 1 = on / -1 last
    setChannel 1 1
    
    
    // BL0942
    startDriver BL0942
    startDriver Bridge
    
    // NTP BRAZIL
    startDriver ntp
    ntp_setServer a.st1.ntp.br 
    ntp_timeZoneOfs -3:00 
    
    waitFor MQTTState 1
    
    
    //FLAG
    SetFlag 10 1 // [MQTT] Broadcast self state on MQTT connect
    SetFlag 30 1 // [MQTT] Enable Tasmota TELE etc publishes (for ioBroker etc)
    SetFlag 38 1 //[Power] Set power and current to zero if all relays are open
    
    




    Monitor screen showing energy consumption data for a kitchen oven

    Added after 2 [hours] 26 [minutes]:

    Any ideias
    @p.kaczmarek2 @insmod @divadiow
  • ADVERTISEMENT
  • #3 21821862
    divadiow
    Level 37  
    It's not TuyaMCU. All Tuya devices have dpIDs when you look at their paired info in dev portal.
  • #4 21821980
    tadeu1
    Level 5  
    Hummm that's news for me. Everything is controlled by value, then I have to set like if current bigger than 20a turn off. Interesting

    Added after 1 [minutes]:

    I'll use it to monitor my oven, it's good to use PowerSave 1?
ADVERTISEMENT