Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Check whether two numbers are within a range

by stevieb (Canon)
on Feb 26, 2021 at 17:45 UTC ( #11128854=note: print w/replies, xml ) Need Help??


in reply to Re^2: Check whether two numbers are within a range
in thread Check whether two numbers are within a range

I'll also be using two HC-SR04 sonar-based proximity sensors to doubly confirm that the car is actually where it says it is, as I'm also including the ability for the garage door to close once the vehicle is in place, so the GPS is just initial location data to start firing the proximity sensors.

A HC-SR501 PIR sensor will sense motion which will start monitoring GPS for proximity to its proper place in the garage. Once it's within the desired range (2 metres or so), it'll fire the sonar sensors to ensure it's inside the garage so the door can shut. If it's just someone in the garage and the car isn't anywhere near the house, we stop doing all work.

I'm using a Raspberry Pi Zero for the backend API logic which will communicate to a Wemos D1 mini over bluetooth in the garage which will automate the garage door, display the charge level via LED strip, and sound the audible "PLUG IN YOUR DAMNED CAR" warning if battery percent is lower than my desired level.

  • Comment on Re^3: Check whether two numbers are within a range

Replies are listed 'Best First'.
Re^4: Check whether two numbers are within a range
by LanX (Sage) on Feb 26, 2021 at 17:54 UTC
    Cool!

    Nice to see Elon is providing you a Muskberry Pi to play with... ;)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      LOL it's awesome actually. I was always against having a vehicle with so many attack vectors and privacy issues, but the convenience and ability for me to control and monitor it using Perl outweighed all that. If I don't want to be tracked, I use my gas powered technology deprived vehicles :)

      Here's what the API provides if you're interested. Most are for monitoring, but many can be controlled remotely, including summoning the vehicle to me, with nobody in it, from several blocks away (I've tested it). The autopilot and "ludicrous speed mode" are my favourite features. It takes some time to get used to a car driving itself though.

      { "user_id": ********, "api_version": 15, "display_name": "Dream machine", "id_s": "*******", "vehicle_config": { "exterior_color": "Red", "wheel_type": "Slipstream20Carbon", "trim_badging": "100d", "can_actuate_trunks": true, "can_accept_navigation_requests": true, "ece_restrictions": false, "timestamp": 1614360378834, "spoiler_type": "Passive", "seat_type": 0, "rear_seat_type": 7, "charge_port_type": "US", "rear_seat_heaters": 3, "default_charge_to_max": false, "car_special_type": "base", "roof_color": "None", "has_ludicrous_mode": true, "rhd": false, "plg": true, "car_type": "modelx", "has_air_suspension": true, "third_row_seats": "FuturisFoldFlat", "use_range_badging": false, "sun_roof_installed": 0, "motorized_charge_port": true, "eu_vehicle": false }, "backseat_token_updated_at": null, "drive_state": { "heading": ***, "speed": null, "native_type": "wgs", "shift_state": "P", "longitude": -119.*****, "power": 0, "latitude": *********, "timestamp": 1614360378834, "native_location_supported": 1, "gps_as_of": ************, "native_latitude": *******, "native_longitude": -119.******* }, "charge_state": { "charge_miles_added_rated": 172.0, "charger_pilot_current": 48, "charger_actual_current": 0, "charge_miles_added_ideal": 215.5, "charge_current_request": 48, "managed_charging_start_time": null, "charge_port_latch": "Engaged", "charger_power": 0, "managed_charging_user_canceled": false, "est_battery_range": 138.01, "charger_voltage": 0, "scheduled_charging_start_time": null, "charge_limit_soc_max": 100, "usable_battery_level": 72, "trip_charging": false, "charge_port_cold_weather_mode": null, "charge_limit_soc": 90, "battery_level": 72, "charge_rate": 0.0, "charge_port_door_open": false, "scheduled_charging_pending": false, "max_range_charge_counter": 0, "not_enough_power_to_heat": false, "time_to_full_charge": 0.0, "charge_current_request_max": 48, "charging_state": "Disconnected", "fast_charger_brand": "<invalid>", "timestamp": 1614360378834, "user_charge_enable_request": null, "charge_to_max_range": false, "conn_charge_cable": "<invalid>", "managed_charging_active": false, "ideal_battery_range": 249.43, "charge_limit_soc_min": 50, "charge_energy_added": 57.13, "battery_range": 199.1, "charge_enable_request": true, "minutes_to_full_charge": 0, "fast_charger_present": false, "charge_limit_soc_std": 90, "battery_heater_on": false, "charger_phases": null, "fast_charger_type": "<invalid>" }, "vin": "*********", "backseat_token": null, "calendar_enabled": true, "climate_state": { "timestamp": 1614360378833, "is_climate_on": false, "outside_temp": 5.7, "side_mirror_heaters": false, "is_auto_conditioning_on": null, "passenger_temp_setting": 20.0, "battery_heater_no_power": false, "seat_heater_third_row_left": 0, "max_avail_temp": 28.0, "battery_heater": false, "is_preconditioning": false, "seat_heater_left": 0, "fan_status": 0, "driver_temp_setting": 22.0, "min_avail_temp": 15.0, "bioweapon_mode": false, "remote_heater_control_enabled": false, "inside_temp": null, "seat_heater_third_row_right": 0, "seat_heater_rear_right": 0, "is_front_defroster_on": false, "steering_wheel_heater": false, "defrost_mode": 0, "left_temp_direction": null, "wiper_blade_heater": false, "seat_heater_rear_center": 0, "climate_keeper_mode": "off", "is_rear_defroster_on": false, "seat_heater_right": 0, "right_temp_direction": null, "seat_heater_rear_left": 0 }, "color": null, "vehicle_id": ****, "option_codes": "AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W +,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR3 +1,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF +00,ZCST,MI00,CDM0", "command_signing": "off", "gui_settings": { "gui_charge_rate_units": "km/hr", "show_range_units": true, "gui_temperature_units": "C", "gui_distance_units": "km/hr", "gui_range_display": "Ideal", "timestamp": 1614360378834, "gui_24_hour_time": false }, "tokens": [ "************", "************" ], "access_type": "OWNER", "vehicle_state": { "df": 0, "api_version": 15, "fp_window": 0, "remote_start_enabled": true, "center_display_state": 0, "autopark_style": "dead_man", "pr": 0, "valet_mode": false, "sentry_mode": false, "is_user_present": false, "last_autopark_error": "no_error", "locked": true, "speed_limit_mode": { "active": false, "max_limit_mph": 90, "current_limit_mph": 80.029031, "min_limit_mph": 50, "pin_code_set": true }, "dr": 0, "odometer": 33756.279608, "sentry_mode_available": true, "car_version": "2021.4.6 e44dbab07c42", "homelink_device_count": 3, "autopark_state_v2": "ready", "fd_window": 0, "smart_summon_available": true, "homelink_nearby": false, "pf": 0, "rp_window": 0, "timestamp": 1614360378833, "remote_start_supported": true, "remote_start": false, "summon_standby_mode_enabled": false, "software_update": { "expected_duration_sec": 2700, "version": "2021.4.6", "download_perc": 0, "status": "", "install_perc": 1 }, "notifications_supported": true, "rt": 0, "valet_pin_needed": true, "parsed_calendar_supported": true, "ft": 0, "rd_window": 0, "media_state": { "remote_control_enabled": true }, "vehicle_name": "Dream machine", "calendar_supported": true }, "state": "online", "in_service": false, "id": ***** }

        So obviously now the $.vehicle_config.exterior_color property needs to be changeable with a POST . . .

        If you have iOS devices you might be interested in the homebridge plugin.

        (I do not need a new car. I do not need a new car. I do not . . .)

        The cake is a lie.
        The cake is a lie.
        The cake is a lie.

        Thanks, I don't have or need a car, so personally no real need for this. :)

        But one application could be to synchronize your own (renewable) energy production with the capacity of your mobile battery...

        update

        > "bioweapon_mode": false,

        Oh, it can be turned into a "bioweapon"?

        Fancy! Let's look if I can afford it though... ;-)

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11128854]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2021-09-17 18:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?