The Pandas package is only used for a single method in smappy (get_consumption_dataframe), so as long as you are not using that method you could perfectly omit pandas.
I have updated the package to exclude pandas as a requirement and top level import, so pip install smappy should now work without problems on a raspberry pi.
Also, installing Pandas through pip is not recommended on Linux systems, so you should use sudo apt-get install python-pandas if you plan on using the get_consumption_dataframe method.
I’d like to share my findings on this integration.
The provided script doesn’t work for me, don’t know why but the output is somewhat different from the @doune ones. Also auth is not needed (var0).
These are the scripts I’m using just modifying the awk part:
I’m sorry @doune, didn’t want to offend you or your useful work that let me succesfully integrate smappee in my home-assistant.
I just wanted to highlight having a native component is more elegant than external script dependancies.
I got today new MQTT information from Smapee but this leads for me in more questions then answers. I am not really a MQTT specialist but as I know from other MQTT projects, it is needed that the MQTT topic publisher (Smappee) knows the Brocker Name (IP Adress) and connect with a user name/passwort to transmit the information to the brocker. I use the internal MQTT broker of hassio. This is not mentioned in the documentation. How I can conncect then the Samppee MQTT to my internal broker? Any idea? It would be great if we have a “custom card” specialst here how could build a Sampee custom card with this new parts of information.
(Documentation enclosed)
After some days of hard work I was able to read most interesting values via mqtt from my new Smappee Energy. With some automation and calculation KWh and price for today, month and year is done. Also the Smapee switch can be toggled. All works without the API.
Of course … but lets do it step by step for better overview. Step 1 - Setup Mqtt broker (Mosquitto)
You should start (if currently not already done) setup the Home Assistant (Hass.io) Mosquitto Add-On as the Mqtt broker. The build in Mqtt component will not work with Smappee Energy properly. Steps: Install the add-on, configure the add-on, create an mqtt user in HA with username/password, configure the mqtt component in “Integration” with same username/password. Afterwards visit the mqtt testing documentation (https://www.home-assistant.io/docs/mqtt/testing/) and test the installation. The logfile of the mosquitto add-on will show you if all is correct done. Please come back if this first step is successful done. You should also install a Mqtt “observer” like Mqtt.fx on a PC (e.g. Windows). This is very helpful to check the communication between HA Mqtt brocker and the clients. It will tell you later also the uuid and node-id of your Smappee components. In Mqtt.fx setup a new connection to HA (you need the IP address, mqtt username and password). Now you can subscribe with a “#” all topic which Mosquitto will receive from the Mqtt clients. Later we can do it more specific for the different Smappee topics.
Ok, that sound good. If mqtt with Smappee already running most work is done. The values for consumption and cost are calculated values and not delivered from Smappee. I have the total power value via mqtt. This value will be updated every second. What I do is to sum the total power in a variable as “consumtion in Ws”. In a second variable I divide the ws variable / 3600000 = Kwh ->today. With automation I sum with a trigger at time 00:00:00 KWh_today in variable KWh_month and reset the variable ws_today. In a second automation the trigger is time 00:00:00 with condition day_of_month=1 and reset the KWh_month variable. Same is done for cost calculation. Cost_today is kwh_today *0.25€ (price per KWh) . Month and year calculation same as before. To get a variable option in Hass.io I installed a custom component called “hass-variable” (Link: https://github.com/rogro82/hass-variables) I hope that explained how I did it.
This is my setup:
After having configured smappee to send the information to the mqtt broker (device web interface) and looked for the uuid using a tool like MQTTSpy, I’ve configured the following sensors:
Everything is working fine, only issue is for the switch command where in the since value I need to insert “The timestamp is the number of milliseconds that have passed since Jan 1st, 1970 (UTC).” that I have also in the state topic but I don’t know how to calculate/extract the value.
Without this value I can only read the switch state and not change it.
I’m not an expert with Jinja so any help here is welcome.