Aminorjourney
Well-known member
- Thread starter
 - #1
 
[EDIT: Dec 9, 2023]
Please see THIS POINT in the thread for the latest notes. If you're running old code, please consider updating it with the new code posted in the YAML on that post.
[/EDIT]
Happy Thanksgiving (albeit a day late) for those celebrating. And Happy Friday for those who aren't!
I spent some time yesterday playing with Home Assistant and the FordPass-HA integration, and with a little playing, I've ended up with quite a usable start for a custom card for my Home Assistant Dashboard.
I would LOVE to take all the credit, but it's not actually my doing. I basically adapted this card (from a Tesla owner) with the relevant data from FordPass-HA. I also had to make some templates in order to pull the right data out of the right status messages. It's not finished yet, and ultimately, I'd love to make it work with our Home Integration System so that I can record when power is being fed out of the truck and into the house. Now it's working, I need to figure out some logic to fix things.
Note: Below is my current code - but it's certainly NOT finished yet and there are MANY errors that I need to go back and fix, including some of the conditional statements (which won't work in HA picture cards unless there's just one main status). Please be patient with my terrible code, and if you're going to use it, know that it will break...
The first image was from this morning, when I was running the house off the truck - but I had to fake the status because I've not yet written the right templates to make it work automatically.
The second one was snapped this afternoon while I was grabbing a coffee while my Vectrix VX-1 charged, (and my wife had just returned back home with the truck from the DIY store). I also know that some of the elements are off - and that's going to be in my ToDo list.
Also in my ToDo: Make a similar card for our Chevrolet Bolt EV (which also has a Home Assistant integration), and eventually, do something similar for my Motorbike (which currently doesn't have any telematics, but I have plans...)
FYI, the THIRD image shows the status of the F150 Lightning battery pack on the Energy Flow Plus card, but again, needs work to be super usable. It is NOT recording power flow OUT of the house, or indeed all the consumption, because we don't have current meters on everything yet, and while I have now found a way to potentially pull data from the Home Integration System's Delta Inverter - I haven't looked into it yet. Based on my knowledge of the Delta invert that's part of the HIS, and reading the manuals for installation, I believe we can use the same hybrid ethernet/modbus setup to pull data from it for home automation. But that's for someone better than me.
	
	
	
		
For custom templates, I've added the following into my sensors.yaml file (the file where you custom-define special sensors or parse out data from other states as their own sensors).
	
	
	
		
	
		
			
		
		
	
		
			
		
		
	
	
		
			
		
		
	
	
		
			
		
		
	
		
			
		
		
	
	
		
			
		
		
	
	
		
			
		
		
	
		
			
		
		
	
Please see THIS POINT in the thread for the latest notes. If you're running old code, please consider updating it with the new code posted in the YAML on that post.
[/EDIT]
Happy Thanksgiving (albeit a day late) for those celebrating. And Happy Friday for those who aren't!
I spent some time yesterday playing with Home Assistant and the FordPass-HA integration, and with a little playing, I've ended up with quite a usable start for a custom card for my Home Assistant Dashboard.
I would LOVE to take all the credit, but it's not actually my doing. I basically adapted this card (from a Tesla owner) with the relevant data from FordPass-HA. I also had to make some templates in order to pull the right data out of the right status messages. It's not finished yet, and ultimately, I'd love to make it work with our Home Integration System so that I can record when power is being fed out of the truck and into the house. Now it's working, I need to figure out some logic to fix things.
Note: Below is my current code - but it's certainly NOT finished yet and there are MANY errors that I need to go back and fix, including some of the conditional statements (which won't work in HA picture cards unless there's just one main status). Please be patient with my terrible code, and if you're going to use it, know that it will break...
The first image was from this morning, when I was running the house off the truck - but I had to fake the status because I've not yet written the right templates to make it work automatically.
The second one was snapped this afternoon while I was grabbing a coffee while my Vectrix VX-1 charged, (and my wife had just returned back home with the truck from the DIY store). I also know that some of the elements are off - and that's going to be in my ToDo list.
Also in my ToDo: Make a similar card for our Chevrolet Bolt EV (which also has a Home Assistant integration), and eventually, do something similar for my Motorbike (which currently doesn't have any telematics, but I have plans...)
FYI, the THIRD image shows the status of the F150 Lightning battery pack on the Energy Flow Plus card, but again, needs work to be super usable. It is NOT recording power flow OUT of the house, or indeed all the consumption, because we don't have current meters on everything yet, and while I have now found a way to potentially pull data from the Home Integration System's Delta Inverter - I haven't looked into it yet. Based on my knowledge of the Delta invert that's part of the HIS, and reading the manuals for installation, I believe we can use the same hybrid ethernet/modbus setup to pull data from it for home automation. But that's for someone better than me.
		YAML:
	
	title: Adira Tal - Ford F150 Lightning
type: picture-elements
image: /local/F150Lightningoverhead.jpg
elements:
  - type: state-icon
    icon: mdi:update
    entity: sensor.fordpass_lastrefresh
    tap_action: none
    action: none
    double_tap_action: none
    hold_action:
      action: call-service
      service: script.refresh_ford
    style:
      top: 6.5%
      left: 10%
      color: '#039be5'
  - type: state-label
    entity: sensor.fordpass_lastrefresh
    tap_action: none
    double_tap_action: none
    hold_action:
      action: call-service
      service: script.refresh_ford
    style:
      top: 96%
      left: 53%
      font-size: 100%
      font-weight: normal
      color: rgb(0,0,0)
    prefix: 'Status Last updated: '
  - type: state-label
    entity: device_tracker.fordpass_tracker
    tap_action: none
    double_tap_action: none
    hold_action: none
    style:
      top: 7%
      left: 92%
      font-size: 100%
      font-weight: normal
      color: black
  - type: state-label
    entity: sensor.ford_charge_station_power_flow_template
    tap_action: none
    double_tap_action: none
    hold_action: none
    style:
      top: 6.5%
      left: 28%
      color: black
    prefix: null
  - type: conditional
    conditions:
      - entity: sensor.ford_charge_station_power_flow_template
        state: DISCHARGING
    elements:
      - type: icon
        icon: mdi:home-import-outline
        style:
          top: 6.5%
          left: 49%
          color: green
  - type: conditional
    conditions:
      - entity: sensor.ford_charge_station_power_flow_template
        state: IN_PROGRESS
    elements:
      - type: icon
        icon: mdi:home-export-outline-outline
        style:
          top: 6.5%
          left: 49%
          color: red
  - type: conditional
    conditions:
      - entity: sensor.ford_charge_station_power_flow_template
        state: COMPLETED
    elements:
      - type: icon
        icon: mdi:battery-charging-100
        style:
          top: 6.5%
          left: 49%
          color: green
  - type: conditional
    conditions:
      - entity: sensor.fordpass_firmwareupginprogress
        state: true
    elements:
      - type: icon
        icon: mdi:car-connected
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 6.5%
          left: 83%
          color: green
  - type: conditional
    conditions:
      - entity: sensor.fordpass_firmwareupginprogress
        state_not: true
    elements:
      - type: icon
        icon: mdi:car-connected
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 6.5%
          left: 83%
          color: light grey
  - type: conditional
    conditions:
      - entity: sensor.fordpass_alarm
        state: ARMED
    elements:
      - type: icon
        icon: mdi:shield-car
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 7%
          left: 77%
          color: red
  - type: conditional
    conditions:
      - entity: sensor.fordpass_alarm
        state_not: ARMED
    elements:
      - type: icon
        icon: mdi:shield-alert-outline
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 7%
          left: 77%
          color: black
  - type: conditional
    conditions:
      - entity: lock.fordpass_doorlock
        state: locked
    elements:
      - type: icon
        icon: mdi:lock
        tap_action: none
        double_tap_action: none
        hold_action:
          action: call-service
          service: script.unlock_f150_lightning
        style:
          top: 7%
          left: 70.5%
          color: black
  - type: conditional
    conditions:
      - entity: lock.fordpass_doorlock
        state_not: locked
    elements:
      - type: icon
        icon: mdi:lock-open-variant
        tap_action: none
        double_tap_action: none
        hold_action:
          action: call-service
          service: script.lock_f150_lightning
        style:
          top: 7%
          left: 70.5%
          color: '#039be5'
  - type: conditional
    conditions:
      - entity: status.fordpass_deepsleepinprogress
        state: ACTIVE
    elements:
      - type: icon
        icon: hass:power-sleep
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 7%
          left: 64%
          color: black
  - type: conditional
    conditions:
      - entity: sensor.fordpass_deepsleepinprogress
        state: DISABLED
    elements:
      - type: icon
        icon: hass:power-plug
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 7%
          left: 64%
          color: '#039be5'
  - type: conditional
    conditions:
      - entity: sensor.fordpass_remotestartstatus
        state: Inactive
    elements:
      - type: icon
        icon: hass:power
        tap_action: none
        double_tap_action: none
        hold_action:
          action: call-service
          service: script.remote_start_f150
        style:
          top: 7%
          left: 58%
          color: black
  - type: conditional
    conditions:
      - entity: sensor.fordpass_remotestartstatus
        state: Active
    elements:
      - type: icon
        icon: hass:power
        tap_action: none
        double_tap_action: none
        hold_action:
          action: call-service
          service: script.remote_start_f150
        style:
          top: 7%
          left: 58%
          color: green
  - type: conditional
    conditions:
      - entity: sensor.ford_left_front_tyre_template
        condition: numeric_state
        below: 38
    elements:
      - type: icon
        icon: mdi:car-tire-alert
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 6.9%
          left: 51.5%
          color: red
  - type: conditional
    conditions:
      - entity: sensor.ford_right_front_tyre_template
        condition: numeric_state
        below: 38
    elements:
      - type: icon
        icon: mdi:car-tire-alert
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 6.9%
          left: 51.5%
          color: red
  - type: conditional
    conditions:
      - entity: sensor.ford_left_rear_tyre_template
        condition: numeric_state
        below: 38
    elements:
      - type: icon
        icon: mdi:car-tire-alert
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 6.9%
          left: 51.5%
          color: red
  - type: conditional
    conditions:
      - entity: sensor.ford_right_rear_tyre_template
        condition: numeric_state
        below: 38
    elements:
      - type: icon
        icon: mdi:car-tire-alert
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 6.9%
          left: 51.5%
          color: red
  - type: state-label
    entity: sensor.fordpass_doorstatus
    attribute: REAR_LEFT
    tap_action: none
    double_tap_action: none
    hold_action: none
    style:
      top: 23%
      left: 40%
      color: black
  - type: state-label
    entity: sensor.fordpass_doorstatus
    attribute: DRIVER
    tap_action: none
    double_tap_action: none
    hold_action: none
    style:
      top: 23%
      left: 55%
      color: black
  - type: state-label
    entity: sensor.fordpass_doorstatus
    attribute: REAR_RIGHT
    tap_action: none
    double_tap_action: none
    hold_action: none
    style:
      top: 53%
      left: 40%
      color: black
  - type: state-label
    entity: sensor.fordpass_doorstatus
    attribute: PASSENGER
    tap_action: none
    double_tap_action: none
    hold_action: none
    style:
      top: 53%
      left: 55%
      color: black
  - type: state-label
    entity: sensor.fordpass_doorstatus
    attribute: HOOD
    tap_action: none
    double_tap_action: none
    hold_action: none
    style:
      top: 37%
      left: 74%
      color: white
  - type: state-label
    entity: sensor.fordpass_doorstatus
    attribute: TAILGATE
    tap_action: none
    double_tap_action: none
    hold_action: none
    style:
      top: 37%
      left: 30%
      color: white
  - type: conditional
    conditions:
      - entity: sensor.fordpass_elvehcharging
        attribute: Plug Status
        state: CONNECTED
      - entity: sensor.fordpass_elvehcharging
        attribute: Charge Type
        state_not: AC_BASIC
    elements:
      - type: icon
        icon: mdi:ev-plug-type1
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 24%
          left: 68%
          color: green
  - type: conditional
    conditions:
      - entity: sensor.fordpass_elvehcharging
        attribute: Plug Status
        state_not: CONNECTED
    elements:
      - type: icon
        icon: mdi:ev-plug-type1
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 24%
          left: 68%
          color: red
  - type: conditional
    conditions:
      - entity: sensor.ford_charge_station_power_flow_template
        state: IN_PROGRESS
    elements:
      - type: state-label
        entity: sensor.fordpass_elvehcharging
        attribute: Charging kW
        tap_action: none
        double_tap_action: none
        hold_action: none
        prefix: 'Charging At: '
        suffix: kW
        style:
          top: 19.5%
          left: 82%
          font-size: 100%
          font-weight: normal
          color: green
  - type: state-label
    entity: sensor.fordpass_outsidetemp
    prefix: 'Outside Temperature: '
    tap_action: none
    double_tap_action: none
    hold_action: none
    style:
      top: 16%
      left: 51%
      font-size: 100%
      font-weight: normal
      color: rgb(0,0,0)
  - type: icon
    icon: mdi:thermometer
    tap_action: none
    double_tap_action: none
    hold_action: none
    style:
      top: 16%
      left: 24%
      font-size: 100%
      font-weight: normal
      color: rgb(0,0,0)
  - type: custom:bar-card
    entity: sensor.fordpass_elvehcharging
    attribute: State of Charge
    severity:
      - color: Red
        from: 0
        to: 10
      - color: Orange
        from: 11
        to: 20
      - color: Green
        from: 21
        to: 100
    entity_row: true
    positions:
      icon: 'off'
      name: 'off'
      indicator: 'off'
    animation:
      state: 'on'
      speed: 5
    width: 270px
    tap_action: none
    hold_action: none
    double_tap_action: none
    stack: vertical
    style:
      top: 65%
      left: 53%
      font-size: 100%
      font-weight: normal
      color: rgb(0,0,0)
  - type: conditional
    conditions:
      - entity: sensor.ford_charge_station_power_flow_template
        attribute: Charging Status
        state: IN_PROGRESS
      - entity: device_tracker.fordpass_tracker
        state: home
    elements:
      - type: icon
        icon: mdi:home-lightning-bolt-outline
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 65%
          left: 55%
          color: black
  - type: conditional
    conditions:
      - entity: sensor.ford_charge_station_power_flow_template
        state: IN_PROGRESS
      - entity: device_tracker.fordpass_tracker
        state_not: home
    elements:
      - type: icon
        icon: mdi:ev-station
        tap_action: none
        double_tap_action: none
        hold_action: none
        style:
          top: 65%
          left: 55%
          color: black
  - type: state-label
    entity: sensor.fordpass_elveh
    attribute: null
    style:
      top: 74%
      left: 53%
      font-size: 100%
      font-weight: normal
      color: rgb(0,0,0)
    prefix: 'Estimated range: '
	
		YAML:
	
	-platform: template
  sensors:
     battery_percent_template:
        friendly_name: "Ford battery charge"
        value_template: "{{ state_attr('sensor.fordpass_elveh', 'Battery Charge') }}"
        unit_of_measurement: "%"
        icon_template: mdi:battery
     12v_battery_template:
        friendly_name: "Ford 12V battery"
        value_template: "{{ state_attr('sensor.fordpass_battery', 'Battery Voltage') }}"
        unit_of_measurement: "V"
        icon_template: mdi:battery
     ford_left_rear_tyre_template:
        friendly_name: "F150 rear left tyre"
        value_template: "{{states.sensor.fordpass_tirepressure.attributes.REAR_LEFT}}"
        unit_of_measurement: "PSI"
        icon_template: mdi:car-tire-alert
     ford_left_front_tyre_template:
        friendly_name: "F150 front left tyre"
        value_template: "{{states.sensor.fordpass_tirepressure.attributes.FRONT_LEFT}}"
        unit_of_measurement: "PSI"
        icon_template: mdi:car-tire-alert
     ford_right_rear_tyre_template:
        friendly_name: "F150 rear right tyre"
        value_template: "{{states.sensor.fordpass_tirepressure.attributes.REAR_RIGHT}}"
        unit_of_measurement: "PSI"
        icon_template: mdi:car-tire-alert
     ford_right_front_tyre_template:
        friendly_name: "F150 front right tyre"
        value_template: "{{states.sensor.fordpass_tirepressure.attributes.FRONT_RIGHT}}"
        unit_of_measurement: "PSI"
        icon_template: mdi:car-tire-alert
   
     ford_charging_power_template:
        friendly_name: "Ford_F150_Lightning_Charge_Rate"
        value_template: "{{ state_attr('sensor.fordpass_elvehcharging', 'Charging kW') | float }}"
        unit_of_measurement: "kW"
        icon_template: mdi:truck
   
     ford_charge_station_power_flow_template:
        friendly_name: "Charge_Station_Pro_Power_Flow"
        value_template: "{{ state_attr('sensor.fordpass_elvehcharging', 'Charging Status') }}"
	
	
	
	Sponsored
								
									Last edited: