Home Assistant - New Zealand

I now have the same errors with “Failed to fetch usage data…” - I turned on debug logging for this component and now see that I’m getting a “502 Bad Gateway” - so something @codyc1515 will need to investigate I suspect.

1 Like

Make that 4, plus a couple of guys at work are using HA.

anyone got “Energy Online”, Formally Frank data?

Can you open their website and see if they expose an API via “Log Network Activity” within Edge\Chrome?

I learnt about this yesterday with Contact (I’m not a developer, just curious) and found out more about their API.

buggered if I know what i’m looking for, i’ll read up some more

Essentially you’re trying to decipher the url’s that the customer facing website is accessing.

Since posting the above I’ve learnt that it’s far easier to use a tool called Postman that you can use in conjunction with their browser plugin to capture exactly what is happening when you access their normal customer website.

You end up with the urls needed to access your data and the data it returns in JSON format… this is valid for any website you want to get data off for Home Assistant.

2 Likes

epic, awesome that all worked after a bit of a learning curve :slight_smile: NOW, how to use it, :slight_smile:

1 Like

If it is a single URL you want to repeatably get data from then something like the Curl integration or the RESTful integration you should be able to use for your own instance.

Perhaps something like…

sensor:
 - platform: command_line
   name: Get Frank Energy Sensor
   command: 'curl -X GET https://api.frankenergy.co.nz/usage'
   value_template: '{{ value_json.key }}'

If you click the </> code button in Postman it spits out the curl command you require…

image

Obviously people like @codyc1515 have taken that information and written a Python add-on which many others can then use.

1 Like

After 7 weeks I finally got my Ioniq 5 back (faulty BMS) so I’m back into trying to get the SoC into Home Assistant. I first tried reading the results from my existing OBDLink CX via BLE but didn’t have much luck. In the end I ordered one of the Wican devices from Mouser, I ordered it on the 20th and it arrived today (to Christchurch) for NZ$70 including shipping with Fedex. I’ve only had about an hour to play with it but I have the basics working, I used the instructions from here. One comment is that you’ll probably want to use an extension cord to hide the device under the dash, it’s a lot taller than my OBDLink and sits above the accelerator so I’m a bit worried about kicking it when getting in and out of the car.

Edit: I just noticed you’re already in that thread!

1 Like

Yeah, how are you getting on getting anything other than PID 91 out of it?

Yeah, I’ve ordered one of these.

I had it working for just PID 91 via requests through MQTT, the number I was getting back for BattPackRemain doesn’t seem to match what’s in car scanner, for example the number coming back via MQTT is currently 73.8% (rounded) but Car Scanner reports 76% for SoC Display (and 74.5% for SoC BMS).

The rest of the numbers are returned when I trigger the query via Car Scanner, CumChargeEnergy, AuxBatteryVoltage and SoCBMS being returned via MQTT all seem to match what Car Scanner reports.

I need to do a lot more learning…

1 Like

How did you get it to come up on the Bedroom TV?

Is the weather station you use local?

Does anyone know how to get NZ transport timetables into Home Assistant? I’m trying to grab the ones from the Dunedin City Council website and perhaps Airport data as well.

If no API is published then you need to resort to finding out where the public facing website is getting its data. Have a look at my post Home Assistant - New Zealand - #117 by timwelch where I describe using Postman to grab data urls.

I quickly ran it on the bus timetable website and worked out that you could easily pull bus data for a specific stop using JSON values…

Then you’d add it as a REST sensor in your configuration.yaml file like…

rest:
  - resource: https://orc.mattersoft.fi/timetable/rest/stopdisplays/59005013
    scan_interval: 60
    sensor:
      - name: "Next Bus Destination"
		value_template: "{{ value_json['nextStopVisits'][0]['directionOfLine']['destinationName'] }}"
	  - name: "Next Bus Due"
		value_template: "{{ value_json['nextStopVisits'][0]['stopVisits'][0]['scheduledArrivalTime'] | timestamp_custom('%H:%M', true)}}"
	  - name: "Scheduled Minutes Until Departure"
		value_template: "{{ value_json['nextStopVisits'][0]['stopVisits'][0]['scheduledMinutesUntilDeparture']

It took me a while to work out the JSON path structure in the REST sensor but https://jsonpath.com/ is your friend here.

Hope this helps. Tim

They may use GTFS General Transit Feed Specification (GTFS) - Home Assistant

Do a search on your provider’s website. I found one for ChCh once, but then we moved to an area not serviced by buses, so gave up.

Wow! That’s pretty handy if you live somewhere serviced.

Looks like ORC publish one here - Otago Regional Council GTFS - OpenMobilityData

Saw this thread recently too.

Also quick question re the contact integration, It’s giving me 3 sensors. Do we enter contact energy usage, cumption & free energy consumption into grid consumption? I assume its best to write it the Kwh from the bills after that as well?