In order to control those switches, I successfully built myself a CUL (Arduino plus a 433MHz RF-device - like this) running culfw/FHEM. Is it possible to use this device with HASS at all? I guess, a connection to HASS through pilight might be possible but I would rather prefer a ânativeâ implementation.
I also would be interested to get the CUL-USB Stick running.
I am considering to switch from FHEM to HASS, and I already have the CUL-USB Stick
and some components for that environment.
do you got any solution for your problem? Iâm actually using a culfw (Arduino Nano + CC1101 433mhz module) with pimatic but I also like to switch to HASS.
If youâre running FHEM you could properly use a www request to call your devices via FHEM? Have you tested this? This might be just a work arround but maybe it works?
It didnât work as I thoughtâŚfor now I will use another 433 mhz receiver and sender connected directly to my raspberrypi via gipoâŚIâm still looking forward for a solution of using my Arduino Nano + cc1101 via a serial port.
I found a solution for my problem. With the pyserial libary you can send commands to the cul. Look at the cul commandref for the commands. I wrote a little script which sends the intertechno command to the cul. After that I defined some Home Assistant command line switches. Next thing to do is to receive the commands and change the state of the HA switch.
Example for the python script:
import serial
ser = serial.Serial(port=â/dev/ttyUSB0â, baudrate=38400, bytesize=8, parity=âNâ, stopbits=1)
ser.write((âis00FFFF0FFF0Fâ+â\nâ).encode())
ser.close()
Hi sti0,
Thank you for digging in and posting your solution. I would very much appreciate if this could be picked up and developed further. As you mentioned, for a proper implementation of those switches receiving commands is almost as necessary as sending âŚ
I solved the receiving problem as well. I wrote a python script which uses pyserial to read the information of the cul in an endless loop. If a specific code (e.g. i512345 = on) is written, the scripts updates the switch status by using the HA api. The script runs on startup of my raspberry.
Pro:
the serial port is already open, so you can simply send messages via echo to the cul (unix e.g. echo âis00FFFF0FFF0Fâ > /dev/ttyUSB0). This works in no time! You donât have to open a serial port or use a pyhton script to send a command to the stick.
Con:
very basic implementation at the moment. If I want to include new switches in HA I have to implement them on the python script as well. But itâs working well so far
If you need any further information. Let me knowâŚ
Nice to see some progress here. Im also on FHEM atm but considering alternatives. A working miniCUL / nanoCUL intertechno protocol integration for wall switches is the last thing thats not supported but essential for me.
This is very interesting. I have currently a FHEM on Pi configuration with 2 CUL sticks (homemade), 1 on 433 Mhz and 1 on 868 Mhz. The 433 Mhz CUL is used for (dutch KIKU) InterTechno switches, the 868 Mhz CUL is used for communication with 5 EQ3 Max! Radiator Thermostats.
Iâam trying to migrate to HASS with my home automation. Is anyone working on CUL integration for HASS?
So, itâs time to warm this topic up again.
I hope Iâm not getting too much off topic here.
Iâm also thinking about moving from FHEM to HA. Currently Iâm playing around with a hassbian installation on a spare Raspi3.
I did get the CUL to work like sti0 discribed. After I installed pyserial it worked with:
import serial
ser = serial.Serial(port='/dev/ttyUSB0', baudrate=38400, bytesize=8)
ser.write(('isFFFF00000FFF'+'/n').encode())
ser.close()
so without the parity and stopbits parameters in the serial definition.
Altough I could switch my plugs through python3 my_pythonscript.py I found out that âimport serialâ doesnât work with hassbian. So creating python scripts in /python_scripts and calling them as services in HA does not work.
I read around and found out that AppDaemon is the way to go. I installed it and started reading some tutorials.
When I was not getting anywhere (fast enough) I thought of a way of calling python3 scrips through shell command.
Now my trouble starts: The python scrips donât work anymore. Using picocom i can still turn the plugs on and off (e.g. with âisFFFF00000FFFâ for on and âisFFFF00000FF0â for off)
so there seems to be some trouble with the pyserial lib?
I uninstalled Appdaemon (pip3 uninstall appdaemon) and uninstalled and reinstalled pyserial. Still no effect. Iâm out of ideasâŚ
Any tipps and hints anyone?
Hey sti0,
I followed your pyhton script.
I use some kind of nano cul which should be a derivate from the original.
With FHEM itâs working fine anyway.
Do I miss something?
Script:
#!/usr/bin/python
import serial
ser = serial.Serial(port=â/dev/serial/by-id/usb-SHK_NANO_CUL_433-if00-port0â, baudrate=38400, bytesize=8, parity=âNâ, stopbits=1)
ser.write((âis0000F0FF0FFFâ+â\nâ).encode())
ser.close()
Iâm not using this solution anymore. Itâs long ago, I canât remember how itâs workingâŚmaybe you should consider ESPHome as alternativ which is easy to setup and is well integrated into HA.