Busch-Jaeger / node-free-at-home

4 stars 5 forks source link

Advice for on-device Debugging #3

Open geri-m opened 1 year ago

geri-m commented 1 year ago

Hi,

I have an Add-on that is crashing on the Access Point. (the virtual device does not respond anymore). It works fine while running in the IDE. So I was wondering, if you could give advice on how to debug such a problem. This there the possibilty to obtain logs from the Access Point?

Any Help is appreciated.

roelandkluit commented 1 year ago

Hi Geri-m,

You could take a look at https://github.com/DerLobi/remotelog

geri-m commented 9 months ago

thanks @roelandkluit. I saw your other plugin. I'm experimenting with a weather station. I was unable to get meters for water and energy running. do you have any experience there?

roelandkluit commented 9 months ago

thanks @roelandkluit. I saw your other plugin. I'm experimenting with a weather station. I was unable to get meters for water and energy running. do you have any experience there?

Hi Geri-m, I have created a ESP32 based weather station, published at: https://github.com/roelandkluit/FaH_ESPWeatherStation

For the energy messuring. i have been testing the V2 channels. But it will create very unresponsive widgets in the Gui (Web and App) so i didn't continue this for this moment;

async function main()
{   
    console.log("UMR FAH Connector Starting");
    var freeAtHome = new FreeAtHome();
    freeAtHome.activateSignalHandling();

    await addons.connectToConfiguration();
    await timer(500);
    console.log("FAH initialization completed");

    //Energy consuption monitor device
    var monPlug1 = await freeAtHome.createEnergyOneWayMeterV2Device("TestEIMD2", "TestEIMD2");
    await timer(1000);
    monPlug1.setAutoKeepAlive(true);
    monPlug1.setAutoConfirm(true);
    monPlug1.setCurrentPowerConsumed("10");
    monPlug1.setAutoConfirm(true);
    monPlug1.setAutoKeepAlive(true);

    //Energy and invertor messurement
    const device = await freeAtHome.freeAtHomeApi.createDevice(<VirtualDeviceType>"EnergyMeterv2","TestEIMD", "TestEIMD", "0A");
    const channelIterator = device.getChannels();
    const channels = {
        meter: new EnergyTwoWayMeterV2Channel(channelIterator.next().value),
        inverter: new EnergyInverterV2Channel(channelIterator.next().value)
    }

    channels.inverter.setAutoConfirm(true);
    channels.inverter.setAutoKeepAlive(true);
    channels.inverter.setCurrentPowerConsumed("150"); //Huidige teruglevering in W 
    channels.inverter.setImportedEnergyToday("6000"); //Opgewekt
    channels.inverter.setTotalEnergyImported("500"); //Totaal opgewekt

    channels.meter.setAutoKeepAlive(true);    
    channels.meter.setAutoConfirm(true);
    channels.meter.setCurrentPowerConsumed("-30"); //Terugleveren of opnemen uit net
    channels.meter.setExportedEnergyToday("5000"); //Totaal teruggeleverd vandaag
    channels.meter.setImportedEnergyToday("7000"); //Totaal opgenomen vandaag
    channels.meter.setTotalEnergyImported("19000"); //Totaal opgenomen
    channels.meter.setTotalEnergyExported("5500"); //Totaal teruggeleverd

    var GasChannel = await freeAtHome.createGasMeterDevice("TestGas", "TestGas");
    await timer(1000);
    GasChannel.setAutoKeepAlive(true);
    GasChannel.setAutoConfirm(true);
    GasChannel.setGasConsumed("100");
    GasChannel.setGasConsumedToday("5");

}
try {
    main();    
}
catch (error) {
    console.error(error);
}
geri-m commented 9 months ago

Thanks for the pointer @roelandkluit. My Problem with the V2 Devices is, that I'm able to create them - but the widget does not show up in the App/Web UI at all since the recent SAP updates :-( If you come across, I'm happy to take advice.

roelandkluit commented 8 months ago

Thanks for the pointer @roelandkluit. My Problem with the V2 Devices is, that I'm able to create them - but the widget does not show up in the App/Web UI at all since the recent SAP updates :-( If you come across, I'm happy to take advice.

Have you assigned the Meter Devices to devices to a room?

geri-m commented 8 months ago

yes, I did. I suspected this to be the problem. I also tried then reseting and restarting the device in the UI, but no luck :-/

StefanGuelland commented 4 months ago

With a project based on the github example you can do the following to get the logs from an addon that is running on the system access point

export FREEATHOME_BASE_URL=http://192.168.42.78
npm run journal

> free-at-home-example@1.0.0 journal
> free-at-home-cli journal --filterAddon

open journal