extending the smart home to the car...

bretti_kivi

Member
So I've been thinking about this winter. Yes, we already have frost...

We have the DEFA Termini in the car(s). They are plugged into the wall and run around 2kW of heat into the cabin. I don't want to run this any longer than necessary. I do want to run it long enough for the cabin to be warm in the morning before leaving.
We currently have a Clas Ohlson switch for this and it's pretty good. But it has its own clock, so it's always wrong and I think I can do better.

Right now, I'm thinking about using ZigBee with some Arduinos (or more likely a Wemos D1) to monitor temperature. And then to have a server service running which says "departure time is at 0730, it's -15C, so the car needs to start preheating at 0530. It is 0530, turn the socket on".
This isn't as trivial as I hoped - I picked up an Ikea Trådfri gateway, but it won't do what I was hoping for, certainly not with the thermometer input. I also want a display and override, along with a feedback loop so if the car is "too warm", the heater is turned off again.

Not 100% sure how I'm going to do this, but I figure a temperature sensor in the car and another outside is going to be a starting point. That and a remote-controllable socket. I think I have those things with Zigbee connectivity. The next bit is going to be the automation, after I've connected everything up.

To be continued...
 
I reckon you could do this with a Rapsberry Pi, remote temp sensor and Energenie controlled power sockets. People have similar setups for horticulture

.

And once the Energenie MiHome hub is on the network you can also control it via Google Assistant.
 
Have you considered an ESP 8266-01? As long as your car is within your wifi network, you can read the temperature and control the heater. The link below shows the application for temperature measurement:

 
Sounds really interesting. I use TPLink smart plugs and use them IFTTT, it can be fed external temp and take action accordingly. Not sure how it would know when to switch off, it would need an internal temp feed as you said yourself.

Sounds like a great project.


Sent from my iPhone using Tapatalk
 
The E-Up!, E-Golf and ID3 have this facility, when plugged in.

RAB
 
I was intending for the thermometer to be available when the car is plugged in.
The logic needs to be something like...

at 0400
check outside temperature
set turnon time appropriately for departure time
at the correct time
turn on the socket
at departure time turn off the socket

I'm intending to use a Ledvance Smart+ outdoor socket. It will happily switch >3Kw, so enough.
UI is a question mark, but HomeAssistant is the thing I think I'll be installing next, along with a ConnexBee II. I have an old D2700 board here that will work nicely for this and a 24" to go in the kitchen as display.
 
A year ago I tried Home Assistant and openHAB but decided as they are (were) too script based and a steep leaning curve. OpenHAB was a mix of script and GUI but once a script was manually changed the GUI was defunct. Also tried RPi Easy but the developer was not helpful.

I went for Domoticz on a Raspberry Pi 4, running Domoticz within a Docker container. Also running Mosquitto (MQTT broker) and Zigbee2MQTT in a docker container. This has been fairly easy to set up and I'm a Linux newbie. But still time consuming.

I have also gone for zigbee. I used a CC2531 as a zigbee sniffer flashed with the firmware from https://github.com/Koenkk/Z-Stack-firmware/tree/master/router. To do the flashing I'm using the CC-Deb****r ZigBee Programmer (a cheap Chinese copy widely available on ebay).

I have a Sonoff BASICZBR3 Zigbee switch to switch on/off a water heater. Zigbee2MQTT has support for 100s of zigbee sensors.

I've also been using a CC2530+CC2591 as a zigbee sensor using router firmware from https://www.zigbee2mqtt.io/ This firmware can read analogue and digital sensors attached to the CC2530. But I'm struggling to get some functions working. The developer simply says it works OK for him and there does not seem to be a big community using it. But I have found no other custom firmware for a custom zigbee sensor. (I want to count pulses).

One problem with Zigbee is that some devices are sending out sensor readings every few seconds. There seems to be no control over this, at least with proprietary sensors. The developer of the Zigbee2MQTT software has been helpful and has made changes to the profile file to ignore some duplicate messages. Still I'm worried that numerous messages mean the Rasp Pi never sleeps and may run hot - the Rasp Pi 4 does run hot anyway. I have fitted a Fan Shim to the Pi and a fan to the case controlled by a python script with email alerts if overheating. Maybe a Pi 3 would be OK.

On the Domoticz side I could not get the SMS and Email functions to work (maybe that's because it is running in a Docker container). So I wrote my own Python functions to send SMS (via a UK service provider), Emails and Telegram notifications.

Running in Docker containers whilst has benefits does mean a reliance of the developer who created the docker package (e.g. Domoticz) to maintain it unless one compiles the package oneself. Other packages like Mosquitto are more mainstream and will have their docker package updated regularly.

There are many ways to "skin a cat". Each will have their own strengths and weaknesses. Community support is key. Some software is too dependent on the original developer who can be reluctant to let go and allow code contributions from others.
 
Hi bretti_kivi Couldn't get to sleep last night thinking about your project ;) I think you can do it without installing a Home Automation System (HAS) like openHAB, Domoticz etc.. I'm sure it can be done with a Python script. On the otherhand, a HAS system will give you a dashboard but this will add complexity. Instead one can send emails/sms/telegram messages.

Hardware:
Rasp Pi model 2 would be OK, possibly a Zero even, for a system without a HAS
CC2531 dongle as a zigbee sniffer flashed with the co-ordinator firmware from https://github.com/Koenkk/Z-Stack-firmware/tree/master/router.
_______ Ideally a short quality USB extension cable to keep the CC2531 away from the Pi (avoids interference)
Sonoff BASICZBR3 Zigbee switch to switch on/off your heater
2 x Zigbee temperature sensors supported by the Zigbee2MQTT software
CC_Deb****r + Adapter Cable to flash the CC2531 [note the forum software is replacing my letters with *** as it thinks I'm using a rude word!]

Pi Software (not exhaustive)
Mosquitto MQTT Broker - handles MQTT messages to/from clients and subscribers
Zigbee2MQTT - converts zigbee sensor data to MQTT messages and vv
Zigbee2Mqtt Assistant (a GUI for Zigbee2MQTT for testing and monitoring)
Python libraries for MQTT such as paho.mqtt.client
Python libraries for email such as smtplib, email.mime.multipart, email.mime.text
Python libraries for sms service and telegram such as http.client, json

PC software
MQTTfx to help monitor and generate MQTT messages during testing
SmartRF Flash Programmer from Texas Instruments to upload the firmware to the CC2531 dongle using the CC_Deb****r + Adapter Cable
Visual Studio Code to write the Python script
Putty to access a headless Pi command line
RealVNC/VNC Viewer to access a headless Pi GUI (optional)
Postman to generate API keys for SMS service (optional)

Pi Cron Job
Add the following Python script to Crontab to run at your earliest start time (e.g. 05:00)

Python Script Logic
Note: all send/receive MQTT messages are sent/received via the Mosquitto MQTT Broker

On starting send message to subscribe to messages from the external temperature sensor
Wait to receive external temperature message
Calculate when to start heater and set timer
Send message to unsubscribe to messages from the external temperature sensor
(OR continue to receive temperature readings and cancel timer should temperatures rise)

When set time activates then:
Optionally subscribe to messages from external temperature sensor and decide if heating is still required
Send message to Sonoff BASICZBR3 to turn on heater
Optionally send email/sms/telegram message to say the heater has been turned on + info on external temperature
Send message to subscribe to messages from the internal temperature sensor
Wait to receive internal temperature message
If internal temperature has reached required temperature then send message to Sonoff BASICZBR3 to turn off heater
Optionally send email/sms/telegram message to say the heater has been turned off + info on internal temperature

Continue to receive internal temperature message and if temperature drops then turn heater on again and vv

At end time (e.g. 09:00)
Send message to unsubscribe to messages from any sensors still being monitored
Send message to Sonoff BASICZBR3 to turn off heater (in case it is still on)
End

The challenge is that the whole system is asyncronous and event driven.

Good luck. Sounds an interesting project for a toasty car.
 
Last edited:
I have a complete server setup at home - there's a firewall running, 40TB of storage on a Debian box running zfs and another Debian box currently running zabbix, unifi, dns and ssh for externals. I might virtualize that at some point, but need more horsepower on the fileserver before I can do that.

Thanks for the reply, I will read thoroughly later and come back. The MQTT stuff is new to me; i have a couple of Pis lying around but will probably specifically dedicate a D2700 to this as it's here, free, and has enough oomph to run debian and spotify and can replace a laptop currently in the kitchen.
 
So I've been thinking about this winter. Yes, we already have frost...

We have the DEFA Termini in the car(s). They are plugged into the wall and run around 2kW of heat into the cabin. I don't want to run this any longer than necessary. I do want to run it long enough for the cabin to be warm in the morning before leaving.
We currently have a Clas Ohlson switch for this and it's pretty good. But it has its own clock, so it's always wrong and I think I can do better.

Right now, I'm thinking about using ZigBee with some Arduinos (or more likely a Wemos D1) to monitor temperature. And then to have a server service running which says "departure time is at 0730, it's -15C, so the car needs to start preheating at 0530. It is 0530, turn the socket on".
This isn't as trivial as I hoped - I picked up an Ikea Trådfri gateway, but it won't do what I was hoping for, certainly not with the thermometer input. I also want a display and override, along with a feedback loop so if the car is "too warm", the heater is turned off again.

Not 100% sure how I'm going to do this, but I figure a temperature sensor in the car and another outside is going to be a starting point. That and a remote-controllable socket. I think I have those things with Zigbee connectivity. The next bit is going to be the automation, after I've connected everything up.

To be continued...
Have you considered Defa Warm Up GPS Link or Defa Warm Up Bluetooth Link? With one of theese you can set the time when you want the heating to start and monitor the temperature in the car on your smartphone.
 
I've nothing but good things to say about Home Assistant. Powers my home cinema set up and some of the heating here. Not used it in a car context though. Ours is running on a RPi 4b which is more than enough for the job.
 
Hmmm ... I love these technical threads, I've just read through all of the above and it's way over my head ... I will stick to thermal socks and a hot water bottle ?
 
Back
Top