PVOUTPUT uploader via nodered

I simplified the code here a bit and made it much cleaner. Still gets you the same result.
Just put the following in function node and change the necessary HA states.
Add moment to the setup modules in your function.

var d = moment().format("YYYYMMDD");
var t = moment().format("HH:mm");
var v1 = global.get("homeassistant.homeAssistant.states['sensor.solar_daily_energy_peak'].state")*1000;
var v2 = global.get("homeassistant.homeAssistant.states['sensor.total_solar_power'].state");
var v3 = global.get("homeassistant.homeAssistant.states['sensor.consumed_daily_energy_peak'].state")*1000;
var v4 = global.get("homeassistant.homeAssistant.states['sensor.total_consumed_power'].state");
var v5 = global.get("homeassistant.homeAssistant.states['sensor.edmonton_temperature'].state");
var v6 = global.get("homeassistant.homeAssistant.states['sensor.utility_2_voltage'].state");
msg.payload = {
    d: d,
    t: t,
    v1: v1,
    v2: v2,
    v3: v3,
    v4: v4,
    v5: v5,
    v6: v6
}
msg.action = msg.payload
msg.headers = { 
    'X-Pvoutput-Apikey': 'b34t98sidf***************8888a4c',
    'X-Pvoutput-SystemId': '*****',
    'Content-Type': 'application/x-www-form-urlencoded'
};
msg.url = "http://pvoutput.org/service/r2/addstatus.jsp";
return msg;