Jump to content

My DIY Home Automation


Peter Topp

Recommended Posts

@francois & @SolarNoob

I have an Axpert 5kVA MKS II, 10x 285W ArtSolar panels and 8x 200Ah Vision 6FM200Z-X AGM batteries

Also have a BMV-702 on the way and Victron balancers on backorder. 

I've fallen behind on my HA stuff, I have a box full of sonoffs and shelleys that i need to get to. Also need to pull out the ladder and flash my sonoff POW on the geyser with tasmota.

I have to work from home next week thanks to Covid-19 so I might finally get around to some of it.

These are my other screens on HA, sorry this is going to be a lot of pics. I'm, new to the forum not sure what the etiquette is 

 

After the inverter dashboard is lights, nothing exciting here

lights.thumb.png.ae997ad8c848a36f7eb6323bdd694c38.png

 

Then Pool, I also have an automation to send an mqtt command to the POW on the pool to reset the "Total Since" counter at midnight on the 1st of Every month so I can easly graph monthly totals from inglux/grafana. I haven't added the bar graph yet

1122786602_Screenshotfrom2020-03-1814-03-05.thumb.png.9c1d372dd141180fdf866f9848958a50.png

 

Gate and Garage doors, done with Sonoff SVs and reed switches. I'm in a security estate so I wasn't too worried about the secuity of the sonoff on the gate. I've at least disabled the built in AP that gets activated when it can't see the Wifi. 

gates.thumb.png.80a84d5b13ca3256c29cd78be5f3f6d0.png

 

Garden Irrigation -  I use Openspinkler

irrigation.thumb.png.acf1de216f5477b90d502b57b3b129c5.png

 

Weather and Geyser temperature. I have a Solar Gesyer with limited early morning boosting in the mornings so good to see what the water temp is at in the evening.

When I get around to flashing the POW on the geyser I want to add thermostatic control from HA. The standard geyser thermostat on the element will act as a hard shutoff in case something goes crazy in HA

weather.thumb.png.90b1f778481cde1069df23a86136534d.png

 

Main bedroom only has aircon for now. If the aircon is drawing more than 100W after sunset and the grid goes down it will turn off the aircon. I have a Wifi enabled infrared remote hub that I havent finished setting up yet. Hopefully I will be able to control all functions of the aircon when done

main.thumb.png.a2025feb3db9d6439556b240bc9681a0.png

 

Then my 3d floorplan with animations and presence detection. This was a proof of concept so the image is lacking a lot of detail.

In the gif the first click is from clicking on the room in HA, the next one you can see the light going on and off from using the actual light switch.

ezgif.com-video-to-gif.gif.edab2d7feada9b0fac85c7dfc385ccd3.gif

This might be overshare of what my place looks like but this is where my renderings are now. I still need to add trees, plants, pool, 2nd floor and some inhouse detail. I'm also waiting to get all the smart switches installed before I render all the layers with things on/off or open/closed. My Goal is to have a tablet or 2 with the 3D view of the house to see the state of everything as well as control everything.

 

home10.png.8210f4a03acfe2f58900e7f359ae82ff.png

not sure whayst going with the artifacts on the cars...

home12.png.9f6f3d95353f535ef63e4d20d15b19fe.png

home14.png.3f15a4120cbd95ece5984a484c5cd39a.png

home15.png.15f4b918a009f92a9e4e5c7986066b11.png

home16.png.d3e50e5740c6f35fce208749413c55e4.png

home18.png.5e2edba6ed8dd030e56afc5a01176286.png

 

And then  random crap on my testing page, i build cards here and then move them over to the main pages 

 

1931283820_Screenshotfrom2020-03-1812-08-49.thumb.png.2486ad4a179d83901273abff877243fa.png

 

That's it for now. Hopefully i get time to grow it over the next few weeks. I'm also liking @Jatho dark theme, might change mine up  

Link to comment
Share on other sites

Some nice stuff you've done Mark.

How are you measuring your geyser temp? Also what did you use to do the rendering? Its been on my todo list for some time.

Not sure what IR hub you have, I got the Broadlink RM Mini and it was pretty easy to integrate and controls anything IR, only down size is for things that share the same IR code like power buttons, HA doesn't always know if its on or off, its way better and easier when there are two different commands for on and off. 

 

 

Link to comment
Share on other sites

@Mark2Frikkin amazing stuff you got going there! Well done.

I really need to read up on this a bit more. Any sites\references I can look at? 

If I understand it correctly the components would be your Inverter and ICC talking to it via Pi\PC\VM and then ICC also talking to various Sonoff switches that are connected to wifi as well? And then the logic coded into ICC to make decisions on what needs to be on when? OR is this all done via HA?

Trick here being ICC and it being compatible with your inverter. 

What are the guys using who are running LiFePo batterieswith  BMS which need to also talk to the inverter? Is it a case of either ICC or battery BMS communicating with the inverter? Not both. 

Link to comment
Share on other sites

17 hours ago, Jatho said:

Some nice stuff you've done Mark.

How are you measuring your geyser temp? Also what did you use to do the rendering? Its been on my todo list for some time.

Not sure what IR hub you have, I got the Broadlink RM Mini and it was pretty easy to integrate and controls anything IR, only down size is for things that share the same IR code like power buttons, HA doesn't always know if its on or off, its way better and easier when there are two different commands for on and off. 

 

 

I'm using a Sonoff TH16 and ds18b20 temperature probe. My geyser has a 2nd sleeve that I fed the ds18b20 probe into. When comparing the water temperature out of a hot water tap using a thermometer and the reading from the sonoff it's always within 0.2 degrees so im quite happy with it. The only caveat is the water inlet seems to be near this sleeve so when you run a hot tap the temperature reading in HA drops suddenly and then gradually normalizes back to the correct temperature when you're done and the water temperature has naturally evened out.

The renderings were done with Sweethome 3D and the SVG files for HA in Inkscape, both are free and can also run on linux 🐧 That's my preffered OS. 

I also have the RM Mini, thanks for the heads up about the same IR code issue, holding thumbs my aircon has different codes.  I may have to create a binary sensor based on power draw from the POW to determine powered on/off state...

 

Link to comment
Share on other sites

25 minutes ago, Mark2 said:

I'm using a Sonoff TH16 and ds18b20 temperature probe. My geyser has a 2nd sleeve that I fed the ds18b20 probe into. When comparing the water temperature out of a hot water tap using a thermometer and the reading from the sonoff it's always within 0.2 degrees so im quite happy with it. The only caveat is the water inlet seems to be near this sleeve so when you run a hot tap the temperature reading in HA drops suddenly and then gradually normalizes back to the correct temperature when you're done and the water temperature has naturally evened out.

The renderings were done with Sweethome 3D and the SVG files for HA in Inkscape, both are free and can also run on linux 🐧 That's my preffered OS. 

I also have the RM Mini, thanks for the heads up about the same IR code issue, holding thumbs my aircon has different codes.  I may have to create a binary sensor based on power draw from the POW to determine powered on/off state...

 

Thanks Mark, I'll have a look at my geyser would like to do the same.

Are you only using Sonoff's? I've moved most of my sensor based stuff over to nodeMCU and using ESPhome on HA its a lot cheaper this way and more configurable, cost per nodeMCU with a sensor is around R150 plus they're quite low draw so can be powered off a single 81650 lithium battery, I actually use this configuration with a small 5V solar panel per device for my water level monitoring on my tanks total cost with solar, batteries, board, sensor still lower than a single Sonoff.
 

If your aircon has a single power button which it almost certainly will then its a single code for on and off, Not the end of the world I guess.

Thanks for the info on the rendering, will give me something to do when we go into lockdown :D 

 

 

Link to comment
Share on other sites

17 hours ago, Tsa said:

@Mark2Frikkin amazing stuff you got going there! Well done.

I really need to read up on this a bit more. Any sites\references I can look at? 

If I understand it correctly the components would be your Inverter and ICC talking to it via Pi\PC\VM and then ICC also talking to various Sonoff switches that are connected to wifi as well? And then the logic coded into ICC to make decisions on what needs to be on when? OR is this all done via HA?

Trick here being ICC and it being compatible with your inverter. 

What are the guys using who are running LiFePo batterieswith  BMS which need to also talk to the inverter? Is it a case of either ICC or battery BMS communicating with the inverter? Not both. 

I'm not using ICC, I'm using skymax - https://github.com/manio/skymax-demo -  on a Pi to send commands and read values over the USB to the inverter. These values get returned in JSON which gets process by a BASH script to publish the values via MQTT using mosquttio_pub to HA, this happens every 10s on my current config.  Another bash script runs mosquitto_sub to subscribe to the topics for changing values on the inverter, these values get sent from HA and the payload of the message gets passed to skymax to send across the serial... so in a nutshell HA manages eveything.

When I started on this venture I did tinker with ICC using a trial license but I wanted everything under one umbrella. Not to take anything away from Manie and the team, they've done great work.  But for me personally when I embarked on the Home Automation and Inverter journey I didnt want an app for this, an app for that. Everything needed to be manged from a single platform. I haven't looked at ICC since so not sure if Manie has added bidirectioanl MQTT yet, at the time he said there were no plans to include it. 

 

Link to comment
Share on other sites

12 hours ago, SolarNoob said:

@Mark2  Do you know if its possible to ingest PylonTech Lithium batteries info into HA?

Should be, I'm not sure if there's documentaion around the commuction protocol but in theory the same thing can be done with publishing the values into HA using mosqutto_pub.

 

Link to comment
Share on other sites

3 hours ago, SolarNoob said:

It looks like the mqtt topics are available from the PylonTechs:

 

Pylontech Battery Array input/output Current : N/xxxxx/system/0/Dc/Battery/Current

Pylontech Battery Array input/output Power : N/xxxxx/system/0/Dc/Battery/Power

Pylontech Battery Array SoC : N/xxxxx/system/0/Dc/Battery/Soc

Pylontech Battery Array Voltage : N/xxxxx/system/0/Dc/Battery/Voltage

There are likely many more

Could I run  Ned Kelly's docker voltronic homeassistant or skymax to read these topics and send them to HA?

Can I plug the USB cable from both the Inverter and the PylonTech BMS into the Pi running either of the above to read this data and forward it to my HA server?

Also, do you know if the above programs work on the infinisolar line of Voltronic inverters?

 

🤔 I'm not too familair with the pylontech units but MQTT needs a TCP/IP connection to work. I'ts my understanding that the pylontechs only have serial port so i imagine you will need to poll it over the serial and push the data out with MQTT.

I don't think Ned Kellys would work on the pylontech but if anyones willing to give me a pylontech I'd be happy to get something working  😋

I came across this thread - looks like @Elbow has some good knowledge on this https://powerforum.co.za/topic/3429-pylontech-vs-raspberry-arduino-plc/

I didnt have time to go through pyloncon.py in detail but I doubt much is needed beyond updating the connect() function with your HA mqtt details, maybe just registering different topics as i didnt see it sending "/config"  anywhere in the script, which HA needs.

My pyhon isnt that hot, this is an example of how I register topics using mosquitto from BASH on the Pi to the HA server:

mosquitto_pub -h 1.1.1.1  -p 1883 -u \"username\" -P \"password\" -t \"homeassistant/sensor/voltronic_battery_charge_current/config\" -m \"name\":\"voltronic_battery_charge_current,\"unit_of_measurment\":\"A\",\"state_topic\":\"homeassistant/sensor/voltronic_battery_charge_current\",\"icon\":\"mdi:current-dc\" 

there's no entity_id in this example so it will be last after a reboot..

Link to comment
Share on other sites

4 hours ago, Mark2 said:

🤔 I'm not too familair with the pylontech units but MQTT needs a TCP/IP connection to work. I'ts my understanding that the pylontechs only have serial port so i imagine you will need to poll it over the serial and push the data out with MQTT.

For PylonTech I think we can extract code from the repository below.  I'm currently running ICC but I'm thinking of developing something open source that supports axpert and pylon techs, has a small control panel and can submit data via MQTT to home assistant or smart things.  Then people don't have to pay 3k+ for ICC which becomes unresponsive in various situations.

https://github.com/celsworth/lxp-pylon-utils

Edited by pierre.
Link to comment
Share on other sites

On 2020/03/18 at 11:53 AM, Mark2 said:

The only problem is payloads on low speed USB need to be broken up into 8 bytes chunks so currently this is limited to 5 character commands ( 5chars +2 CRC +1 CR = 8bytes ) 

So commands like POP00 work 100% but ones like PBFTxx.x ( float voltage ) are hit and miss.

Have you seen this new repository?  The author claims it's solid communication to axperts via USB.  Since you have tried various things, what do you think of his approach?

https://powerforum.co.za/topic/5394-axpert-software/

 

Link to comment
Share on other sites

The only issue I had with Hassio was that remote connection was or maybe still is a pain. If you could not do port forward it was a huge mission to get it going. Openhab as an integrated remote connection via thier myopenhab.org site. What makes it even more attractive is that it is for free.

Very nice Dashboards! One place it definitely outshines :)   

Link to comment
Share on other sites

14 hours ago, pierre. said:

Have you seen this new repository?  The author claims it's solid communication to axperts via USB.  Since you have tried various things, what do you think of his approach?

https://powerforum.co.za/topic/5394-axpert-software/

 

I'm testing it out now, looks interesting. It's crashed a few times with CRC errors but it 's probably just clashing with my primary polling service. 

I will play around with it a bit more and try integrate it with my MQTT scripts. It will be a bit of a hack though as I won't be able to seperate it from FCGI - I'm not a dev. It is really fast though so i dont mind going via curl to nginx fcgi.

Looks like a great resource if you're building a direct web frontend.

 

Link to comment
Share on other sites

7 hours ago, PaulF007 said:

The only issue I had with Hassio was that remote connection was or maybe still is a pain. If you could not do port forward it was a huge mission to get it going. Openhab as an integrated remote connection via thier myopenhab.org site. What makes it even more attractive is that it is for free.

Very nice Dashboards! One place it definitely outshines :)   

The letsencrypt+duckdns and nginx addons make a nice secure way of accessing it remotley with port forarding.

But I agree with you 100%, if your ISP is using CGNAT then you won't have a publically routable IP to port foward from and you then the next best thing is to use their nabu casa service at $5pm... hopefully that's not a problem too many people experience. It's a little more common if you're using LTE at home but often there's an alternative APN to use to get a public IP. In a few years when IPv4 is exhausted it could be a more common problem and ISPs will probably charge extra for a public IP.

What does your openhab setup look like ?

 

Link to comment
Share on other sites

On 2020/03/20 at 12:24 PM, Mark2 said:

I will play around with it a bit more and try integrate it with my MQTT scripts. It will be a bit of a hack though as I won't be able to seperate it from FCGI - I'm not a dev. It is really fast though so i dont mind going via curl to nginx fcgi.

I also thought about extracting the inner C code so that I don't have to use FCGI, etc. It seems like the FCGI layer handles timeouts and the author previously made two other connectors so perhaps he is using FCGI with good reason.  I'll try and find out from the author.

Link to comment
Share on other sites

  • 3 weeks later...

@Mark2, Very neat setup indeed. 

I also started out that route a few years back. I fiddled with HASSIO, Openhab, Home assistant and just didn't like it. It was too finicky and not very reliable. I am very deep into the apple eco system and gave homekit a try and never looked back! it is fairly straight forward and very reliable. I am using homekit with a few other API's including node red,  and homebridge to translate non HAP approved devices to talk on homekit. the key for me here is not to display funky stuff that I cannot use, but to be ultra reliable as it runs the security of the house.

I also have various automation rules in place  to control blinds, lights, temperature, pool and so on, except from the main devices that have access to homekit and siri, I have ipads spread out in the house against the walls (flush mounts I got from Howlo) with the below panel in guided access mode so no one can mess about. it has been very reliable the past 3 years give or take. 

The biggest advantage of this setup is Siri. you can control anything just with a voice prompt, absolute convenience. Yes I know hassio/homeassist/openhab can also, but it ain't the same.

376202169_Screenshot2020-04-07at15_52_50.thumb.png.a46fad6f0e0ac27be0d62bfedf99aadb.png

Edited by Jakesza
Link to comment
Share on other sites

  • 4 weeks later...

@Jakesza - sorry that looks like a glorified remote panel - where the auotmations? :) (obvisuly I am more an open system guy)  - just kidding though if it works thats cool

I ve been away from forum for a bit so missed some of the action - some nice dashboards. I ve expanded mine quite a bit in Homeassistant since I posted last. Related to solar I now have a automation which is quite specific to PE Grid tie setup which you might find interesting. If you grid tied you linked to Eskom time of use time periods so you really want to be careful to get your system to only draw from grid in off-peak and standard time. Rate peak is R2.67 vs off Peak R1.24 / kWh.  Now since the Peak is never during high sun conditions you need to be able to tell the system to use battery first during Peak period, then ouside this period you tap into cheaper time periods to recharge the batteries for the next peak. Should mention any excess power fed back to grid during the day can be used as credit in evening as long as the rate periods match - effectively you using the grid as a battery. That way Battery only needs to be sized to house consumption during the 2 peak periods - see power wheel image.

So home assistant keeps track of the rate periods and battery condition and sends a command to my quattro inverter (well actually ESS) to adjust the grid setpoint up or down depending on what rate is active - works like a charm. 

Other toggle relarted to solar is a loadshedding switch - basicaly this tells the inverter to increase battery SOC min to a higher level (mine is 40% vs 20%) - to ensure there is enough capacity in the battries at all times to handle a 2hr unexpected loadshed (have toyed with trying to read the shedules but gave up)

My other dashboards are actaully quite light on the number of switches but I have over 60 automations running eveything from the geyser, robot vacuum to pumps, alarm system and lights. My newest favourite one at moment is I use the passive sensors in my workshop to turn the lights on and of depending on someone being int there - love it.

Have a shipment of Shellys (mostly dimmers and 2 way switch controllers) on their way from Bulgaria, these will convert most of the houses lights that I havent Sonof bassics yet - cant wait :) 

image.thumb.png.bfe7db0df4f0bb6d05252db3dfdd7028.png

image.thumb.png.eefb951a85d02dc6d294249b99e06911.png

image.thumb.png.ac929f8cd3877a50791cc430a62292f0.png

Link to comment
Share on other sites

On 2020/03/12 at 3:34 PM, Mark2 said:

I'm also a big fan of home assistant.

This is my dashboard for my Axpert MKS II. I have a raspberry pi connected to it with bidirectional MQTT to my home assistant server.

The server used to be just a pi 3 but it started getting a bit sluggish with all the data points. I've since migrated to an old 4th gen i3 with a cheap SSD

 

inverter.thumb.png.777bd7ae177f3fe45d03b36357c8f7b2.png

 

I've done some other stuff as well if you guys are interested to see.

 

Also have 3d animations working but still working on a full detailed rendering of the house before I integrate it fully.

 

 

 

So @Mark2 how you getting the loadshedding status  -that automation I need :)

Link to comment
Share on other sites

14 hours ago, Tim said:

ok answered by own question - thanx for nudge:

https://gist.github.com/cliffordwhansen/b9ce886f8942d957e6140b8655f69f46

If you spend some time you can also get your specific schedule for suburb.

Have a look at these few steps.

https://mybroadband.co.za/forum/threads/loadshedding-api.672196/

https://github.com/daffster/mypowerstats

https://www.npmjs.com/package/eskom-loadshedding-api

 

In my home I have sonoff wall switches on all my lights. What I then did with HA you can calculate the on time for each entity. 

I use a sonoff pow to measure all my light's individual power usage. Then with a calculation I can dynamically calculate power usage of all the lights individually and add that to my dashboard.

Did the same with my TV. The blow save the stats for 30days and then in the template I use a average of 120w when the tv is on.

#bedroom tv
  - platform: history_stats    
    name: 'btv' 
    entity_id: media_player.tv_ua43nu7100
    state: 'playing'
    type: time
    end: '{{ now() }}'
    duration:
      days: 30
      
  - platform: template
    sensors:
      btv_template:
        friendly_name: 'Bedroom TV'
        unit_of_measurement: W
        value_template: '{{ states.sensor.btv.state | multiply(120)|round(1) }}'

Link to comment
Share on other sites

17 hours ago, Tim said:

If you grid tied you linked to Eskom time of use time periods so you really want to be careful to get your system to only draw from grid in off-peak and standard time. Rate peak is R2.67 vs off Peak R1.24 / kWh. 

@Tim where do you get these rates from? I checked on the Eskom site but can only seem to find old rates from 2011/12 14/15 etc... Could be that I'm looking in the wrong place.

 

thanks. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...