Showing posts with label Tasmota. Show all posts
Showing posts with label Tasmota. Show all posts

Saturday, 21 September 2024

Home Automation


 I've been playing/researching/getting up to speed on Home Automation.


This consists so far, of Home Assistant running on a Raspberry PI 4, with a separate RPI Pico W running some sensors, communicating via MQTT to the HA instance, some BLE temperature/humidity sensors, some energy monitoring smart plugs & a couple of Shelly EM energy monitors flashed with Tasmota, monitoring energy.


It started off with a wish to monitor temperatures & humidity in the house & the loft, if only as a way to see how the loft insulation is doing & to tweak the radiator thermostatic valves.

The sensors are 

ThermoPro TP357

 https://www.amazon.co.uk/gp/product/B0BTSW9JGT/ref=ppx_od_dt_b_asin_title_s00?ie=UTF8&th=1

Battery powered, with a battery life of about a year, BLE Bluetooth low energy, they have the very  occasional spasm of odd readings, probably to do with the randomised nature of low energy Bluetooth .

Picked up as an integration in HA.

Raspberry PI4, with a case & power supply & a micro SD card. Home assistant added as an OS image to the card, insert in the RPI & boot, takes about 30mins.

https://www.home-assistant.io/installation/raspberrypi/


Use a network cable to start, but can be configured for Wi-Fi afterwards.


Lots to learn & configure, but can be used as is, the programming language YAML is a bit of a pain.

Having said that, I'm more comfortable with a soldering iron & test equipment, I think my last programming was 'Hello World' on a Sinclair ZX81! 

Update.

After a crash of home assistant, discovered the SD had failed, looks like not happy with constant writes.

Copied the OS image to an SSD with a usb adapter, applied the backup & all is well.

Moved the RPi sensors over to an ESP32 running a tweaked tasmota to accommodate the sensors,

I got fed up of the RPI W falling off wifi & MQTT & not reconnecting, I think the RPI MQTT implementation leaves a lot to be desired.

I use one of these https://thepihut.com/products/adafruit-veml7700-lux-sensor-i2c-light-sensor-ada4162 to sense the dim on led on the boiler, threshold is 2Lux!

As the boiler is the only gas appliance we have, I can use a  counter within HA to measure the daily, weekly, monthly on time of the boiler, albeit in 30sec steps, multiply this by a constant gives me the surprisingly accurate gas consumption without having to read the gas meter. & I can graph it over time.! 



Tasmota Shelly EM

 I acquired a couple of these https://shellystore.co.uk/product/shelly-em-50a/  with extra clamps.

They are easy to setup & fairly well calibrated, I compared them against the supply meter for a few days.

But, They only provide Energy usage rather than Voltage, Current, Power factor etc, so I decided to flash them with Tasmota. https://tasmota.github.io/docs/

One of these makes it easy, a tasmotizer pcb, with a 3.3V supply onboard, runs from a USB C port on a PC, https://www.amazon.co.uk/dp/B0C15K9ZC4/ref=pe_27063361_487055811_TE_dp_2, designed & produced by RevK https://www.revk.uk/ & used with Tasmotizer software https://github.com/tasmota/tasmotizer


THESE SHOULD ONLY BE CONNECTED WHEN THE EM IS NOT CONNECTED TO MAINS POWER, DAMAGE & A SHOCK HAZARD EXISTS!

1st thing was discovering the smaller pin header has 7 pins, & the Shelly EM has only 6 sockets, easy enough to cut off the 7th, unused pin, the other end from the ground pin.

2nd, after a couple of tries, was discovering several flavours of Tasmota, the one for the EM is the 4M flash version.



Smart Plugs Tasmota

 I bought some of these, https://www.mylocalbytes.com/products/smart-plug-pm, preflashed with Tasmota, also available with ESPhome & EU style sockets, not bad at £12.50 each, they will switch 13A.


Setup straightforward, usual WiFI Hub & MQTT broker details.


They are discovered by Home Assistant, so easy to set up.



Tuesday, 12 March 2024

Tasmota Energy Monitoring Voltage Calibration

 In the UK, domestic mains voltage used to be standardised at 240V +6% -6% so a range of 225.6V to 254.4V,  in 1994 it was decided to harmonise with Europe at 230V, but with a fudge of -6% +10% so a range of 216.2V to 253V, but still nominally 240V. Europe changed from 220V to a nominal 230V.




247V at the top,  244V at the bottom, 0.5V per Div, Horizontal scale 30Sec per Div. Change of 2.5V over a matter of minutes, makes it hard to calibrate to 0.1V.

Tasmota energy monitoring has 2 commands to set voltage,  VoltageSet<x> Calibrate voltage to a target value in V with x denoting which channel if more than 1. & VoltageCal<x> range of 1000 to 32000 (Default 1950) VoltageSet changes VoltageCal to suit the target Voltage.


Several ways to calibrate the voltage, using a calibrated voltmeter.

Buy a mains Voltage calibrator (several £k)

Use a pure sinewave UPS or inverter (several £100)

Setup an audio generator to 50Hz, plug into an audio amplifier, connect to a low voltage transformer used in reverse, rated so no distortion, rough guess for about 50W is a 20V secondary (used as primary) transformer, transformer rated about 100W, allows enough to power the device under test. (Several £10)(This appeals to the geek in me)

Last is setup a Voltmeter & the device, feed with mains Voltage, repeatedly set the voltage until near enough, this is what I did, but it rankles that its not as accurate as it could be, especially when you want to get several devices to agree with each other.