Anyone know howto read SMA Sunny Beam data into HA?


I have an SMA solar inverter, that outputs production data to a little device called Sunny beam.

You can connect it to a PC via a USB, and read solar production data via an SMA software for windows.

Can this device be connected to HA in order to monitor and make automations based on solar production ?

Would like to know this myself… or maybe existing workarounds…

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.


How do you tell the difference between the 2 types ?
Mine says it is version D with serial nr 14365

When I switch on Bluetooth scanning on my laptop, it only sees my TV, so I guess it will be a 868 MHz version.

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.

Thanks for your post, I tried the sunnybeamtool, it works when I connect the sunnybeam to my laptop, now how to get this in HA ?

Can you post something here if you finished your MQTT bridge ?

$ ./sunnybeamtool -l
Dev #3: 1587 - 002D -SMA Technologie AG - 
Serial Number: 00014365
pac: 93.00 W
e-today: 4.83 kWh
e-total: 32791.53 kWh

2021-05-15 05:00:00:      0 W
2021-05-15 05:10:00:      0 W
2021-05-15 05:20:00:      0 W
2021-05-15 05:30:00:      0 W
2021-05-15 05:40:00:      3 W
2021-05-15 05:50:00:     86 W
2021-05-15 15:30:00:   1347 W
2021-05-15 15:40:00:   1088 W
2021-05-15 15:50:00:    985 W
2021-05-15 16:00:00:    709 W
2021-05-15 16:10:00:    364 W
2021-05-15 16:20:00:      5 W
2021-05-15 16:30:00:      4 W

last month:
2021-04-14:    7.920 kWh
2021-04-15:    8.020 kWh
2021-04-16:   10.730 kWh
2021-04-17:   14.600 kWh
2021-05-14:    7.750 kWh

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.

Fantastic, thx

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.

Hi, I would like to test your custom component.

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 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.

Hi, thx for your development effort, it works :smiley:

It creates 3 sensors

sensor.sunnybeam_energy_today 7.83 unit_of_measurement: kWh friendly_name: sunnybeam_Energy_today icon: mdi:gauge
sensor.sunnybeam_energy_total 32871.09 unit_of_measurement: kWh friendly_name: sunnybeam_Energy_total icon: mdi:gauge
sensor.sunnybeam_power 0.744 unit_of_measurement: kW friendly_name: sunnybeam_Power icon: mdi:flash

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
    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

  • Connect the sunnybeam

  • Reboot Home Assistant

1 Like

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/", line 73, in update
self._data = await self._s_beam.get_measurements()
File "/usr/local/lib/python3.8/site-packages/sunnybeamtool/", 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/", 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/", 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/", line 979, in write
return fn(
File "/usr/local/lib/python3.8/site-packages/usb/backend/", line 837, in bulk_write
return self.__write(self.lib.libusb_bulk_transfer,
File "/usr/local/lib/python3.8/site-packages/usb/backend/", line 938, in __write
File "/usr/local/lib/python3.8/site-packages/usb/backend/", 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)

My Sunny Beam is Bluetooth, has the Bluetooth Symbol bottom right on the silver plastic.

Be nice to be able to read the Bluetooth data

Re Dave

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.

Hi, @dannerph

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.

Had some time and added compatibility. check version 0.1.0 :wink:

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 (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).