Tuesday 8 November 2022

New Project - Reprogramming/fixing a Smart WiFi Socket

Following on from discussions on Twitter, I think that I should do this. 

It uses Tasmota devices and MQTT  to show what is using power when. 

An excellent writeup  by @Brunty in his blog:  https://brunty.me/post/energy-monitoring-2022-edition/

To start I need some Tasmota devices. They ain't cheap.

Can I convert my TUYA Smart devices to Tasmota. @Andysc says I can. Will I still be able to control them to turn TV ON & off at specified times automatically? 

There is Tasmotrol, but it is written by a person (Yvonne Joh) who I don't know anything about. Does it feed stuff back to China like TUYA Smart? 

I will need a home Server running 24/7, and at the moment all I have is a few spare black tower PC's. 

Can I find a small unit that plugs into a mains socket and will support some storage?   Looked for 'PC in a plug' and found some references to things like Sheevaplug, but they all seem to have ceased. 

I'll have to get a Raspberry Pi to fit into my dead Humax box when they are available. 

Suggestion that I should look at Balena_io and MING. I might have to learn some more programming if I went that route. 

Keep thinking about it.  Have discovered that Enphase uses MQTT, but I think that this is in old versions of the software. Good if it still does.  How can I test it?

21 Nov. 22

Going to flash one of my TUYA smartplugs with Tasmotrol.

The device is a https://expo.tuya.com/product/627497  model J2-SU-E16

Following https://www.superhouse.tv/44-over-the-air-tasmota-conversion-with-tuya-convert/

Setting up Rasberry Pi (10) 

It has flashed, Not sure if it was successful. 

When plugged in, no light. But Wifi Network tasmota_02AC61-3169

MAC address 12:e9:be:e7:26:65


Have left a comment on the superhouse web page.

26 Nov 22. Have taken it apart and discovered that the chip in it is a common Popular one ESP-12S, and have unsoldered it from the unit. Have ordered a USB to TTL serial interface board so that I can program it. 

Best link that I have found is: 

https://templates.blakadder.com/ESP-12.html

This one has videos of programming them. 

https://www.hackster.io/brian-lough/3-simple-ways-of-programming-an-esp8266-12x-module-c514ee


29 March 2023 looking at this to make it simple:

https://www.youtube.com/watch?v=8yxEgYvoHY0

I have now found tasmotizer:

-- peterm@peterm-MBB-34204H:~$ find -name "*tasmotizer*"
-- ./.local/bin/__pycache__/tasmotizer.cpython-38.pyc
-- ./.local/bin/__pycache__/tasmotizer.cpython-310.pyc
-- ./.local/bin/tasmotizer.py
-- ./.local/lib/python3.10/site-packages/__pycache__/tasmotizer_esptool.cpython-310.pyc
-- ./.local/lib/python3.10/site-packages/__pycache__/tasmotizer.cpython-310.pyc
-- ./.local/lib/python3.10/site-packages/tasmotizer-1.2.1.dist-info
-- ./.local/lib/python3.10/site-packages/tasmotizer_esptool.py
-- ./.local/lib/python3.10/site-packages/tasmotizer.py
-- ./.local/lib/python3.8/site-packages/__pycache__/tasmotizer.cpython-38.pyc
-- ./.local/lib/python3.8/site-packages/__pycache__/tasmotizer_esptool.cpython-38.pyc
-- ./.local/lib/python3.8/site-packages/tasmotizer-1.2.1.dist-info
-- ./.local/lib/python3.8/site-packages/tasmotizer_esptool.py
-- ./.local/lib/python3.8/site-packages/tasmotizer.py

But it won't run because it is missing some bits

following instructions to install tasmota from web i/f But it cannot find USB serial port. 

https://tasmota.github.io/docs/Getting-Started/#needed-software

Web:  https://tasmota.github.io/install/

Have downloaded basic Tasmota from http://ota.tasmota.com/tasmota/release/

This nearly works with the TTL-USB dongle that Ben gave me. It didn't react with Mine. 

Here is another story about step-by-step programming a device with Tasmota.

https://blog.horner.tj/emporia-smart-plugs-tasmota/

This tells how to set Bootloader mode on GPIO15 (pin10)

https://docs.espressif.com/projects/esptool/en/latest/esp8266/advanced-topics/boot-mode-selection.html

7 April 2023.

So I need GPIO-15 Pulled low to enable flashing. This is the pin next to GND. 

SUCCESS!

Following a hint online:

sudo apt-get install python3-pyqt5.qtserialport

and now this works:

 python3 ./.local/lib/python3.8/site-packages/tasmotizer.py
and brings up tasmotizer. 

But I need to find the config file. 

On TAsmotizer, just click the little box for the section that you want to config, so I did and added the Wifi credentials, and then 'saved' this config, which sent it to the device.   Fing found it, but the tasmotizer tablet app didn't. I think I need to set up a tasmotizer web server for this, which probably means using a Raspberry Pi. 

Correction: Fing did not find it. and searching for a WIFI connection to it found nothing either. 

Wrote to Horner re my problems

Hi, as suggested in your blog on this, I am asking for the benefit of your experience. I have an unbranded Smart Switch with TUYA software. It is very similar to the Lombex unit: https://templates.blakadder.com/lombex_U11.html.   I have removed the ESP12 microprocessor and connected it to my Kubuntu computer, and have been able to flash it using 

https://tasmota.github.io/install/   It was necessary to connect both GPIO-15 and GPIO-0 to 
ground to get it to flash. and then have started Tasmotrol to configure it, which seems to work. 
I then tried to send the generic module configuration, and that transferred. The problem is that the 
device never appears in my wireless network  - testing with fing on my tablet. 

Not sure what other info I can give you to help. Attached is a picture of the connection.
 
The ESP-12S came out of the slot on the main board of the unit. 

Any thoughts appreciated,
------------------- ---------------- ------------
another similar plug:
https://templates.blakadder.com/silentnight_485418G.html 

with a comment that  New Tuya devices have replaced their Wi-Fi module with one incompatible 

with Tasmota!!!

10/4/23 Likely conclusion: None of the Tasmota buolds loaded  have had wireless working, so my 

supposition is that Tuya are using an ESP-12 in this device that uses the Realtek wifi drivers rather 

than their original ones. 

I am going to test this hypothesis using these three links:

1]  https://www.instructables.com/Getting-Started-with-the-ESP8266-ESP-12

2]  https://www.instructables.com/ESP-12E-ESP8266-With-Arduino-Uno-Getting-Connected/

3]  https://circuitjournal.com/programming-esp8266-over-wifi

This one 3] is about working with these variants ESP-12E / ESP-12F / NodeMCU so I'll leave it for now. 

2] is about an 8266 E and builds on 1] so I'll start there. 

It has a warning about not using the 3V3 from the USB-TTL adapter as it doesn't supply enough power. 

I cannot get the Arduino IDE serial monitor to  show anything. 

Trying to get an Arduino program working for the ESP8266, and I just get this error:

"module 'time' has no attribute 'time_ns'" in /tools/mkbuildoptglobals.py  and can't find a cure. Something to 

do with the version of Python perhaps. 


16/4/23  Interesting teardown of a couple of smart plugs:

https://www.hackster.io/news/teardown-of-a-smart-plug-or-two-6462bd2f275b

The TCP-Smart plug that I have  contains this:

https://developer.tuya.com/en/docs/iot/wb2s-module-datasheet?id=K9ghecl7kc479

and looks like this. 











2023-05-19

Discovered a new article about programming an ESP-12 with Tasmota

https://www.elektroda.com/rtvforum/topic3816654.html

It implies that the  WB2S in the TCP switch has to be replaced with an ESP-12 device.











 





No comments: