This refactors the existing code to make it more maintainable.
Nil values are published as "nil" string. This ensures that they will
get published, and ensures that MQTT doesn't drop the retained data.
Fixes#3748
Latest version - after rewrite in Rust - just released yesterday is much
nicer and has fewer bugs.
For example, it now uses process-compose which is full screen interface
for showing running processes.
Blog post: https://devenv.sh/blog/2024/03/20/devenv-10-rewrite-in-rust/
This will add support for nix flakes. Which really helps with my
development on nixos. This has two basic parts:
1. DEVELOPMENT
After this you can use the following commands on computer with nix and a
patched version of direnv:
direnv allow
devenv up
And it will automatically start and instance of postgresql and mosquitto
for development.
And the environment variables are already configured for teslamate.
So then can start teslamate with:
npm install --prefix ./assets && npm run deploy --prefix ./assets
iex -S mix phx.server
This part is all working as designed. And pretty simple and straight
forward.
2. NIX PACKAGE OF TESLA
This is 99% complete, but some pain points I haven't addressed yet.
Because I don't yet know of good solutions.
* There are two checksums in flake.nix that needs to be updated whenever
mix.lock or package-lock.json changes.
This is required because the default value is "" which tells the mqtt
server to delete the retained value.
This in turn means that applications that care about when the car is in
a unknown location will not get the retained value.
This is a bit different from all of the other values in
`@always_published`. For them "" is only published if the value is
unknown or an error occurred. So it makes sense to delete the retained
value.
In this case however, a value of "" generally means "the car is outside
any known geofence" which is a valid condition it itself, and it should
be retained.
There was speculation this might affect the shift_state, but
unfortunately this was not followed up with any evidence or details. #1912
There are any number of solutions that could be deployed here. The
advantage of this solution however is it is not going to break anything
unless you specifically define the TESLAMATE_DEFAULT_GEOFENCE variable.
Fixes: #1336