Skip to content

Instantly share code, notes, and snippets.

@jrgutier
jrgutier / prepare_the_rivian.yaml
Created December 20, 2023 20:12
HA script to prepare my vehicle according to weather
alias: Prepare the Rivian
sequence:
- repeat:
while:
- condition: state
entity_id: sensor.r1t_power_state
state: Sleep
sequence:
- service: button.press
target:
@jrgutier
jrgutier / gist:dba157e5d7544d819d99b89881740a00
Last active January 6, 2025 01:29
rivian graphql mutations
# From com.rivian.android.consumer.v2.17.0
"mutation acceptDelivery($orderId: ID!) { acceptDelivery(input: { orderId: $orderId } ) { vehicleId } }"
"mutation AcceptVehicleInvite($inviteId: String!) { acceptVehicleInvite(inviteId: $inviteId) { success } }"
"mutation activateSubscription($productId: String!, $vehicleId: String!) { activateSubscription(productId: $productId, vehicleId: $vehicleId) { success } }"
"mutation activateWallbox($wallboxId: String!) { activateWallbox(wallboxId: $wallboxId) { linked } }"
"mutation cancelAppointment($input: CancelAppointmentWorkOrderInput!) { cancelAppointmentWorkorder(input: $input) { id } }"
"mutation cancelSubscription($subscriptionId: String!, $reason: String!) { cancelSubscription(subscriptionId: $subscriptionId, reason: $reason) { success } }"
"mutation CancelVehicleInvite($inviteId: String!) { cancelVehicleInvite(inviteId: $inviteId) { success } }"
"mutation ConsumerReschedule($input: RescheduleWorkOrderAppointmentInput!) { consumerReschedule(input: $input) { fail
@jrgutier
jrgutier / rivian_charging_card-ha.yaml
Created June 15, 2023 21:07
Rivian Charging Curve HA Card
type: custom:config-template-card
variables:
FIND_SPAN: |
temp => {
if (temp == 'unknown') {
return '12h';
}
else {
return temp+'s';
}
@jrgutier
jrgutier / rivian_software_update_notification.yaml
Created March 15, 2023 02:03
Rivian Software Update Notification
alias: Rivian Software Update Notification
description: ""
trigger:
- platform: state
entity_id:
- sensor.rivian_telematics_ota_status_status
condition:
- condition: template
value_template: |-
{{ trigger.to_state.state != trigger.from_state.state and
@jrgutier
jrgutier / rivian_graphql.txt
Last active January 6, 2025 08:57
Rivian Mobile App GraphQL GetVehicleState Attributes
# from apk 2.17.0
activeDriverName
alarmSoundStatus
batteryCellType
batteryHvThermalEvent
batteryHvThermalEventPropagation
batteryLevel
batteryLimit
batteryNeedsLfpCalibration
abrp_request:
url: >
{% set token = "REPLACE_ME_WTH_ABRP_TOKEN" %}
{% set params = [] %}
{% set params = params + ['"utc":' ~ now().timestamp()] %}
{% set params = params + ['"soc":' ~ states('sensor.r1t_battery_state_of_charge')] %}
{% set params = params + ['"lat":' ~ state_attr('device_tracker.r1t_location', 'latitude')] %}
{% set params = params + ['"lon":' ~ state_attr('device_tracker.r1t_location', 'longitude')] %}
{% set params = params + ['"heading":' ~ states('sensor.r1t_bearing')] %}
{% set params = params + ['"speed":' ~ (0 if is_state('sensor.r1t_gear_selector', 'Park') else states('sensor.r1t_speed') | float * 1.609344)] %}
@jrgutier
jrgutier / gist:18c68fc734cc127c33bfe7763ab1105f
Last active December 10, 2022 04:00
Rivian API Vehicle Endpoint Properties
"body/alarm/sound_alarm"
"body/closures/door_FL_locked_state"
"body/closures/door_FL_state"
"body/closures/door_FR_locked_state"
"body/closures/door_FR_state"
"body/closures/door_RL_locked_state"
"body/closures/door_RL_state"
"body/closures/door_RR_locked_state"
"body/closures/door_RR_state"
"body/closures/front_left_window_state"
@jrgutier
jrgutier / synocleanup.sh
Created February 19, 2019 06:34
Clean download directory of Download Station to match what exists in the client
#!/bin/bash
DOWNLOAD_DIR="/volume1/media/downloads/"
COMMAND="find $DOWNLOAD_DIR -maxdepth 1 ! -path '$DOWNLOAD_DIR' ! -name '@eaDir'"
IFS=$'\n'; for i in $(psql -t -A -U postgres -d download -c "SELECT filename from Download_queue"); do COMMAND="$COMMAND ! -name '$i'"; done
COMMAND="$COMMAND -exec rm -rf {} \;"
eval $COMMAND
@jrgutier
jrgutier / gist:0e09f05d6731dcd88dca6400619c6025
Created May 7, 2018 01:15
crontab for letsencrypt and plex on synology
#!/bin/bash
DOMAIN="domain.com"
DIR=yX5cfM
openssl pkcs12 -export -out /volume1/Plex/$DOMAIN.pfx -passout pass: -in /usr/syno/etc/certificate/_archive/$DIR/cert.pem \
-inkey /usr/syno/etc/certificate/_archive/$DIR/privkey.pem \
-certfile /usr/syno/etc/certificate/_archive/$DIR/chain.pem -name $DOMAIN
@jrgutier
jrgutier / eap_proxy_edgeos_ipv6.sh
Created March 17, 2018 00:48
Get ipv6 working with the default eap_proxy interfaces on EdgeOS
#!/bin/sh
PREAMBLE="\x19\x00\x00\x02\x00\x00\x0d\xe9\x30\x30\x44\x30\x39\x45\x2d" # For Pace 5268AC
SERIAL=00000A000000
WAN=eth0.0
LAN=eth1
to_shellcode()
{
counter=0