Tom Eilers Posted Monday at 07:20 PM Report Posted Monday at 07:20 PM I have a Homewizard P1 meter, from which I want to read only the power in Watt with LabView. There API version 2 see: https://helpdesk.homewizard.com/en/articles/5935977-integrating-energy-with-other-systems-api uses HTTPS. They have an example to read the P1 with curl (curl https://<IP ADDRESS>/api/measurement --insecure -H "Authorization: Bearer EXAMPLE-TOKEN". With system exec I can read the P1 meter values. My question is it possible to do this in pure LabView HTTP Get/Set and Header vi's and How. In my case I use url: https://192.168.178.109/api/measurement --insecure -H "Authorization: Bearer 010183D11FD0A5F08990D911BBFF3995" P1 meter API v2.vi Quote
Phillip Brooks Posted yesterday at 02:59 PM Report Posted yesterday at 02:59 PM You can add the Header to your session handle prior to making the endpoint query. An example can be found here: Re: Not able to connect to a web server - NI Community Quote
Tom Eilers Posted yesterday at 07:41 PM Author Report Posted yesterday at 07:41 PM I followed the https://forums.ni.com/t5/LabVIEW/Not-able-to-connect-to-a-web-server/m-p/4057121/highlight/true#M1164115 example and made my changes My vi always gives error: LabVIEW: (Hex 0x58BF3) LabVIEW could not verify the authenticity of the server. I have no idee if the --insecure option is at the right place. P1 meter labview.vi Quote
Phillip Brooks Posted 7 hours ago Report Posted 7 hours ago --insecure is a curl argument. You don't need to include that in the headers. You can do the equivalent of --insecure by setting verify server to False when creating the HTTP session. Quote
ShaunR Posted 6 hours ago Report Posted 6 hours ago 1 hour ago, Phillip Brooks said: --insecure is a curl argument. You don't need to include that in the headers. You can do the equivalent of --insecure by setting verify server to False when creating the HTTP session. Should never do this. Anyone can sit between you and the server and decode all your traffic. The proper way is to add the certificate (public key) to a trusted list after manually verifying and checking it. What's the point of using HTTPS if you are going to ignore the security? Quote
Tom Eilers Posted 4 hours ago Author Report Posted 4 hours ago Thank you. Setting verify server to false did it. Why Home wizard made there API V2 this way, is not to me. There API version 1 was not HTTPS, but they made new version 2 with HTTPS. Anyhow if you want to read my electricity meter you need a token first, what is send by the Home wizard P1 meter device after pressing the button on the HW P1 device. See https://api-documentation.homewizard.com/docs/getting-started P1 meter labview.vi Quote
Phillip Brooks Posted 1 hour ago Report Posted 1 hour ago As Shaun mentioned, it is preferred to use a secure connection. The link you provided above has API documentation that includes a certificate that you can use: Authorization | HomeWizard Energy API Documentation Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.