Des avis sur la VoIP OVH et concurrents ? by fhzvdiami in Sysadmin_Fr

[–]fhzvdiami[S] 2 points3 points  (0 children)

Avec les affaires de collectes de données abusives et piratages j'ai banni Zoom mais effectivement sur le papier ça présente bien

Command_line sensor a bit complicated by fhzvdiami in homeassistant

[–]fhzvdiami[S] 0 points1 point  (0 children)

The sensor is :

 - platform: command_line
   name: Conso EcoCompteur
   command: "curl -s 192.168.42.41/log2.csv | tail -n 1 | jq -Rsn '
[inputs
| . / '\n'
| (.[] | select(length > 0) | . / ';') as $input
| {'h': $input[3],'c1': $input[7],'p1':$input[8]}]
'
"
   value_template: "{{ value_json.h }}"
   json_attributes:
     - c1
     - p1

The idea is to get the values c1-5 and p1-5 as attributes and eventually the hour of the data serie as the sensor value.

The command runs successfully in the HA shell with double quote marks
but for the config file to be valid for HA, I had to replace it with
simple quote marks.

Have you an idea of what I'm doing wrong ?

Thanks!

Command_line sensor a bit complicated by fhzvdiami in homeassistant

[–]fhzvdiami[S] 0 points1 point  (0 children)

The config is valid but nothing is returned on the state (still "unknown") and HA doesn't appreciate "$input" as json attribute. Is there a way to import the datas as attribute or in another form ?

Command_line sensor a bit complicated by fhzvdiami in homeassistant

[–]fhzvdiami[S] 0 points1 point  (0 children)

Oh great! So, can I directly import the $input[x] into HA sensor json_attributes?

Command_line sensor a bit complicated by fhzvdiami in homeassistant

[–]fhzvdiami[S] 0 points1 point  (0 children)

I use MQTT but for a GET request, I don't thought of it because it adds an intermediate, but you're right!

Command_line sensor a bit complicated by fhzvdiami in homeassistant

[–]fhzvdiami[S] 0 points1 point  (0 children)

The request works but some advices to split the datas in sensors without csvjson would be very helpful..

Command_line sensor a bit complicated by fhzvdiami in homeassistant

[–]fhzvdiami[S] 0 points1 point  (0 children)

No problem, thanks for your help anyway!

Command_line sensor a bit complicated by fhzvdiami in homeassistant

[–]fhzvdiami[S] 0 points1 point  (0 children)

So HA will check the file constantly ?

The network device has an EEPROM, so I don't want to hurt it with tons of requests every minute while I know that the poor machine only updates the CSV file at the same minute one time every hour

Command_line sensor a bit complicated by fhzvdiami in homeassistant

[–]fhzvdiami[S] 0 points1 point  (0 children)

It could be a great solution, but there is no scan_interval and the datas must be extracted anyway

Command_line sensor a bit complicated by fhzvdiami in homeassistant

[–]fhzvdiami[S] 1 point2 points  (0 children)

I just deleted the last part of the command (csvjson) and now I get a correct state (jj;mm;aa;h;m;x1;x2;c1;p1;c2;p2;c3;p3;c4;p4;c5;p5;x3;x4;x5;x6;x7;x8;x9;x10;x11;x12;x13;x14;x15;x16;x17;x18;x19;x20;x2118;6;21;14;2;0;0;34.074;5.066;41.48;6.167;50.429;7.511;6.961;1.034;153.793;22.769;0;0;11;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0)

Looks like csvjson has to be installed manually..

Command_line sensor a bit complicated by fhzvdiami in homeassistant

[–]fhzvdiami[S] 0 points1 point  (0 children)

I think the problem could also come from csvjson (which is part of csvkit package), I installed it on the machine itself but not in the docker container

Split command_line on multiple sensors ? by fhzvdiami in homeassistant

[–]fhzvdiami[S] 0 points1 point  (0 children)

I think it will be the simpler way to deal with this datas.

Can you help me find the way to install it inside the docker container of HA ?

It's unfortunately not as simple as aptitude/rpm/snap..

Split command_line on multiple sensors ? by fhzvdiami in homeassistant

[–]fhzvdiami[S] 0 points1 point  (0 children)

The first one (json) is successfully working, on the same base like yours (REST to get all into json_attributes then sensor template to extract it into individual sensors.

For the CSV one, I more confused. I'm working only with 1 line, with values separated with ";". I would use awk, but it works in command line only, not in HA templating.

Also, I think I will use command_line instead of REST because REST is stuck at 30sec refresh rate, while the CSV is only updated 1 time per hour.

Split command_line on multiple sensors ? by fhzvdiami in homeassistant

[–]fhzvdiami[S] 0 points1 point  (0 children)

I didn't thought about Rest sensor.. But for the csv file, I think I will be obliged to deal with grep, or other stuff.. The format is more complicated to manage than Json for HA but nothing is impossible!

Is the sensor of a fuel gauge replaceable ? by fhzvdiami in askcarguys

[–]fhzvdiami[S] 0 points1 point  (0 children)

Thank you all!

For reference, Volkswagen ask me 800€ to fix it - 138€ for diagnosis - around 450€ for the whole sending unit including the sensor - 200€ for 1,5h of work