Using 5 minute Smappee data
Hi,
So I persevered and managed to find a solution, which hopefully documenting here.
High level:
a) Set up MQTT [I used Mosquitto in a Docker container]
b) Log into Smappee (local) and enable MQTT logging
c) Add MQTT integration to HA
d) Check (MQTT explorer / HA MQTT integration) that your getting data feeding through
e) Add stuff to configuration.yaml to extract data
f) Add Riemann integral to turn power into energy
g) Check numbers match those in dashboard.smappee.net
Note that you can use realtime instead of every 5 minutes, but I felt this would just overload the system.
Equation: (RMS Voltage x RMS Current x Import Active Power)/(RMS apparent power x 10000)
a) Set up MQTT: Various YouTube tutorials and you can run either as docker or other.
b) Login to local smappee – you need to go to something like 192.168.1.110/smappee.html [address will vary depending on your router] it’s worth having this as a DHCP reservation so it doesn’t change when you reboot your router. Then go to ‘Advanced’ and tick the ‘Advanced’ box
Where you can type in the IP of the MQTT broker that you just set up. I initially left it without password just to check it and then can add afterwards/
c) Hopefully OK with setting up integrations – it was just the MQTT one and go into configure
d) Check data is flowing through using MQTT explorer (nice easy download), or you can check for your UUID in the Location Configuration card from dashboard.smappee.net. Should look something like:
57713298-d672-11e7-ac58-022d123456f7
Therefore you need to look at :
servicelocation/57713298-d672-11e7-ac58-123456f7/realtime
This is data published every second, but will show data flowing through if everything is working. Every 5 minutes, it also publishes:
servicelocation/57713298-d672-11e7-ac58-022d123456f7/aggregated
This is the one we’re going to use:
e) Add the following to configuration.yaml – you may need to change depending on which clamps / solar /… you have:
`- name: “AverageRMSCurrentCt0”
state_topic: “servicelocation/57713298-d672-11e7-ac58-022d123456f7/aggregated”
unit_of_measurement: “A”
value_template: “{{ (value_json.intervalDatas[0].channelIntervalDatas[0].averageRMSCurrent|float/1000)}}”
- name: "solar-POWER-smappee"
state_topic: "servicelocation/57713298-d672-11e7-ac58-022d123456f7/aggregated"
unit_of_measurement: "W"
device_class: power
value_template: "{{ (value_json.intervalDatas[0].averageRMSVoltage * value_json.intervalDatas[0].channelIntervalDatas[1].averageRMSCurrent * value_json.intervalDatas[0].channelIntervalDatas[1].averageImportRMSActivePower /(10000*value_json.intervalDatas[0].channelIntervalDatas[1].averageRMSApparentPower ) )|round(3) }}"
`
You can add more to pick out voltage etc, but the above gives the basics – note the device_class of power, this is important if you want to calculate energy.
f) You then need to create a helper function (settings>devices & services >helper) using the Riemann integral function (Name: Solar-ENERGY-smappee
Input sensor: Solar-POWER-smappee
Integration method:Left Riemann sum
precision : 2
Metric prefix: k(kilo)
Time unit: h(hours)
Submit.
g) Wait for some numbers to start flowing through and check against dashboard.smappee.net 5 minute figures , you can download these as csv/Excel– note that the timing may be out by 5 minutes, can’t remember whether it publishes beginning of 5 minute interval or the end.
h) In MQTT explorer you can look for other data published + you can now add the energy into the Energy Configuration in HA.
Let me know how you get on.