mahil4711 / fiat_vehicle_mqtt

Access Fiat Uconnect vehicle data and send it periodically to an MQTT broker
MIT License
2 stars 0 forks source link

integrate the information on the tires #2

Closed dsigmoun closed 3 weeks ago

dsigmoun commented 3 weeks ago

I have another question :-) Would it be possible to integrate the information on the tires? In fact, I am on jeedom and I have a raspbery that runs under HA only for my fiat... and I use https://github.com/wubbl0rz/FiatChamp This module also returns information on the state of the tires.

Thanks !

mahil4711 commented 3 weeks ago

integrated with last update

dsigmoun commented 3 weeks ago

I also added these lines in order to have the warnings in binary 👍

  'tyre_pressure_front_left_warning' => $x['vehicle'][$vin]['status']['vehicleInfo']['tyrePressure']['0']['warning'],
  'tyre_pressure_front_rigth_warning' => $x['vehicle'][$vin]['status']['vehicleInfo']['tyrePressure']['1']['warning'],
  'tyre_pressure_rear_left_warning' => $x['vehicle'][$vin]['status']['vehicleInfo']['tyrePressure']['2']['warning'],
  'tyre_pressure_rear_right_warning' => $x['vehicle'][$vin]['status']['vehicleInfo']['tyrePressure']['3']['warning'],
mahil4711 commented 3 weeks ago

Not sure if this makes sense. When there is a problem I assume than the status field will switch from "NORMAL" to whatever. In the output of my car the value of the warning field is empty. Do you have an example value for the warning field?

dsigmoun commented 3 weeks ago

the warning value returns "False" or "True". This allows me to easily manage the condition of the tire. . image

image

mahil4711 commented 3 weeks ago

ah ok, this makes sense. For my car this field is just empty. I assume you know now how to extend the data. If you uncomment the print_r statement in line 141 of https://github.com/mahil4711/fiat_vehicle_mqtt/blob/main/fiat_mqtt.php

// This will print out all possible data which could be read from the Fiat API // print_r($x);

you will see all available data.

dsigmoun commented 3 weeks ago

Thanks. However, my logs are limited in number of lines and I don't see everything.

2024-09-28T15:42:09.952511913Z                                             [distanceToEmpty] => Array
2024-09-28T15:42:09.952526231Z                                                 (
2024-09-28T15:42:09.952545368Z                                                     [value] => 176
2024-09-28T15:42:09.952558638Z                                                     [unit] => km
2024-09-28T15:42:09.952575889Z                                                 )
2024-09-28T15:42:09.952588739Z
2024-09-28T15:42:09.952600962Z                                         )
2024-09-28T15:42:09.952613394Z
2024-09-28T15:42:09.952625826Z                                     [timestamp] => 1727527170471
2024-09-28T15:42:09.952638118Z                                     [schedules] => Array
2024-09-28T15:42:09.952650619Z                                         (
2024-09-28T15:42:09.952662912Z                                             [0] => Array
2024-09-28T15:42:09.952674924Z                                                 (
2024-09-28T15:42:09.952687775Z                                                     [chargeToFull] =>
2024-09-28T15:42:09.952700137Z                                                     [scheduleType] => CHARGE
2024-09-28T15:42:09.952712639Z                                                     [enableScheduleType] => 1
2024-09-28T15:42:09.952724931Z                                                     [scheduledDays] => Array
2024-09-28T15:42:09.952737363Z                                                         (
2024-09-28T15:42:09.952749725Z                                                             [sunday] => 1
2024-09-28T15:42:09.952762157Z                                                             [saturday] => 1
2024-09-28T15:42:09.952784087Z                                                             [tuesday] => 1
2024-09-28T15:42:09.952796449Z                                                             [wednesday] => 1
2024-09-28T15:42:09.952809021Z                                                             [thursday] => 1
2024-09-28T15:42:09.952821243Z                                                             [friday] => 1
2024-09-28T15:42:09.952833815Z                                                             [monday] => 1
2024-09-28T15:42:09.952847015Z                                                         )
2024-09-28T15:42:09.952859307Z
2024-09-28T15:42:09.952871250Z                                                     [startTime] => 02:00
2024-09-28T15:42:09.952883891Z                                                     [endTime] => 06:00
2024-09-28T15:42:09.952896253Z                                                     [cabinPriority] =>
2024-09-28T15:42:09.952908755Z                                                     [repeatSchedule] => 1
2024-09-28T15:42:09.952921047Z                                                 )
2024-09-28T15:42:09.952933060Z
2024-09-28T15:42:09.952945492Z                                             [1] => Array
2024-09-28T15:42:09.952957784Z                                                 (
2024-09-28T15:42:09.952970286Z                                                     [chargeToFull] =>
2024-09-28T15:42:09.952982578Z                                                     [scheduleType] => CHARGE
2024-09-28T15:42:09.952995080Z                                                     [enableScheduleType] =>
2024-09-28T15:42:09.953007372Z                                                     [scheduledDays] => Array
2024-09-28T15:42:09.953020223Z                                                         (
2024-09-28T15:42:09.953032306Z                                                             [sunday] =>
2024-09-28T15:42:09.953045017Z                                                             [saturday] =>
2024-09-28T15:42:09.953057030Z                                                             [tuesday] =>
2024-09-28T15:42:09.953069881Z                                                             [wednesday] =>
2024-09-28T15:42:09.953082243Z                                                             [thursday] =>
2024-09-28T15:42:09.953094744Z                                                             [friday] =>
2024-09-28T15:42:09.953106967Z                                                             [monday] =>
2024-09-28T15:42:09.953119748Z                                                         )
2024-09-28T15:42:09.953131691Z
2024-09-28T15:42:09.953143913Z                                                     [startTime] => 00:00
2024-09-28T15:42:09.953165424Z                                                     [endTime] => 00:00
2024-09-28T15:42:09.953177717Z                                                     [cabinPriority] =>
2024-09-28T15:42:09.953190707Z                                                     [repeatSchedule] => 1
2024-09-28T15:42:09.953203069Z                                                 )
2024-09-28T15:42:09.953215431Z
2024-09-28T15:42:09.953227374Z                                             [2] => Array
2024-09-28T15:42:09.953239666Z                                                 (
2024-09-28T15:42:09.953252238Z                                                     [chargeToFull] =>
2024-09-28T15:42:09.953264530Z                                                     [scheduleType] => CHARGE
2024-09-28T15:42:09.953293165Z                                                     [enableScheduleType] =>
2024-09-28T15:42:09.953306016Z                                                     [scheduledDays] => Array
2024-09-28T15:42:09.953318518Z                                                         (
2024-09-28T15:42:09.953330740Z                                                             [sunday] =>
2024-09-28T15:42:09.953343242Z                                                             [saturday] =>
2024-09-28T15:42:09.953358048Z                                                             [tuesday] =>
2024-09-28T15:42:09.953370271Z                                                             [wednesday] =>
2024-09-28T15:42:09.953382703Z                                                             [thursday] =>
2024-09-28T15:42:09.953395344Z                                                             [friday] =>
2024-09-28T15:42:09.953407706Z                                                             [monday] =>
2024-09-28T15:42:09.953419719Z                                                         )
2024-09-28T15:42:09.953432011Z
2024-09-28T15:42:09.953443954Z                                                     [startTime] => 00:00
2024-09-28T15:42:09.953456875Z                                                     [endTime] => 00:00
2024-09-28T15:42:09.953469167Z                                                     [cabinPriority] =>
2024-09-28T15:42:09.953481250Z                                                     [repeatSchedule] => 1
2024-09-28T15:42:09.953494031Z                                                 )
2024-09-28T15:42:09.953505974Z
2024-09-28T15:42:09.953518336Z                                         )
2024-09-28T15:42:09.953530698Z
2024-09-28T15:42:09.953542780Z                                 )
2024-09-28T15:42:09.953555072Z
2024-09-28T15:42:09.953567015Z                             [timestamp] => 1727527170471
2024-09-28T15:42:09.953588876Z                         )
2024-09-28T15:42:09.953601378Z
2024-09-28T15:42:09.953613740Z                     [location] => Array
2024-09-28T15:42:09.953625613Z                         (
2024-09-28T15:42:09.953638184Z                             [timeStamp] => 1727527151695
2024-09-28T15:42:09.953650337Z                             [longitude] => 0.6516565057205
2024-09-28T15:42:09.953663118Z                             [latitude] => 46.651615644434
2024-09-28T15:42:09.953675201Z                             [altitude] => 143.19999694824
2024-09-28T15:42:09.953687493Z                             [bearing] => 0
2024-09-28T15:42:09.953699925Z                             [isLocationApprox] => 1
2024-09-28T15:42:09.953712357Z                         )
2024-09-28T15:42:09.953724649Z
2024-09-28T15:42:09.953736242Z                 )
2024-09-28T15:42:09.953748535Z
2024-09-28T15:42:09.953760967Z         )
2024-09-28T15:42:09.953772910Z
2024-09-28T15:42:09.953784713Z )
2024-09-28T15:42:09.953797284Z 2024-09-28 17:42:09 updated data for (ZFDKHDKH5NX094438)
dsigmoun commented 3 weeks ago

I'm trying to save the json to a file, but I can't. On line 139, I added file_put_contents('log.txt',$x);

but it doesn't work. I can't find a file with that name.

mahil4711 commented 3 weeks ago

do you have tried to write the file via an absolute path e.g. file_put_contents('/tmp/log.txt',$x) ?

I assume when you are running "docker logs -f fiat" you should see all the log output.

dsigmoun commented 3 weeks ago

Thanks, I was able to recover everything with "docker logs -f fiat" 🙏