OH3: Powerfox smartmeter HTTP-Binding issues

Hello everyone.

A few years ago I installed a powerfox smartmeter via the http-Binding and all worked well…
…until recently.
Without beeing aware of any change to the system the powerfox http-Binding setup stopped working and startet logging error messages.
Does anyone using the powerfox smartmeter in combination with htpp-Binding experience similar issues?
Does anybody have a idea of what’s wrong/what could fix the issue?

To me the error messages appear to indicate an issue with authorization but neither the http-Binding Thing setup (user/password) nor the powerfox cloud account (user/password) have changed.
I’m still able to access the powerfox data thru the app on my Android phone (hence user and password apparently are correct).

Any help is highly appreciated!

Hardware/OS:
OpenHAB 3.2.0 Release Build
Raspberry Pi 4b 8MB
Debian GNU/Linux 11 bullseye 64bit

Thing:

Thing http:url:powerfox "Powerfox" [ 
	//baseURL="https://example.com/api/v1/metadata-api/web/metadata", 
	baseURL="https://backend.powerfox.energy/api/2.0/my/main/current", 	         
	refresh=30,		//seconds
	timeout=3000,	//ms
	contentType="application/json",
	bufferSize=2048,
	delay=0,
	username="ANONYMIZED@ANONYMIZED.DE",
	password="ANONYMIZED",
	authMode="BASIC",
	stateMethod="GET",
	commandMethod="GET",
	ignoreSSLErrors=false
]
	//headers="user=ANONYMIZED@ANONYMIZED.DE", "password=ANONYMIZED",
	{
		Channels:
			//Type string : text "Text" [ stateTransformation="JSONPATH:$.metadata.data" ]
			Type number : Watt			"aktueller Leistungswert"	[ mode="READONLY", stateTransformation="JSONPATH:$.Watt" ] 
			Type number : Timestamp		"last Update"				[ mode="READONLY", stateTransformation="JSONPATH:$.Timestamp" ]
			Type number : a_Minus		"A-Minus"					[ mode="READONLY", stateTransformation="JSONPATH:$.A_Minus" ]
			Type number : a_Plus		"A-Plus"					[ mode="READONLY", stateTransformation="JSONPATH:$.A_Plus" ]
	}	

Items:

Number		stromzaehlerCurrentPowerConsumption	"Aktuelle Leistungsaufnahme [%.0f W]"	<energy>	(gStromzaehler)	["Power"]		{channel="http:url:powerfox:Watt", alexa="RangeController.rangeValue" [supportedRange="1:10000:1"]}
Number:Time	stromzaehlerlastUpdate				"Last update (ms since Jan-1970)"		<time>		(gStromzaehler)	["Measurement"]	{channel="http:url:powerfox:Timestamp"}
String		stromzaehlerlastUpdateDate			"Last update"							<time>		(gStromzaehler)	["Measurement"]	{channel="http:url:powerfox:Timestamp" [profile="transform:JS", function="unixToDateTime.js"]}
Number		stromzaehlerAMinus					"Energie-Einspeisung [%.3f kWh]"		<energy>	(gStromzaehler)	["Energy"]		{channel="http:url:powerfox:a_Minus" [profile="transform:JS", function="divide_1000.js"]}
Number		stromzaehlerAPlus					"Energie-Verbrauch [%.3f kWh]"			<energy>	(gStromzaehler)	["Energy"]		{channel="http:url:powerfox:a_Plus"  [profile="transform:JS", function="divide_1000.js"]}

 

Here are the error messages from the log:

2022-04-25 15:16:44.462 [WARN ] [.transform.SingleValueTransformation] - Executing transformation ChannelStateTransformation{pattern='$.A_Minus', serviceName='JSONPATH'} failed: Invalid path '$.A_Minus' in '<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
    <title>powerfox</title>
    
    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
    <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
    
    <link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="/css/site.css" />
    <link rel="stylesheet" href="/css/powerfox.css" />
</head>
<body>
    
<div class="nav-page">
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark nav-powerfox">
        <a href="/" class="navbar-brand">
            <img src="/icon_inverse.png" class="icon-banner">
            powerfox
        </a>
    
    </nav>
</div>
   
    <div class="container body-container">
        
<div class="login-page">
    <div class="lead">
    </div>
    
    <div class="row">
            <div class="col-sm-6">
                <div class="card">
                    <div class="card-header card-header-powerfox">
                        <h2>powerfox Account</h2>
                    </div>
                    <div class="card-body">
                        <form action="" method="post">
                            <input type="hidden" id="ReturnUrl" name="ReturnUrl" value="/connect/authorize/callback?client_id=bEXms6LiQoDIj2wqIv8r8NJ1D7CS5vH3cW8kf1NIJg&amp;redirect_uri=https%3A%2F%2Fbackend.powerfox.energy%2Fsignin-oidc&amp;response_type=code&amp;scope=openid%20profile%20api%20partner&amp;code_challenge=lTQmQQaDubOgnWlgk7aGmvkVxvR5NhoJCFtpG0KCKus&amp;code_challenge_method=S256&amp;response_mode=form_post&amp;nonce=637864894043623010.NDQ3ODNlNTUtN2U2OC00ODYxLWFjNTEtNWFlZDc5MTI1MjA4NjRiMGY3ZDEtYjZhMC00Mzg2LTg4OTItNjkwODdiMTdiZmFj&amp;state=CfDJ8KpzxmxZVg5EqCtfGqPRr8avjgayLdcSih9k9Z45nq9eARLAZjdpUzFkeAEzFODsCHmDjsg_5dKK_lbPaXcPUGH3kZ-gcExpdv3RPT2Vn6MVT54nQzR2OkBGAOnQB4jBErpBaneXgAY5FNc7L11vNAwXv-Ey2bODRcVSqiSpIcQZzsw5qwhNcvKNSmUDzKo9DmJB6SminKreuxi3N9kWH0StwZux93O0Xq9DBmHMuxz5dDJuCMQkrf9N2YrB86Ygw8pI4EJ0z1nwhmfGalGQ3JEYFHU5YU66PsObkTE1bStcATM2MK58x4w_0YO8FMBOn_HpeMnQqRi5pUFuPUGmYDGXUHVVaw8flMa6559f7xASfBpvC3RTDEd7DQS2v02j_sHJ0f4UHbq1FH0fOk1_T65U0YjdvaZAk-DsQtH3tUEO&amp;x-client-SKU=ID_NETSTANDARD2_0&amp;x-client-ver=5.5.0.0" />
                            <div class="form-group">
                                <label for="Username">Username</label>
                                <input class="form-control" placeholder="Username" autofocus type="text" data-val="true" data-val-required="The Username field is required." id="Username" name="Username" value="">
                            </div>
                            <div class="form-group">
                                <label for="Password">Password</label>
                                <input type="password" class="form-control" placeholder="Password" autocomplete="off" data-val="true" data-val-required="The Password field is required." id="Password" name="Password">
                            </div>
                            <button class="btn btn-primary btn-powerfox-green" name="button" value="login">Login</button>
                            <button class="btn btn-primary btn-powerfox-blue" name="button" value="cancel">Abbrechen</button>
                        <input name="__RequestVerificationToken" type="hidden" value="CfDJ8H4De7d14ylClob3YZELOwFeLB5X8ncy5tfJI6ByAsVEyqzbugnoTO0qt4D3QzOhhBw-WyaDMXXJQEcjItvapc6jz3EUbXPn6GkG_POfZpdTbMLmyMR52lzw4NHWedS3rJL9O-uUXVJdxHMPPISENLg" /></form>
                    </div>
                </div>
            </div>
    </div>
</div>
    </div>
    <script src="/lib/jquery/dist/jquery.slim.min.js"></script>
    <script src="/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    
</body>
</html>
'

Thanks and kind regards,
Ralph…

I figured out a work around:
Apparently the http binding parameters username and password no longer work for the powerfox smartmeter.

I found that avoiding the bindings “username” and “password” (and “contentType”) parameters while instead utilizing the “headers” parameters instead to be working.
The working Thing config noow looks like that:

Thing http:url:powerfox "Powerfox" [
	baseURL="https://backend.powerfox.energy/api/2.0/my/main/current",
	headers="content-type=application/json", "Authorization=Basic VeryLongCrytipcCharacterString",  //Diesen Wert habe ich vom Chrome "Advanced Rest Client" HeaderName "Authorization" dann auf "Stift"(ändern) klicken und dort User + PW eingeben => dieser code!
	//über Angabe der Binding Parameter username und password ging es seit April 2022 nicht mehr!
	refresh=30,			//seconds
	timeout=6000,		//ms
	bufferSize=2048,  
	delay=0, 
	stateMethod="GET"
]  
	{
		Channels:
			//Type string : text "Text" [ stateTransformation="JSONPATH:$.metadata.data" ]
			Type string : Reply			"Antwort"					[ mode="READONLY", stateTransformation="JSONPATH:$" ]
			Type number : Watt			"aktueller Leistungswert"	[ mode="READONLY", stateTransformation="JSONPATH:$.Watt" ] 
			Type number : Timestamp		"last Update"				[ mode="READONLY", stateTransformation="JSONPATH:$.Timestamp" ]
			Type number : a_Minus		"A-Minus"					[ mode="READONLY", stateTransformation="JSONPATH:$.A_Minus" ]
			Type number : a_Plus		"A-Plus"					[ mode="READONLY", stateTransformation="JSONPATH:$.A_Plus" ]
	}	

The “VeryLongCrytipcCharacterString” (used for the headers parameter) I’ve generated using the chrome browser extension “Advanced Rest Client” where I entered a GET Request for https://backend.powerfox.energy/api/2.0/my/main/current
added a header “Authorization” and clicked on the little “pencil” icon to enter username and password.
The result is a VeryLongCrytipcCharacterString which can be used in the “headers” parameter of the http binding as outlined above (see screen shots below for details).

Enter your powerfox username and password:

And here you find your “VeryLongCrytipcCharacterString” you need for the headers parameter:

I thought that some of you experiencing the same issue might find this helpful!?

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.