De NatteVoeten Sensor
For me: The Syntax.
Publish to RaspberryPi
It's an ARM device, so it has to be build here and deployed manually.
There's no runtime for the ARM, but it will be complited to an executable. Use chmod +x Nvs
on the Pi.
Build
dotnet publish -c Release -r linux-arm
Copy to RPi
scp -r /home/bem/Projects/Nvs/bin/Release/netcoreapp2.2/linux-arm/publish/* dotnet@rpi3a.bem.dmz:/home/dotnet/Nvs/
scp -r /home/bem/Projects/Nvs/Data/ dotnet@rpi3a.bem.dmz:/home/dotnet/Nvs/
scp -r /home/bem/Projects/Nvs/bin/Release/netcoreapp2.2/linux-arm/publish/Sens* dotnet@rpi3a.bem.dmz:/home/dotnet/Nvs/
Only changed Assemblies:
scp -r /home/bem/Projects/Nvs/bin/Release/netcoreapp2.2/linux-arm/publish/Sens* dotnet@rpi3a.bem.dmz:/home/dotnet/Nvs/
Initialize or update schema on Sqlite DataBase
Create database: to scaffold a migration and create the initial set of tables for the model.
dotnet ef migrations add InitialCreate
Update to apply the new migration to the database. This command creates the database before applying migrations.
dotnet ef database update
Next time: delete database and recreate. the sqlite driver is not capable of adding/removing columns.
rm -R Migrations
rm ./Data/*.db
dotnet ef migrations add InitialCreate
dotnet ef database update
Sqlite Database Browser
Install: sudo apt install sqlitebrowser
Syntax Api
http://rpi3a.bem.dmz:8443/api/Sensor/Register?data={%22MacAddress%22%3A%22BA:01:02:03:04:05%22%2C%22EmailAddress%22%3A%22bas@nattevoetensensor.nl%22%2C%22SensorName%22%3A%22Als%20het%20Beessie%20maar%20een%20Naam%20heeft%22}
http://rpi3a.bem.dmz:8443/api/Sensor/Event?data={%22MacAddress%22%3A%22BA:01:02:03:04:05%22%2C%22EventType%22%3A%22heartbeat%22%2C%22BatteryVoltage%22%3A3.76}
http://rpi3a.bem.dmz:8443/api/Sensor/Event?data={%22MacAddress%22%3A%22BA:01:02:03:04:05%22%2C%22EventType%22%3A%22DetectionOn%22}
http://rpi3a.bem.dmz:8443/api/Sensor/Event?data={%22MacAddress%22%3A%22BA:01:02:03:04:05%22%2C%22EventType%22%3A%22DetectionOff%22}