Helping a complete newbie to get started

I think I’ll be able to scrape together an hour here and there to start tinkering with home automation. I already own two Raspberry Pi’s, a 3B and a 4. I’ve gotten to the point of installing Home Assistant on the 4 about two months ago, and haven’t done anything since. The 3 is running Pi-Hole, which used to be useful, now not so much (maybe I should update its lists).

Yesterday I took some time off and bought three Sonoff switches, two basics and one POW. Tested the POW last night using a janky setup with an old multiplug I had lying around and it seems to work great.
The idea is obviously not to be reliant on eWeLink’s servers. Therefore, now I need to get to the point of flashing Tasmota on these switches. @JacoDeJongh pointed me to a nice tool for the job, and I think I got the right one: https://www.robotics.org.za/W17939?search=usb%20ttl

When this arrives, my journey will start. So far I’ve decided upon the following order of operations:

  1. Install a remotely manageable switch on my pool pump
  2. Figure out how to make Home Assistant work and integrate the two (Jaco mentioned I’ll need an MQTT broker, which is also a new term for me)
  3. Figure out how to integrate HA with my Venus GX using ModBus
  4. “Smartly” manage the pool pump using the information from the GX

All of the above steps will be executed on my desk before actually hooking anything up to the pool.

A few questions to the community from my side are then:

  1. Please share any good tutorials on the whole Home Assistant, MQTT Broker, Sonoff with Tasmota with me, if you have available?
  2. Is this document from Victron, https://www.victronenergy.com/live/ccgx:modbustcp_faq, all I really need to know how to get it to work with HA, or do I need to read up some other stuff also?
  3. Any other useful things I can take on after getting the pool pump to stop being dumb?
  4. Please share any other useful information/potential pitfalls to avoid/good tools to get (I own a multimeter)?

I would suggest watching “Andreas Spiess” on Youtube. He is Swiss and has an awesome channel on Raspberry’s, ESP32’s, Arduino’s and sensors, as well as home automation, and Node-Red tips. Well worth watching.

The Hookup also has some great videos, including this one which walks you through installing HA, mqtt, node red, etc.

Also, you don’t have to flash the sonoffs, they will work just fine with HA using the sonoff integration.

Happy to share my modbus config in HA if you like. I just refer to the giant spreadsheet of registers (https://drive.google.com/file/d/1Q0IE7ns8Tqcvrw32H5wYOrmMDajkKfXa/view?usp=drivesdk) and see what works and what doesn’t

1 Like

So if I do this, would the Sonoffs not still be reliant on the eWeLink server to operate?

That’ll be amazing! Thanks!

According to this, yes

1 Like

I get why people are reluctant to flash the ESP based devices with Tasmota, I really do. I guess if you just want to switch something through WiFi with your phone, is ok to just run the stock software and have it in HA. Thing is, that doesn’t really make it a smart device. It’s only potentially smart if you have HA do something with it.

What many people don’t realize is that a WiFi enabled piece of hardware is only as smart as the firmware that runs on it. Flashing that device to ‘take it out of the cloud’ is only a fraction of the benefits. Tasmota can make that piece of hardware truly smart:

  1. You can run device groups; this is seriously powerful. Let’s say you have 5 WiFi enabled downlighters and you want to control them all with 1 switch, that can become really tedious to set up with stock firmware or with HA. With device groups, you simply add all linked devices to the same group and they are sync’ed. Whatever happens with one light or switch, will happen on all devices. Automagically. No need to set up automations or any complexity in HA. In fact, you don’t even need HA at all, it only needs an MQTT server running. Not just simply switching lights, but changing color, brightness, whatever. When it is running in HA, you only ever control one light. The rest of the linked lights will mimic that one. One light, two switches? Add them in the same device group and you now control that light with two switches, like in a long passage. Again, no automations or scenes or whatever other crap in HA. You just add those devices with device groups.

  2. Say you have the main light in a room, but a few ambient lights as well. Because you didn’t think ahead (like I didn’t think ahead) you now have a problem controlling the different lights individually. Enter rules: short press, long press and multi tap. You press the switch like normal, the main lights come on. You long press (say a second or more) and now you switch the ambient lights. In case you have a 3rd set of lights, well, just double tap the switch and you control those. You can make it really convoluted, but all this can be done with one single switch. Again, no automations or scenes in HA, just rules set up in Tasmota. And rules can control device groups as above as well. You can really go to town getting all this done without even touching HA.

The above are just two examples of making a basic WiFi controlled device truly smart, something that’s not possible with running stock firmware or ewelink/tuya apps on your phone. It barely scratches the surface of what’s possible.

Sorry for my rant, but I honestly think people are doing themselves, and the smart device concept a disservice by investing in all the hardware, but missing out on what’s possible with truly smart firmware

2 Likes

Remember that if you intend to flash your Sonoffs, you need to buy some headers, and a soldering iron to solder them into the board. The devices ship without the header and putting a header in there really makes it so much easier to flash.

You don’t need a very fancy soldering iron, just one with a fine enough tip, and preferably in the 30W-80W range (not too hot). And some good resin-core solder.

In the past I’ve often used headers from other old electronics (old expansion cards from old computers are usually full of he stuff), but at some point I just bought myself a heap of headers to make this easier…

Ah thanks for letting me know. Turns out I have zero soldering experience but my father-in-law is an electrical engineer with all of this stuff and experience, so he should be able to help. I do have some headers in my arduino starter kit.

Looks like I’m going to be able to learn many new skills!

My 2 cents.

I would look into using docker, and running more on 1 device, vs having separate devices for things. I too have a few though! (although one is dedicated to gaming, another to venus for the victrons, and another for dev stuff)

I have mine doing multiple things, including HA, PiHole, and other bits and bobs.

Yeah, I did install HomeAssistant like that before, because the Pi running PiHole alone is a bit of a waste. However, at the moment I just want to keep it as simple as possible. I’m not very familiar with any of this stuff, and though I back myself to figure it out, I just don’t have the time at the moment to make something any more complex than it needs to be… :sweat_smile:

If just for flashing, some male/female dupont (aka breadboard jumper cable) simply held in place (friction or some finger pressure) should work - I flashed a basic R3 and a TH16 without soldering (multiple times).

2 Likes

Yeah so I went with this method. Flashed my one basic and added it to Home Assistant with MQTT. So now I have a “dumb” switch on some lights around my pool area. Next up - To do the pool pump switch and then to make these switches “smart”. I’ve already pulled most of the information I think I’ll need for that from ModBus. Next step is to figure out how to do some automatic switching happen based on events.

It seems people use NodeRed for this? I looked into it quickly and I’m not super keen on making flow charts. I trust myself more with normal programming (not that I trust myself a lot), but open to suggestions from you all!

See here. Not officially supported, but some work is done to integrate nodered and signalk into Venus. Not available on the CCGX (not enough space).

Once you have the Modbus data in HA, you can use HA rules and automations to achieve most of what you need for switching based on loads.

Node Red is for the more advanced automations and you probably dont need those at this point.

What are you hoping to achieve?

Basically at this point all I want to achieve is to turn the pool pump on/off based on the availability of PV, but also ensure a minimum amount of run-time per every X days (rolling total), and also not switch the state of the pool pump too frequently.

The above is my rough idea of what I “think” I want to do.

That’s gonna be hard with HA automations. I don’t use NodeRed myself (because I’m intellectually lazy) but I suspect it might be a better way to go for such a usage case. HA automations are pretty basic against what I’ve seen guys do with NodeRed. Again, I might be too lazy to apply my mind to HA automations as well :slight_smile:

Hmmm yeah, I think I’ve realised that I’ll have to do a bit of reading before just jumping into NodeRed or just normal HA automations. At least find some examples only. I should be able to code up my use case pretty easily (note not quickly) in a language I am familiar with, but I’m not at all familiar with this…

As in, I’m pulling all the information I need, but I’m not finding it intuitive to even know what “variables” I now have access to. For example, I’ve added this to the configuration.yaml file:

sensor:

  • platform: modbus
    registers:
    • name: DC from Battery
      hub: victron
      unit_of_measurement: “W”
      slave: 100
      register: 842
    • name: AC from Grid
      hub: victron
      unit_of_measurement: “W”
      slave: 100
      register: 820
    • name: Battery SoC
      hub: victron
      unit_of_measurement: “%”
      slave: 100
      register: 843

Okay good. Now I have a few sensors “entities”. How would I go an implement pseudo code doing:

“Pool Pump Switch Time Since Last State Change” = current_time - “Pool Pump Switch Time Last Changed”

if ((“DC from Battery” > 1000) or (“Battery SoC” > 90% and “AC from Grid” < 100)) and (“Pool Pump Switch State” = “Off” and “Pool Pump Switch Time Since Last State Change” > 15 minutes) then
“Pool Pump Switch State” = “On”
“Pool Pump Switch Time Since Last State Change” = 0 minutes
“Pool Pump Switch Time Last Changed” = current_time

else if “Pool Pump Switch” = “On” and “DC from Battery” < -250 and “Pool Pump Switch Time Since Last State Change” > 15 minutes then
“Pool Pump Switch State” = “Off”
“Pool Pump Switch Time Since Last State Change” = 0 minutes
“Pool Pump Switch Time Last Changed” = current_time

This isn’t exactly what I want, but from something like this I should be able to figure out the rest…

Have a look at templates, you can write pretty complex logic in them:

1 Like