I’m very close to getting a working script, well its working and has been for the last few days but not finalised as adding some features and tidying it up quite a bit. I have finalised a few issues I have had so very close to testing my readme on my parents pi and flukso setup and then release it if all goes well. hopefully not too far away.
you will need to organise a Raspberry Pi (I have a 2b running Raspbian bullseye and its working fine on that) but I cant see it not working on any Pi with any raspbian image. or literally any other device (preferably linux) that can run python and a few other dependencies and that runs 24/7
my parents pi is a 1b with an unknown raspbian image so will see how that goes.
the home assistant code is this I did save it for future use but as I couldn’t get HA working on my pi2 so I cant use it.
In the situation that the Flukso Server ever stops, Home assistant can send automatically to PVOutput - I have it setup this way “just in case”. Basically, you leave PVOutput configured to obtain the readings from the Flukso API, and in parallel you use the following code to send the same data to PVOutput via Home assistant. If Flukso API goes down it will be supplemented by the Home Assistant data and vice versa.
Note- This is documented in the PVOutput site here:
https://pvoutput.org/help/api_specification.html#id1
# For PVOutput sending
sensor average_production:
- platform: average
name: Mqtt Production Average
duration:
# # supports seconds, minutes, hours, days
# #days: 1
# hours: 3
minutes: 5
entities:
- sensor.mqtt_production
sensor average_consumption:
- platform: average
name: Mqtt Consumption Average
duration:
# # supports seconds, minutes, hours, days
# #days: 1
# hours: 3
minutes: 5
entities:
- sensor.mqtt_consumption
rest_command:
pvoutput_generation:
method: POST
url: <a href="https://pvoutput.org/service/r2/addstatus.jsp<br />
" title="https://pvoutput.org/service/r2/addstatus.jsp<br />
">https://pvoutput.org/service/r2/addstatus.jsp<br />
</a> headers:
X-Pvoutput-Apikey: "your long api here"
X-Pvoutput-SystemId: "your pvoutput system id here"
payload: 'd={{now().strftime("%Y%m%d")}}&t={{now().strftime("%H:%M")}}&v2={{states.sensor.mqtt_production_average.state|round(0)}}&v4={{states.sensor.mqtt_consumption_average.state|round(0)}}&v5={{states.sensor.clientraw_temperature.state|round(1)}}&v6={{states.sensor.mqtt_voltage.state|round(1)}}&c1=1'
content_type: "application/x-www-form-urlencoded"
Add the following Automation as well:
Add this to automations.yaml
- id: '1670815888407'
alias: PVOutput Uploader
description: Uploads values to PVOutput
trigger:
- platform: time_pattern
minutes: /5
seconds: '0'
condition: []
action:
- service: rest_command.pvoutput_generation
data: {}
mode: single