There are basically two different types of these Sunny Beam devices with either Bluetooth or 868 MHz connection. If you have bluetooth, you could try SBFSpot to MQTT
If your device uses a 868 MHz connection, like mine, there is a command line tool, written in C, that can fetch relevant data via USB.
I am currently working on adding a MQTT bridge for that.
I have seen some pictures with a Bluetooth symbol on the front of the Sunny Beam, there is also a brochure showing the difference. I also figured it out with not finding the inverters via Bluetooth scan.
I will push updates here, once I have something up and running. I decided to port the sunnybeamtool from C to python so that it can be used directly as custom integration. ~20% done.
Hi all,
I created a custom component that fetches the data from the Sunny Beam device via USB. Feel free to test it and give me feedback. In order to get it working, you need to add a udev rule on your host so that non-root users can access the device (details in the readme file). In case you run Home Assistant in docker you also need to allow access of the docker container to the device.
When I ssh into home assistant, there is no /etc/udev directory, I’ll look further tomorrow and connect a keyboard and a monitor directly to the device.
Probably ssh does not connect me directly into the underlying OS.
My HA runs on an O-droid XU4, and to install it, I used the SD card disk image from the HA download site. Is HA also running in a docker file ?
If so, can you tell me howto allow access of the docker container to the device, and add this to the installation instructions in the read.me file on your Github page ?
Have you tried the custom component without the udev rule first? If it is not working, could you send me the error log?
It might be that the home assistant OS is already taking care of all that stuff. (I cannot test it as I run my HA in docker on my Synology NAS).
If I understood it correctly there are two modes for ssh: one using the addon including web console to enter the home assistant core docker container and one (you first need to put your ssh key on a prepared USB Stick for integration) on the host system.
Here is what I did to get it working, it gives some extra info for people that are not so familiar with the linux command line:
Please add some extra comments if there is an easier way to do the same thing.
Download and unzip the code from github
copy the sunnybeam directory to the HA config/custom_components directory
Put the sunnybeam configuration into your configuration.yaml file
sunnybeam:
scan_interval: 10
Add the udev rule
To add the udev rule that allows non root users, you really need to be an the OS of the device that runs Home Assistant, and to be able to access that, I needed to connect a keyboard and a screen to my raspberry.
You cannot get there if you use the HA Terminal & SSH addon, because that will bring you to the command line of the HA docker container.
Login as root on the HA raspberry pi (by default there is no password)
Then type login, this will bring you to the linux command line.
Then issue following commands
Don’t type things behind the # sign, it is a comment I add to explain what the command does.
cd /etc/udev/rules.d # goto the directory where you need to create the rule
touch 99-sma-sunny-beam.rules # this creates the rule file
vi 99-sma-sunny-beam.rules # open the file with the vi text editor
i # Type i to put the editor in insert mode
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1587", ATTRS{idProduct}=="002d", MODE="666" # type the rule
push the escape key, followed by :wq # to save the file and exit the text editor
Every few days HA stops reading data from Sunnybeam.
Disconnecting and reconnecting the sunnybeam does not help, a HA reboot fixes it for a few days.
Any ideas on how to solve this ?
I find this in the HA log
Traceback (most recent call last):
File "/config/custom_components/sunnybeam/__init__.py", line 73, in update
self._data = await self._s_beam.get_measurements()
File "/usr/local/lib/python3.8/site-packages/sunnybeamtool/sunnybeamtool.py", line 47, in get_measurements
if not self.__connected or not await self.__do_syn_online():
File "/usr/local/lib/python3.8/site-packages/sunnybeamtool/sunnybeamtool.py", line 250, in __do_syn_online
resu = await self.__send_raw_message(cmd_syn_online, False)
File "/usr/local/lib/python3.8/site-packages/sunnybeamtool/sunnybeamtool.py", line 164, in __send_raw_message
return self.__dev.write(endpoint=0x02, data=msg, timeout=1000)
File "/usr/local/lib/python3.8/site-packages/usb/core.py", line 979, in write
return fn(
File "/usr/local/lib/python3.8/site-packages/usb/backend/libusb1.py", line 837, in bulk_write
return self.__write(self.lib.libusb_bulk_transfer,
File "/usr/local/lib/python3.8/site-packages/usb/backend/libusb1.py", line 938, in __write
_check(retval)
File "/usr/local/lib/python3.8/site-packages/usb/backend/libusb1.py", line 604, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 19] No such device (it may have been disconnected)
Hi @mbbs1024,
sorry I have not seen your post, please either tag me (@dannerph) or create a GitHub issue.
Is the error still appearing with the latest version 0.0.2?
I got the same request via E-Mail. Unfortunatelly, I am not able to test/debug it.
If you are able to compile very simple C code, could you try if the original code is working to read out the data from the Sunny Beam Bluetooth device via USB? (It might be required to adjust the product id in line 502)
If that does not work, the bluetooth version might use a diferent communication protocol.
I tried to add the Sunnybeam data into the new energy component, but none of the Sunnybeam entities is present in the dropdownbox.
When I look at the documentation, it says that this is a bug in the integration providing the entity. Can you have a look at this please
If I understand the issue, it seems to be some kind of declaration that is missing,
but as I am not a software developper, I could very well be wrong about this.
@dannerph
Thanks a lot, I can add it to the energy component now.
Tomorrow I will see if the solar production data shows up in the graph.
Is there a way to multiply the output with a factor 2.3 ?
I have 2 solar systems, they have the same orientation, but I can only get the data of the one with the Sunny beam in HA.
Basically, I would use template sensors for that. Unfortunately, template sensors only support state_class: measurement so far, not total_increasing, which would be required in your case to enable the use in the energy dashboard.
Your situation is not the common case, so I am a little bit reluctant to implement it directly in the sunny beam component. However, you could fork my code and edit the sensor.py (line 80 and 82) to multiply the values before they are set (could be hardcoded, I guess there will be only rare updates on this component in the future).